【发布时间】:2019-05-12 11:46:06
【问题描述】:
我正在为 Angular 7.x 应用程序运行 E2E 测试。测试在我的本地机器上直接运行。但是当我将它推送到 repo (GitLab) 时,管道失败并抛出以下错误:
用户个人资料 - 检查和更改个人资料 - 失败:元素不可交互 (会话信息:chrome=71.0.3578.80) (驱动信息:chromedriver=2.45.615279 (12b89733300bd268cff3b78fc76cb8f3a7cc44e5),platform=Linux 4.14.74-coreos x86_64)
测试用例:
it('USER PROFILE - Check and change PROFILE', () => {
page.navigateTo();
browser.sleep(1000);
expect(page.getProfileEditTagName()).toMatch('app-edit-profile');
expect(element(by.className('logged-as')).getText()).toBe( testEmail );
browser.actions().mouseMove( element.all( by.id('editIcon-salutation') ).get(0)).click().perform().then(function () {
browser.sleep(4000);
element( by.className('mat-select-arrow') ).click().then(function () {
browser.actions().mouseMove( element.all(by.className('option-value mat-option')).get(0)).click().perform();
browser.sleep(1000);
browser.actions().mouseMove( element.all( by.id('saveButton-salutation') ).get(0)).click().perform();
browser.sleep(1000);
});
});
});
navigateTo() 只是 profile.po.ts 中的一个方法:
navigateTo() {
browser.get('/profileComponentUrl');
}
让我感到困惑以及我什至无法本地化错误或错误之处在于它在本地运行良好。但是一旦我推动回购,那么它就在那个测试用例中失败了。请问有什么提示吗?
【问题讨论】:
-
我猜 jenkins slave 上的页面加载速度不如您本地的快。您可以注释该
it的所有代码行,然后逐行注释掉以确认行需要更多时间等待。