2016-09-23 17 views
0

私は分度器を初めて使用しています。私のコードをビルドする際Intially私は、その複数の使用が、その後私は1つのそれをすべてを移動し、今、私のコードは次のようになります。分度器非同期呼び出しの問題

var UI = require('./../ui.js'); 
var co = require('co'); 
var ui = new UI(); 

describe("MapFeedback: address-no longer exists", function() { 
    ui.setSmallScreenSize(); 
    // ui.testLogger(100); 
    it("test", co.wrap(function*() { 
     yield browser.get(ui.createStartLink()); 
     yield ui.PLACE_PROBLEM.click(); 
     expect(browser.getCurrentUrl()).toContain("report_place"); 
     yield ui.REPORT_PLACE_INAPPROPRITATE.click(); 
     expect(browser.getCurrentUrl()).toContain("select_place_content/place_content"); 

     yield ui.zoomIn(18.5); 
     //its clicking the way to early before the zoomIn is performed. 

     var elmOK = element(By.css('button[ng-click="doneSelectObject(selectedObject)"]')); 
     yield ui.waitFor(protractor.ExpectedConditions.elementToBeClickable(elmOK)); 
     yield elmOK.click(); 

     expect(browser.getCurrentUrl()).toContain("place_content"); 
     yield ui.RADIOBOX_OTHER.click(); 
     yield ui.TEXTBOX_PLACE_DETAILS.sendKeys('TEST'); 
     yield ui.SUBMIT.click(); 
     expect(browser.getCurrentUrl()).toContain("submit"); 
     yield ui.waitSubmit(); 
     expect(yield element(By.css('div[ng-show="mapFeedBack.submitState==\'success\'"]')).isDisplayed()).toBeTruthy(); 
    })); 
}); 

何とか、私は自分のコードを実行したときに、私はこのエラーを取得し、私は方法がわかりませんそれを修正する。

1) MapFeedback: address-no longer exists test                                   
    Message:                                            
    Error: Timeout - Async callback was not invoked within the timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.                  
    Stack:                                            
    Error: Timeout - Async callback was not invoked within the timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.                  
     at tryOnTimeout (timers.js:224:11)                                    
     at Timer.listOnTimeout (timers.js:198:5)                                  

1 spec, 1 failure                                          
Finished in 30.831 seconds                                        
[15:18:24] I/launcher - 0 instance(s) of WebDriver still running                              
[15:18:24] I/launcher - chrome #01 failed 1 test(s)                                  
[15:18:24] I/launcher - overall: 1 failed spec(s)                                  
Closing report                                           
[15:18:24] E/launcher - Process exited with error code 1  

ui.zoomin()が完了した後でのみ、後のコードが実行されるようにする方法を教えてください。

答えて

0

あなたはときジャスミンタイムアウトの完全な実行が

を完了する前にいずれかのエラーを参照してください分度器conf.js

timeout: 50000, 

それとも、これだけのためにタイムアウトの変更を行いたい場合でタイムアウト設定を増加しますスペック

this.timeout(50000); 

とコードの後半はUI.zoomin()が完了した後にのみ実行されることを確実にするためには、それがいるかどうかに依存しますUI.zoomin()は、約束/コールバックを返します。そうであれば、後続のコマンドを連鎖する必要があります。

UI.zoomin()にwebdriverJsコマンドが含まれている場合、それらは自動的にWebdriverの制御フローに配置されます。

関連する問題