我有一个登录表单,我想设置输入到两个输入,但测试没有在Chrome,Safari浏览器通过,但与Firefox它的工作原理。
起初我有一个$ HTTP请求和它完成,而据我所知,量角器继续当$ HTTP是完成的,因此这不应该成为问题,是这样吗?
错误:
未捕获的异常:超时等待量角器同步 以11秒后的页面。请参见 https://github.com/angular/protractor/blob/master/docs /faq.md
这是我的测试:
\r\r
描述('ADM登录页',函数(){\rbeforeEach(函数(){\rbrowser.get('http://127.0.0.1:8383/v2');\r});\r\r它('登陆',函数(){\rVAR用户名=元素(by.css('div.e2e-ADM-用户名输入input.Input持有人))\r密码=元素(by.css('div.e2e-ADM-密码输入input.Input持有人'));\r\rusername.sendKeys('测试');\r期待(username.getText())TOBE(测试)。\r\rpassword.click();\r\rpassword.sendKeys(',,测试);\r期待(password.getText())TOBE(',,测试)。\r\r。元素(by.css('div.Login-ActionHolder a.Big-行动))点击();\r});\r});
\r\r\r
解决方案您可以添加allScriptsTimeout:在量角器配置文件毫秒。我有在这时间太长背景中的$ HTTP请求。
exports.config = { ... allScriptsTimeout:50000, ...};
I have a login form, and I want to set input to both inputs, but the test doesn't go through in Chrome, Safari, but with Firefox it works.
Initially I have a $http request and it is done, and as I know, protractor continues when $http is done, so this should not be the issue, or is it?
Error:
Uncaught exception: Timed out waiting for Protractor to synchronise with the page after 11 seconds. Please see https://github.com/angular/protractor/blob/master/docs/faq.md
This is my test:
describe('ADM login page', function () {
beforeEach(function () {
browser.get('http://127.0.0.1:8383/v2');
});
it('login', function () {
var username = element(by.css('div.e2e-adm-username-input input.Input-Holder')),
password = element(by.css('div.e2e-adm-password-input input.Input-Holder'));
username.sendKeys('test');
expect(username.getText()).toBe('test');
password.click();
password.sendKeys(',,test');
expect(password.getText()).toBe(',,test');
element(by.css('div.Login-ActionHolder a.Big-Action')).click();
});
});
解决方案
you could add allScriptsTimeout: milliseconds in protractor configuration file. I was having a $http request in the background that was taking too long.
exports.config = {
...
allScriptsTimeout: 50000,
...
};