0
我有以下代码:量角器执行挂起
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');
});
的问题是,它没有达到第二“它”,但是失败:
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"])
如果我添加:
browser.waitForAngularEnabled(false);
然后它继续进行最后的测试,它的工作原理,但这是正确的解决方案吗?
尝试增加时间'allScriptsTimeout'关闭等待角在配置文件中有一些更高的值。 –