大约 50% 的情况下,我们的量角器测试套件中的第一个测试失败并显示以下错误:
Timed out waiting for Protractor to synchronize with the page after 0ms
因此,我们更新了protractor.conf.js
,以明确包含一些合理的超时:
exports.config = {
baseUrl: 'http://localhost:9001',
specs: ['e2e/website.spec.js'],
capabilities: {
browserName: 'firefox'
},
getPageTimeout: 10000,
allScriptsTimeout: 10000,
我们仍然在第一次测试中超时,但这次使用一些任意低的数字,而不是 0ms:
Timed out waiting for Protractor to synchronize with the page after 15ms.
Timed out waiting for Protractor to synchronize with the page after 1ms.
超时的确切行是:
beforeEach(function() {
browser.get('/#/signout');
browser.waitForAngular(); // Timeout here.
});
我们找到了罪魁祸首:'angular-loading-bar'
从我们的项目中删除它后,问题消失了。