I would like to print the status of each cucumber scenario using the afterScenario hook.
I've tried printing out scenario.status (code below) but it prints out "undefined"
afterScenario: (scenario) => {
console.log(scenario.status);
}
When printing out just scenario, I don't see status.
Scenario {
feature:
Feature {
description: undefined,
keyword: 'Feature',
line: 1,
name: 'Sample Test',
tags: [],
uri: '/Users/Daredevil/e2e/features/sampleProject/intro.feature',
scenarios: [ [Circular] ] },
keyword: 'Scenario',
lines: [ 15, 7 ],
name: 'Getting test status',
tags:
[ Tag { line: 6, name: '@WIP' }],
uri: '/Users/Daredevil/e2e/features/sampleProject/intro.feature',
line: 15,
description: undefined,
steps:
[ Step {
arguments: [],
line: 4,
name: 'I am on the app',
scenario: [Circular],
uri: '/Users/Daredevil/e2e/features/sampleProject/intro.feature',
isBackground: true,
keyword: 'Given ',
keywordType: 'precondition' },
Step {
arguments: [],
line: 8,
name: 'I am viewing the splash screen',
scenario: [Circular],
uri: '/Users/Daredevil/e2e/features/sampleProject/intro.feature',
isBackground: false,
keyword: 'Given ',
keywordType: 'precondition' } ] }
I had a read through https://docs.cucumber.io/cucumber/api/#hooks which suggested (from my understanding) to do scenario.failed, but I still get undefined. Would anyone be able to tell me how I can get the status of a scenario?
I am using cucumber v3.2.1 and wdio-cucumber-framework v1.0.3.