为什么在启用waitForAngularEnabled(true)的情况下使用量角器运行e2e测试时出错
我在用量角器测试我的测角应用程序。对于登录页面,我设置waitForAngularEnabled(false),然后将其设置为waitForAngularEnabled(true)。但我的测试失败,出现以下错误:为什么在启用waitForAngularEnabled(true)的情况下使用量角器运行e2e测试时出错,angular,protractor,angular9,Angular,Protractor,Angular9,我在用量角器测试我的测角应用程序。对于登录页面,我设置waitForAngularEnabled(false),然后将其设置为waitForAngularEnabled(true)。但我的测试失败,出现以下错误: Failed: script timeout (Session info: chrome=85.0.4183.83) (Driver info: chromedriver=85.0.4183.38 (9047dbc2c693f044042bbe
Failed: script timeout
(Session info: chrome=85.0.4183.83)
(Driver info: chromedriver=85.0.4183.38 (9047dbc2c693f044042bbec5c91401c708c7c26a-refs/branch-heads/4183@{#779}),platform=Windows NT 10.0.18362 x86_64)
(Session info: chrome=85.0.4183.83)
(Driver info: chromedriver=85.0.4183.38 (9047dbc2c693f044042bbec5c91401c708c7c26a-refs/branch-heads/4183@{#779}),platform=Windows NT 10.0.18362 x86_64)
at Object.checkLegacyResponse (....node_modules\selenium-webdriver\lib\error.js:546:15)
at parseHttpResponse (....node_modules\selenium-webdriver\lib\http.js:509:13)
at doSend.then.response (....node_modules\selenium-webdriver\lib\http.js:441:30)
at process._tickCallback (internal/process/next_tick.js:68:7)
From: Task: Protractor.waitForAngular() - Locator: By(css selector, body)
当我搜索它时,我发现很多帖子建议我应该将同步设置为off或将waitForAngularEnabled设置为false。但是我失去了这个功能
有人知道如何解决这个问题吗?多亏了这篇文章(),我才发现这是由应用程序中使用的超时造成的。我用建议的解决方案取代了它们,现在它就像一个符咒 因此,要使其起作用,请搜索setInterval和setTimeout,并将其替换为:
ngZone.runOutsideAngular(() => {
setInterval(() => {
ngZone.run(() => {
// async operation
});
}, 2500);
将代码设置回
true