Mi sembra di avere un errore quando si utilizza l'esempio conf.js
fornito con il rapportatore. Sto eseguendo i miei test con grunt-protractor-runner
ma errori anche quando si utilizza la configurazione di esempio fornita."window.angular non è definito." quando si usa il goniometro per i test automatici?
mio Gruntfile.js
assomiglia a questo:
/*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: { // Grunt requires at least one target to run so you can simply put 'all: {}' here too.
options: {
configFile: "smoketest.conf.js", // Target-specific config file
args: {
}
}
},
protractor_test: { // Grunt requires at least one target to run so you can simply put 'all: {}' here too.
options: {
configFile: "./node_modules/protractor/example/conf.js", // Target-specific config file
args: {
}
}
},
},
})
grunt.loadNpmTasks('grunt-protractor-runner');
// Default task.
grunt.registerTask('default', ['protractor:smoke_test']);
};
Sono in esecuzione grunt protractor:protractor_test
che utilizza questo 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');
});
});
});
tuttavia, quando questo viene eseguito sto presentato con l'errore
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"`enter code here`
Sono stato a http://git.io/v4gXM ma non posso sembra di trovare qualcosa per risolvere il mio problema? Qualcun altro ha avuto questo problema, sicuramente il test di esempio dovrebbe funzionare sempre ??
ritornato di nuovo a una versione precedente di goniometro (ultima nota a lavorare con i nostri script di test) e funziona ...? –
probabilmente a causa di 'Jasmine' prova a passare a usare' Jasmine2' la prossima volta se hai il problema simile. (Ci sono molte possibilità per questo, ma la soluzione più semplice è usare jasmine2) –
Sto ottenendo anche un errore simile dopo aver aggiornato il goniometro. Per me, non ho ricevuto questo errore in 3.1.1, ma ho ricevuto altri errori, quindi speravo che la 3.2.1 avrebbe corretto quegli errori. Ma con 3.2.1 mi sto imbattendo in questo errore esatto. Ho pensato che potrebbe essere dovuto al fatto che la mia direttiva ng-app si trova sull'elemento html e non sull'elemento body. Ma aggiungere rootElement: 'html' alla mia configurazione del goniometro non ha aiutato. https://github.com/angular/protractor/issues/1742 – Keith