带chai的SoftAssertion(量角器黄瓜框架)

时间:2020-09-08 19:47:55

标签: javascript protractor mocha chai cucumberjs

@all:- 我已经创建了Cucumber + Protractor框架来测试基于Web的应用程序,但是由于遇到了一个问题,我无法继续进行下去。

*我正在使用chai作为断言库。

如果我的断言在任何步骤中失败,那么下一步将不会执行,并且我的框架会退出。请帮助我,让我知道如何处理这种情况或如何使用chai添加软断言。

.feature文件:-

Scenario: Verify abc journey
        Given Open the site "https://www.abc.in"
        Then Verify the site title "abc"
        Then user validates the captcha image

.js文件:-

Given(/^Open the site "([^"]*)"$/, async function (site) {   
   browser.get(site);
  
    await  config.waitElement(element(by.xpath("//span[text()='abc12']")),3000)   
  .catch(()=>expect(true).to.equal(false))  
  });
  
  Then(/^Verify the site title "([^"]*)"$/,{timeout: 2 * 5000}, async function (title) { 

      console.log(await browser.getTitle()+" and title is  " +title);    
   
  });

由于.catch(()=> expect(true).to.equal(false))断言,我的框架停止了,但是如果断言失败但我还希望执行下一步,我希望出现错误。 请帮助,如何使用柴应用软断言?

0 个答案:

没有答案