Encountering an issue with the example conf.js
while using protractor, even with the provided config file. I am executing tests with grunt-protractor-runner
and facing errors.
The content of my Gruntfile.js
is as follows:
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
protractor: {
options: {
configFile: "smoketest.conf.js", // Default config file
keepAlive: false, // If false, the grunt process stops when the test fails.
noColor: false, // If true, protractor will not use colors in its output.
webdriverManagerUpdate: true,
args: {
seleniumServerJar: './node_modules/protractor/selenium/selenium-server-standalone-2.51.0.jar'
}
},
smoke_test: {
options: {
configFile: "smoketest.conf.js",
args: {
}
}
},
protractor_test: {
options: {
configFile: "./node_modules/protractor/example/conf.js",
args: {
}
}
},
},
})
grunt.loadNpmTasks('grunt-protractor-runner');
// Default task.
grunt.registerTask('default', ['protractor:smoke_test']);
};
Executing grunt protractor:protractor_test
which utilizes the following file:
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 angular 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');
});
});
});
However, I am facing the following error during execution:
Error while waiting for Protractor to sync with the page: "window.angular is undefined. This could be either because this is a non-angular page or because your test involves client-side navigation, which can interfere with Protractor's bootstrapping. See http://git.io/v4gXM for details."
Visited for solutions but unable to resolve the issue. Has anyone else encountered this problem with the example test not functioning as expected?