0
我是量角器新手。 Intially建設我的代碼時,我用多了,但後來我在一個移動的一切它,現在我的代碼看起來是這樣的:量角器異步調用問題
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()完成後才能運行後面的代碼。