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

Is there a way to use If statements in Nightwatch to control the test

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

布伦丹。 关于 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 尝试在回调中使用结果)