allure-framework / allure-js

Allure integrations for JavaScript test frameworks
https://allurereport.org/
Apache License 2.0
224 stars 119 forks source link

Playwright BDD +Allure - Failure message is displaying appended with some text #738

Closed varshanharshank closed 1 month ago

varshanharshank commented 1 year ago

Describe the bug In the allure report, failure message is not displaying properly. It is showing as below

image

In the terminal it is showing properly (Ran the following command via terminal "npx cucumber-js test --tags '@smoke"

image

To Reproduce Steps to reproduce the behavior: 1.Create Playwright with BDD project

  1. In cucumber.json file, just mention the allureReport.ts file path
  2. Run the following command npx cucumber-js test --tags '@smoke
  3. Run the following command for generate allure report npx allure generate allure-results --clean -o allure-report && npx allure open allure-report
  4. Observe the report

Expected behavior Error text should be displayed properly without appending any additional text and it should be readable

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information): OS: [macbook pro, ventura 13.5 ] Browser [chrome,edge,webkit]

Smartphone (please complete the following information):

Additional context //package.json


{
  "name": "Automation",
  "version": "1.0.0",
  "description": "Automation",
  "main": "index.js",
  "scripts": {
    "pretest": "rm -rf reports && rm -rf allure-results",
    "test": "npx cucumber-js test --tags '@smoke'",
    "report": "npx ts-node src/helper/report/cucumberReport.ts",
    "allure": "npx allure generate reports/allure-results --clean -o reports/allure-report && npx allure open reports/allure-report",
    "lint": "node_modules/.bin/eslint . --ext .ts"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@cucumber/cucumber": "^9.3.0",
    "@playwright/test": "1.36.2",
    "@typescript-eslint/eslint-plugin": "^6.2.0",
    "@typescript-eslint/parser": "^6.2.0",
    "allure-commandline": "^2.23.1",
    "allure-cucumberjs": "^2.4.0",
    "allure-js-commons": "^2.4.0",
    "eslint": "^8.46.0",
    "moment": "^2.29.4",
    "multiple-cucumber-html-reporter": "^3.4.0",
    "prettier": "^3.0.0",
    "ts-node": "^10.9.1",
    "typescript": "^5.1.6"
  },
  "dependencies": {
    "fs-extra": "^11.1.1"
  }
}```

//allureReport.ts
import { AllureRuntime, CucumberJSAllureFormatter } from 'allure-cucumberjs'

function Reporter(options: any) {
  return new CucumberJSAllureFormatter(
    options,
    new AllureRuntime({ resultsDir: 'reports/allure-results' }),
    {
      labels: [
        {
          name: 'epic',
          pattern: [/@feature:(.*)/],
        },
        {
          name: 'severity',
          pattern: [/@severity:(.*)/],
        },
      ],
      links: [
        {
          type: 'issue',
          pattern: [/@issue=(.*)/],
          urlTemplate: 'http://localhost:8080/issue/%s',
        },
        {
          type: 'tms',
          pattern: [/@tms=(.*)/],
          urlTemplate: 'http://localhost:8080/tms/%s',
        },
      ],
    }
  )
}

Reporter.prototype = Object.create(CucumberJSAllureFormatter.prototype)
Reporter.prototype.constructor = Reporter

exports.default = Reporter

//cucumber.json

{
  "default": {
    "paths": ["src/test/features"],
    "require": ["src/test/stepDefinitions/*.ts", "src/hooks/hooks.ts"],
    "requireModule": ["ts-node/register"],
    "publishQuiet": true,
    "format": [
      "progress-bar",
      "./src/helper/report/allureReport.ts:./output.txt",
      "html:reports/cucumberReport/cucumber-report.html",
      "json:reports/cucumberReport/cucumber-report.json"
    ],
    "parallel": 1
  }
}
varshanharshank commented 7 months ago

any update about this issue? Still this issue is persisting

epszaw commented 7 months ago

Hey there! Will check the issue as soon as possible!

varshanharshank commented 5 months ago

@epszaw any update about this issue

varshanharshank commented 5 months ago

@epszaw it is very hard to read out the failures.

varshanharshank commented 1 month ago

@epszaw is this issue fixed or not?

baev commented 1 month ago

It is fixed in 3.0.0-beta.7, give it a try