[英]Giving error on using async/await in jasmine-protractor functions
I am doing an e2e testing on my angular site using protractor-jasmine.我正在使用 protractor-jasmine 在我的角度站点上进行 e2e 测试。 On using async functions and await for rest of the code returning promise is giving error in Jasmine-protractor.
在使用异步函数并等待返回承诺的其余代码时,在 Jasmine-protractor 中出现错误。
I even included: SELENIUM_PROMISE_MANAGER: false,
我什至包括:
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);
})
Console Error:控制台错误:
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"
In eclipse it's showing error on those lines where async
/ await
are written.在 Eclipse 中,它在写入
async
/ await
那些行上显示错误。
I am using Page object model for dynamic elements.我正在为动态元素使用 Page 对象模型。
var obj= require("./somefile.js");
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"));
}
without importing the locators add it in your test file不导入定位器将其添加到您的测试文件中
const TealoginUname= element(by.model("vm.login.userid"));
const TealoginPass= element(by.model("vm.login.password"));
const TealoginButton= element(by.xpath("//*[@id='login-form']/form[1]/button"));
Try the below one试试下面的
it('Sub-folder: Manage permission, Edit Folder name, Create Template, View Template', async ()=> {
await broswer.get('add your url here');
await browser.waitForAngularEnabled(true); // To make protractor wait for all the http request to get compelted
await TealoginUname.sendKeys(data.uname);
await TealoginPass.sendKeys(data.pass);
await TealoginButton.click();
await browser.sleep(2000);
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.