在运行我的e2e测试期间,我经常遇到一个奇怪的问题。
Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
Page是在backbone.js中开发的 量角器版本:^ 2.4.0 Jasmine ver:2 chromedriver:2.19.0",
问题经常发生在selenium网格上运行但有时候简单地运行我的浏览器上的测试失败了。我在浏览器上运行测试时注意到的是,有时浏览器冻结,因此发生此错误。它非常随机。
我的规格:
var WelcomePage = require('../pages/welcome_page.js');
var LogInToSystem = require('../helper.methods/system_authentication');
var EnvironmentInitializer = require('../setup/environment_initializer');
describe('Test -> Welcome page', function () {
var EC = protractor.ExpectedConditions;
var welcomePage = new WelcomePage();
var originalTimeout;
var increaseTimeouts = function() {
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
jasmine.DEFAULT_TIMEOUT_INTERVAL = WAIT_TIMEOUT * 50;
};
beforeAll(function () {
increaseTimeouts();
LogInToSystem.asAdmin();
EnvironmentInitializer.prepareEnvironment();
welcomePage.logout('environment preparation');
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
});
beforeEach(function () {
increaseTimeouts();
LogInToSystem.asAdmin2();
});
afterEach(function () {
welcomePage.logout();
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
});
it('should verify dropdown is not visible after clicking away', function () {
clickWithWait(welcomePage.loginButton);
browser.wait(EC.visibilityOf(welcomePage.logoutButton), WAIT_TIMEOUT, 'logoutButton was not visible ');
clickWithWait(welcomePage.usersButton);
browser.wait(EC.invisibilityOf(welcomePage.logoutButton), WAIT_TIMEOUT, 'logoutButton was not invisible ');
});
});