簡體   English   中英

如何在量角器測試中設置$ interval而不是超時

[英]how to set $interval instead of timeout in Protractor Tests

我正在使用appiumProtractor進行iOS混合應用程序自動化。 我在config.js文件中使用超時,但收到錯誤:以下是我的config.jsspec.js文件。

請就如何使用$ interval而不是超時提出建議。

Config.js:

exports.config = {allScriptsTimeout:30000,getPageTimeout:30000,ignoreSynchronization:true,seleniumAddress:' 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);
  }, 
};

Spec.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

請提出您的建議。 謝謝,

實際上不可能使用$interval代替config.js文件中的默認timeout參數。

我猜你問的原因是因為如果遇到超時問題,量角器文檔建議在Angular應用中使用$interval而不是$timeout 在量角器測試中,這不需要更改。 這需要在應用本身中進行更改。

您自己的文件看起來不錯。

您的錯誤有點奇怪。 與應用程序開發人員聯系,查看他們是否可以找到不會回來的$http$timeout 還要確保頁面按預期加載。 檢查開發人員控制台中是否有錯誤,檢查“網絡”標簽中是否有待處理的請求,並大體上確保一切就緒。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM