【发布时间】:2019-09-15 01:02:58
【问题描述】:
我正在使用 protractor-jasmine 在我的 Angular 网站上进行 e2e 测试。在使用异步函数并等待其余代码返回承诺时,Jasmine-protractor 会出错。
我什至包括:SELENIUM_PROMISE_MANAGER: false,
it('Sub-folder: Manage permission, Edit Folder name, Create Template, View Template', async ()=> {
await obj.getURL();
obj.TealoginUname.sendKeys(data.uname);
obj.TealoginPass.sendKeys(data.pass);
await obj.TealoginButton.click();
await browser.sleep(2000);
})
控制台错误:
Error: Error while waiting for Protractor to sync with the page: "both angularJS testability and angular testability are undefined. This could be either because this is a non-angular page or because your test involves client-side navigation, which can interfere with Protractor's bootstrapping. See http://git.io/v4gXM for details"
在 Eclipse 中,在写入 async/await 的那些行上显示错误。
我正在为动态元素使用页面对象模型。
var obj= require("./somefile.js");
somefile.js:-
function globalVariables()
{
this.TealoginUname= element(by.model("vm.login.userid"));
this.TealoginPass= element(by.model("vm.login.password"));
this.TealoginButton= element(by.xpath("//*[@id='login-form']/form[1]/button"));
}
【问题讨论】:
-
obj应该是什么? -
我正在使用 Page 对象模型来处理动态数据和元素。我已经更新了我的问题以包含它。
标签: angular eclipse async-await jasmine protractor