【问题标题】:protractor angular2 Timed out waiting for asynchronous Angular tasks to finishprotractor angular2 等待异步 Angular 任务完成超时
【发布时间】:2017-12-18 06:11:12
【问题描述】:

我知道这是一个常见问题,并且有很多关于它的话题,但我暂时没有设法解决它。 我使用量角器 5.1.2(带有 Cucumber-js)来测试一个完整的 Angular2 应用程序。但是等待角度失败:

E/launcher - Timed out waiting for asynchronous Angular tasks to finish after 27 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.cssContainingText("preview-contract", "Box Internet")

我失败的一步:

this.When(/^I choose "([^"]*)" flow$/, function (flow, callback) {
    element(by.cssContainingText("preview-contract",flow)).element(by.linkText("Voir les offres")).click();
    callback();
});

这很有效:

this.When(/^I choose "([^"]*)" flow$/, function (flow, callback) {
    browser.ignoreSynchronization = true;
    browser.sleep(10000);
    element(by.cssContainingText("preview-contract", flow)).element(by.linkText("Voir les offres")).click();
    callback();
});

还有我的配置文件:

exports.config = {
baseUrl: 'http://localhost:4200/',
seleniumAddress: 'http://127.0.0.1:4444/wd/hub',
capabilities: {
    browserName: 'chrome'
},

allScriptsTimeout: 27000,
getPageTimeout : 29000,

framework: 'custom',

frameworkPath: require.resolve('protractor-cucumber-framework'),

useAllAngular2AppRoots: true,
...

我读过有关 ngZone 的资料,但我不是开发人员,所以我不知道如何让它再次工作。我的配置有什么问题吗?

【问题讨论】:

  • 尝试增加配置中的allScriptsTimeoutgetPageTimeout 选项,看看是否能解决问题。
  • 两者都增加到 60000,结果相同。浏览器在预期的页面打开,然后在应该点击链接的地方什么也不做。

标签: angular protractor


【解决方案1】:

尝试在启动浏览器后立即定义角度等待。

例如:loginPage.getPage();//launch the browser url. browser.waitForAngularEnabled(true);

【讨论】:

  • 同样的结果,同样的输出。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-05-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-09-14
  • 2017-10-30
相关资源
最近更新 更多