如何在量角器测试中设置$interval而不是超时
how to set $interval instead of timeout in Protractor Tests
我正在使用appium
和Protractor
进行iOS混合应用程序自动化。我在我的 config.js 文件中使用了超时,但收到错误:下面是我的配置.js和规范.js文件。
请告知如何使用$interval而不是超时。
配置.js:
export.config = { allScriptsTimeout: 30000 , getPage超时: 30000 , 忽略同步:真 , 硒地址: 'http://localhost:4723/wd/hub',
specs: ['PageObjectSpec.js'],
capabilities: {
browserName: 'iOS' ,
'appium-version':'1.3.4',
platformName:'iOS' ,
platformVersion: 7.1 ,
deviceName:'iPhone' ,
autoWebview:true ,
},
baseUrl: 'http://localhost:8000',
jasmineNodeOpts: {showColors: true, defaultTimeoutInterval:60000} ,
onPrepare: function() {
browser.manage().timeouts().setScriptTimeout(60000);
},
};
规格.js文件::
'use strict';
describe('Abbvie app test', function()
{
var userName = browser.element(by.model('credentials.username'));
var passwd = browser.element(by.model('credentials.password'));
var signin = browser.element(by.buttonText('Sign In'));
it('Login Page test', function()
{
userName.click();
//userName.sendKeys(name)
passwd.click();
//passwd.sendKeys(pass)
signin.click();
}, 60000);
});
**量角器日志:**在
http://localhost:4723/wd/hub
[launcher] Running 1 instances of WebDriver
A Jasmine spec timed out. Resetting the WebDriver Control Flow.
The last active task was:
Protractor.waitForAngular()
at [object Object].webdriver.WebDriver.schedule (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:345:15)
at [object Object].Protractor.executeAsyncScript_ (/usr/local/lib/node_modules/protractor/lib/protractor.js:251:26)
at [object Object].Protractor.waitForAngular (/usr/local/lib/node_modules/protractor/lib/protractor.js:274:15)
at [object Object].getWebElements (/usr/local/lib/node_modules/protractor/lib/element.js:136:19)
at [object Object].getWebElements (/usr/local/lib/node_modules/protractor/lib/element.js:669:31)
at [object Object].ElementArrayFinder.applyAction_ (/usr/local/lib/node_modules/protractor/lib/element.js:391:28)
at [object Object].self.(anonymous function) [as click] (/usr/local/lib/node_modules/protractor/lib/element.js:77:19)
at [object Object].self.(anonymous function) [as click] (/usr/local/lib/node_modules/protractor/lib/element.js:698:11)
at [object Object].<anonymous> (/Users/qualcomm/Desktop/ProtractorTest/PageObjectSpec.js:13:11)
F
Failures:
1) Abbvie app test Login Page test
Message:
timeout: timed out after 60000 msec waiting for spec to complete
Stacktrace:
undefined
Finished in 65.404 seconds
1 test, 1 assertion, 1 failure
[launcher] 0 instance(s) of WebDriver still running
[launcher] iOS #1 failed 1 test(s)
[launcher] overall: 1 failed spec(s)
[launcher] Process exited with error code 1
请提出您的建议。谢谢
实际上不可能
在config.js
文件中使用 $interval
而不是默认的 timeout
参数。
我猜你问的原因是,如果你遇到超时问题,量角器文档建议在你的 Angular 应用程序中使用 $interval
而不是$timeout
。这不是量角器测试中需要更改的内容;这是应用程序本身需要更改的内容。
您自己的文件看起来不错。
你的错误有点奇怪。与应用程序开发人员交谈,看看他们是否可以找到不会回来的$http
或$timeout
。还要确保页面按其规定加载;检查开发人员控制台是否有错误,检查"网络"选项卡是否存在待处理的请求,并确保一切就绪。
相关文章:
- 使用优化器在慢速连接上加载main.js时需要js超时
- 当浏览器控制台未打开时,为什么要求会导致Internet Explorer 9超时
- 超时功能的性能
- 使用不同的超时对数组中的每个项目进行角度动画处理
- 设置第一次执行的超时
- node.js测试事件是否是在不使用超时的情况下使用sinon.js发出的
- 使用javascript和随机暂停/超时快速循环文本
- 如何在jQuery事件处理程序中存储和重用超时
- 当定位模式设置为“0”时,总是达到关于地理定位的超时;仅设备”;
- 为什么页面重新加载会使设置超时无效,以及如何避免
- 立即设置超时
- 在promise中为回调添加超时并拒绝
- 如何设置$.ajax请求的超时,并在超时时间过长时进行重做
- iOS Safari Javascript设置超时问题
- 如何将嵌套设置超时转换为承诺
- XMLHTTPRequest脚本中没有internet连接和超时
- CXP项目中的Javascript超时
- 超时后才能再次单击
- Angular js$Interval怪异行为-Firefox Chrome
- 如何在量角器测试中设置$interval而不是超时