有没有办法在Nightwatch中使用If语句来控制testing

我有一个网站,我正在testing多个版本。 我有一些在新版本中显示不在旧版本的字段,反之亦然。 我想用相同的testing来testing每个版本。 有没有办法在testing中使用if语句? 我正在尝试使用.execute并设置一个布尔variables来确定该字段是否存在并继续一种或另一种方式,但我不能从execute()命令中获取该variables。

布伦丹。 关于if语句:

module.exports = { "City select present or not": function (browser) { if(info.citySelect) browser .url(enviroment.app) .waitForElementVisible('body', 1000) .click('span.firmsConstructorStep1__citySelectorButtonText') .verify.visible('div.firmsConstructorStep1__popup') .end(); else browser .url(enviroment.app) .waitForElementVisible('body', 1000) .click('span.firmsConstructorStep1__citySelectorButtonText') .verify.hidden('div.firmsConstructorStep1__popup') .end(); } }; 

而关于.execute尝试在callback中使用结果)