multiple-cucumber-html-reporter
multiple-cucumber-html-reporter copied to clipboard
Failed `Before` hook not present in report
Environment (please complete the following information)
- multiple-cucumber-html-reporter: 3.6.2
- Node.js version: 20.15.1
- NPM version: yarn v4.3.0
- Cucumber version: 10.8.0
Config of multiple-cucumber-html-reporter
import { type Options } from 'multiple-cucumber-html-reporter';
function createGenerateOptions(inputDirectory: string): Options {
return {
displayDuration: true,
displayReportTime: true,
jsonDir: inputDirectory,
reportPath: `${inputDirectory}report/`,
pageTitle: 'UI/E2E Test Report',
customData: {
title: 'Run Configuration',
data: [
{ label: 'Version', value: process.env.PACKAGE_VERSION },
{ label: 'Branch', value: process.env.CI_COMMIT_REF_SLUG },
{ label: 'Date (UTC)', value: new Date().toISOString() },
],
},
};
}
Describe the bug
When having a Before hook in the .json input file the reporter does not add it to the report even if it has failed. However the After hook is present in the report.
To Reproduce
Use following .json output from the cucumber tests as input for the reporter
[
{
"description": "",
"elements": [
{
"description": "",
"id": "some test id",
"keyword": "Szenario",
"line": 9,
"name": "TC-WEB-ST-01-1: some name",
"steps": [
{
"keyword": "Before",
"hidden": true,
"result": {
"status": "failed",
"duration": 476208,
"error_message": "Error: provoke failure\n at someFile.<anonymous> (file:///Users/xxx/someScript.mjs:1:23)"
}
},
{
"keyword": "Before",
"hidden": true,
"result": {
"status": "skipped",
"duration": 0
}
},
{
"keyword": "Before",
"hidden": true,
"result": {
"status": "skipped",
"duration": 0
}
},
{
"keyword": "Before",
"hidden": true,
"result": {
"status": "skipped",
"duration": 0
}
},
{
"arguments": [],
"keyword": "Angenommen ",
"line": 11,
"name": "something happened",
"match": {
"location": "file:/Users/xxx/someScript.mjs:2:34"
},
"result": {
"status": "skipped",
"duration": 0
}
},
{
"keyword": "After",
"hidden": true,
"result": {
"status": "passed",
"duration": 39500
}
},
{
"keyword": "After",
"hidden": true,
"result": {
"status": "passed",
"duration": 622582
}
},
{
"keyword": "After",
"hidden": true,
"result": {
"status": "passed",
"duration": 190041
},
"embeddings": [
{
"data": "Tm90aGluZyB0byBjbGVhbnVw",
"mime_type": "text/plain"
}
]
},
{
"keyword": "After",
"hidden": true,
"result": {
"status": "passed",
"duration": 64624
}
},
{
"keyword": "After",
"hidden": true,
"result": {
"status": "failed",
"duration": 228791,
"error_message": "Error: some-error (file:///Users/xxx/someScript.mjs:12:34)\n at someScript2.mjs (file:///Users/xxx/someScript.mjs:12:34)"
},
"embeddings": [
{
"data": "",
"mime_type": "text/plain"
},
{
"data": "",
"mime_type": "text/plain"
}
]
}
],
"tags": [
{
"name": "@E2E",
"line": 5
},
],
"type": "scenario"
}
],
"id": "some test id",
"line": 7,
"keyword": "Funktionalität",
"name": "TC-WEB-ST-01: some name",
"tags": [
{
"name": "@E2E",
"line": 5
}
],
"uri": "features/e2e/some.feature"
}
]
Expected behavior
The failed Before hook should be present in the report.
I don't have Failed hook at all, Before or After are not include in the report. Is it Failed or Passed hook it is the same.
@Llois41 , @Duez-Yoan ,
Can you share a sample project GitHub link so I can take a look at this issue?
@WasiqB the given JSON is what the latest version of cucumber printed out (shortened and anonymized). What would you need more?
Thanks for having a look into it.
Ok, I will check and work on this issue soon.
Hi @WasiqB , here is the link of the branch of my project : https://github.com/Duez-Yoan/cucumberJs/tree/driverManager
I added some before OK and After OK and KO. None of them is visible in the report.
Maybe i forgot some configuration or anything else.
Thanks a lot in advance :)
Thanks for sharing the sample project. I will look into this issue soon.