有没有办法确保it
在位于其下面的if
条件之前先执行?量角器IF条件在IT之前首先执行
示例代码:
it('should click ' + strName + ' from the list', function() {
exports.waitForElementDisp(10, global.elmGravityPanel, false);
browser.sleep(2000).then(function() {
element(by.css('[cellvalue="' + strName + '"]')).click();
element(by.id('uniqueid')).getText().then(function(tmpText) {
global.tempObject.isPresent = false;
if (tmpText == strName) {
global.tempObject.isPresent = true;
}
});
});
});
if (global.tempObject.isPresent == true) {
it('should click the settings icon', function() {
global.elmSettingBtn.click();
});
it...
}
目前,global.tempObject.isPresent被设置为null,量角器IF内没有去,即使它会被设置在第一IT内部为真。
包住如果条件的browser.call内()... HTTP://www.protractortest.org/#/api查看= webdriver.WebDriver.prototype.call – Grasshopper
那控制流问题 – Gunderson
@Grasshopper你的意思是,browser.call(if(condition){...})? –