cucumber / cucumber-js

Cucumber for JavaScript
https://cucumber.io
MIT License
5.06k stars 1.09k forks source link

isFailed() method doesn't working #1057

Closed ezwanharun closed 6 years ago

ezwanharun commented 6 years ago

cucumber version :4.0.0 `
afterScenario: function afterScenario(scenarioResult) { if (scenarioResult.status != "passed") { browser.saveScreenshot("./allure-results/"); } }

`

also tried with

`

afterScenario: function afterScenario(scenarioResult) {
    if (scenarioResult.isFailed()) {
        browser.saveScreenshot("./allure-results/");
    }
},

`

I noticed that that if condition can't been executed at all. I tried with afterStep() method, it work as expected. However, i don't want to screenshot in steps level.

charlierudolph commented 6 years ago

scenarioResult and isFailed are old APIs. Please see here for the v4 docs about attachments in hooks for failed scenarios.

AfterStep is not something built into cucumber. Are you using another program to execute cucumber?

ezwanharun commented 6 years ago

yeah. i tried to used testCase.result.status === Status.FAILED method. It doesnt execute that specific method at all. Think that this is due to other dependencies that I used wdio-cucumber-frameowrk

ezwanharun commented 6 years ago

l just raised in wdio-cucumber-framework repo.Think can close this ticket as it been raised in wrong repo. https://github.com/webdriverio/wdio-cucumber-framework/issues/108

lock[bot] commented 5 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.