priyect CucumberJS,Selenium和Assert Nodejs的问题

问题描述 投票:0回答:1

我希望有人可以帮助我,我在js类step_definitions.js中有以下代码:

 Then('Validacion de nombre de boton debe ser {string}',function(title) {
    var bton_login="/html/body/app-root/app-login/section/form/div/div[4]/button";
    var val_esperado="Iniciar Sesión";
    this.driver.findElement({xpath: bton_login}).getText().then(function (val_btn) {

      //console.log('valor de elemento boton: ',val_btn);

        assert.equal(val_btn, title)

    });



  });  

在控制台中执行时,会向我显示相应的验证

enter image description here

但是从日志中可以看到,在成功的案例中,黄瓜的执行消失了,所有步骤都通过了

node.js selenium-webdriver assert geckodriver cucumberjs
1个回答
0
投票

根据'https://www.npmjs.com/package/cucumber-assert'中的详细信息,我们需要在每个断言上使用'.then(callback)'。尝试使用这种方法并检查。

如果上述方法无法解决,请使用'chai'npm库进行此验证,例如:Expect(actualResult).to.equal(expectedResult,'Assertion message');

© www.soinside.com 2019 - 2024. All rights reserved.