J'ai le code suivant:exécution Protractor se bloque
it('Should be able to sign in', function() {
// Find page elements
var userNameField = browser.findElement(By.id('email'));
var userPassField = browser.findElement(By.id('password'));
browser.sleep('1000');
var userLoginBtn = browser.findElement(By.id('loginbtn'));
// Fill input fields
userNameField.sendKeys('abc');
userPassField.sendKeys('123');
// Ensure fields contain what we've entered
expect(userNameField.getAttribute('value')).toEqual('abc');
expect(userPassField.getAttribute('value')).toEqual('123');
// Click to sign in
userLoginBtn.click();
expect(browser.getCurrentUrl()).toMatch('/user/dashboard');
});
it('Should be able to logout', function() {
element(by.id('logout')).click();
expect(browser.getCurrentUrl()).toMatch('/login');
});
Le problème est que ce n'est pas atteint le second 'il', mais échoue avec:
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(css selector, *[id="logout"])
Si j'ajouter:
browser.waitForAngularEnabled(false);
Ensuite, il continue le dernier test et cela fonctionne, mais est-ce la bonne solution?
essayez d'augmenter le temps de' allScriptsTimeout' clé à une valeur plus élevée dans votre fichier de configuration. –