量角器测试等待页面同步超时

Protractor test timing out waiting for page sync

我的量角器测试在等待页面同步时超时。我检查了控制台,没有显示任何错误,所以我在调试时遇到了麻烦。我试过使用 allScriptsTimeout 和 defaultTimeoutInterval 都无济于事。我的应用程序中没有轮询,测试似乎确实登录正确,它只是在登录后挂起,即使一切看起来都已完全呈现。我的代码:

配置文件:

var exports;
exports.config = {
// The address of a running selenium server.
seleniumAddress: 'http://localhost:4444/wd/hub',    

// Spec patterns are relative to the location of this config.
specs: [
    'scenarios/features/portfolio-manager-e2e-local.js'
],

multiCapabilities: [
    {
        'browserName': 'chrome'
    }
],

jasmineNodeOpts: {
    onComplete: null,
    isVerbose: true,
    showColors: true,
    includeStackTrace: true,
    defaultTimeoutInterval: 20000,
}
};

测试:

我现在只post一个,第一个运行但失败的测试:

it('should login user with correct credentials', function () {
    browser.get('/#/portfolio');
    element(by.model('username')).sendKeys('test');
    element(by.model('password')).sendKeys('test');
    element(by.css('.btn.btn-md.btn-primary')).click();
    expect(element(by.css('.port-header')).getText()).toEqual("Portfolios");
});

谢谢。

在做出任何断言之前,您需要wait for angular

Instruct webdriver to wait until Angular has finished rendering and has no outstanding $http calls before continuing.

browser.get('/#/portfolio');
browser.waitForAngular()

我发现 ngToast 成功登录弹出窗口的超时为 15.5 秒,这导致了挂断。