我的测试稳定性一直存在问题。
问题是在等待某个元素时有时会出现Wait timed out after
。
这就是我在等待的方式:
var EC = protractor.ExpectedConditions;
browser.wait(EC.elementToBeClickable(userDetailsPage.position.value), WAIT_TIMEOUT, 'element position was not clickable ');
许多测试用例中出现许多EC等待问题。最大的问题是这个问题完全是随机的!
示例测试用例:
it('displays page of user', function () {
var positionUsersTableThirdRow = usersPage.thirdRowPosition.getText();
var idUsersTableThirdRow = usersPage.thirdRowId.getText();
var emailUsersTableThirdRow = usersPage.thirdRowEmail.getText();
clickWithWait(usersPage.thirdRow);
browser.wait(EC.elementToBeClickable(userDetailsPage.position.value), WAIT_TIMEOUT, 'element position was not clickable ');
browser.wait(EC.elementToBeClickable(userDetailsPage.id), WAIT_TIMEOUT, 'element id was not clickable ');
browser.wait(EC.elementToBeClickable(userDetailsPage.email), WAIT_TIMEOUT, 'element email was not clickable ');
expect(userDetailsPage.position.value.getText()).toEqual(positionUsersTableThirdRow);
expect(userDetailsPage.id.getText()).toEqual(idUsersTableThirdRow);
expect(userDetailsPage.email.getText()).toEqual(emailUsersTableThirdRow);
});
框架:jasmine2
页面是在backbone.js
中开发的等待超时定义为20000
chromedriver:2.19
量角器:版本2.5.0