Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed Before hook not present in report #359

Open
Llois41 opened this issue Jul 22, 2024 · 6 comments
Open

Failed Before hook not present in report #359

Llois41 opened this issue Jul 22, 2024 · 6 comments

Comments

@Llois41
Copy link

Llois41 commented Jul 22, 2024

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.

@Duez-Yoan
Copy link

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.

@WasiqB
Copy link
Owner

WasiqB commented Aug 5, 2024

@Llois41 , @Duez-Yoan ,

Can you share a sample project GitHub link so I can take a look at this issue?

@Llois41
Copy link
Author

Llois41 commented Aug 5, 2024

@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.

@WasiqB
Copy link
Owner

WasiqB commented Aug 5, 2024

Ok, I will check and work on this issue soon.

@Duez-Yoan
Copy link

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 :)

@WasiqB
Copy link
Owner

WasiqB commented Aug 6, 2024

Thanks for sharing the sample project. I will look into this issue soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants