Here are the versions I am currently using:
protractor v5.1.2 chromedriver v2.33 node v6.11.4 npm 3.10.10 selenium-webdriver v3.0.1
I am a beginner with protractor and I am attempting to run the provided test natively included in protractor. The test script looks like this:
describe('angularjs homepage', function() {
it('should greet the named user', function() {
browser.get('http://www.angularjs.org');
element(by.model('yourName')).sendKeys('Julie');
var greeting = element(by.binding('yourName'));
expect(greeting.getText()).toEqual('Hello Julie!');
});
describe('todo list', function() {
var todoList;
beforeEach(function() {
browser.get('http://www.angularjs.org');
todoList = element.all(by.repeater('todo in todoList.todos'));
});
it('should list todos', function() {
expect(todoList.count()).toEqual(2);
expect(todoList.get(1).getText()).toEqual('build an AngularJS app');
});
it('should add a todo', function() {
var addTodo = element(by.model('todoList.todoText'));
var addButton = element(by.css('[value="add"]'));
addTodo.sendKeys('write a protractor test');
addButton.click();
expect(todoList.count()).toEqual(3);
expect(todoList.get(2).getText()).toEqual('write a protractor test');
});
});
});
This is the content of the conf.js file:
exports.config = {
directConnect: true,
// Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'chrome'
},
// Framework to use. Jasmine is recommended.
framework: 'jasmine',
// Spec patterns are relative to the current working directory when
// protractor is called.
specs: ['example_spec.js'],
// Options to be passed to Jasmine.
jasmineNodeOpts: {
defaultTimeoutInterval: 30000
}
};
When I attempt to run the test, the following error occurs:
Failures:
1) angularjs homepage should greet the named user
Message:
Failed: Timed out waiting for asynchronous Angular tasks to finish after 11 seconds. This may be because the current page is not an Angular application. Please see the FAQ for more details: https://github.com/angular/protractor/blob/master/docs/timeouts.md#waiting-for-angular
While waiting for element with locator - Locator: by.model("yourName")
Stack:
ScriptTimeoutError: asynchronous script timeout: result was not received in 11 seconds
(Session info: chrome=60.0.3112.113)
(Driver info: chromedriver=2.33.506092 (733a02544d189eeb751fe0d7ddca79a0ee28cce4),platform=Linux 3.16.0-4-amd64 x86_64)
at WebDriverError (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:27:5)
[...] <!-- (repeated error lines have been shortened for brevity) -->
<p>I did not write this code myself. It was provided by Protractor in an 'example' folder. However, I have noticed a strange behavior. When I rearrange the test cases, the one that is placed at the top will fail, while the other test cases work fine. This happens consistently with every test case. The first test case always fails until I move it from the top position.</p>
<p>I have followed the error message link and ensured all my dependencies are up to date, but the issue persists. If anyone has encountered this strange behavior before or has a solution, I would appreciate any insight or assistance. Thank you.</p>