allure-framework / allure-js

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

Playwright+BDD+Allure - Feature name is not showing in the report instead it is showing scenario name #739

Closed varshanharshank closed 6 months ago

varshanharshank commented 1 year ago

Describe the bug I could generate the allure report but feature name is missing, Instead, it is showing scenario name.

image

In the report (Feature name is missing and it is showing scenario name)

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 Feature name should be displayed in the top. But scenario name is displaying

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

Device: [e.g. iPhone6] OS: [e.g. iOS8.1] Browser [e.g. stock browser, safari] Version [e.g. 22] 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" ] } }

varshanharshank commented 8 months ago

any update about this isse

varshanharshank commented 7 months ago

@epszaw unable to see the feature name in the allure report.

//allureReport.ts

/ eslint-disable @typescript-eslint/no-explicit-any / 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

//package.json

{ "name": "rotuer", "version": "1.0.0", "description": "automation", "main": "index.js", "scripts": { "pretest": "rm -rf reports && rm -rf allure-results && rm -rf output", "test": "npx cucumber-js test --tags '@smoke' || true", "cucumberReport": "npx ts-node src/helper/report/cucumberReport.ts", "allureReport": "npx allure generate reports/allure-results --clean -o reports/allure-report && npx allure open reports/allure-report", "posttest": "npx allure generate reports/allure-results --clean -o reports/allure-report && npx allure open reports/allure-report && python3 -m http.server", "lint": "node_modules/.bin/eslint . --ext .ts" }, "author": "", "license": "ISC", "devDependencies": { "@cucumber/cucumber": "^9.3.0", "@playwright/test": "1.41.1", "@types/ssh2": "^1.11.13", "@typescript-eslint/eslint-plugin": "^6.2.0", "@typescript-eslint/parser": "^6.2.0", "allure-commandline": "^2.27.0", "allure-cucumberjs": "^2.14.0", "allure-js-commons": "^2.14.0", "allure-playwright": "^2.14.0", "eslint": "^8.46.0", "fs-extra": "^11.1.1", "fs.promises": "^0.1.2", "moment": "^2.29.4", "multiple-cucumber-html-reporter": "^3.6.0", "prettier": "^3.0.0", "ssh2": "^1.14.0", "ts-node": "^10.9.1", "typescript": "^5.1.6", "http-server": "^14.1.1", "axios": "^1.6.2", "https": "^1.0.0" } }

In the allure report, shows showing scenario name as the feature name

image

feature file

image
varshanharshank commented 7 months ago

@baev This is the major issue. please look into this issue

varshanharshank commented 6 months ago

@epszaw could you please check this issue? I think this is a major issue for seeing cucumber reports. Feature name should show but it is showing scenario name.

varshanharshank commented 6 months ago

i am closing this issue, i could see the feature name and test cases under Behaviors section

ajosephv commented 6 months ago

Hi @varshanharshank @baev @epszaw I am also facing the same issue. The feature names with scenarios are available under Behaviors section but not able to view feature name under Suite section

One more important thing here is. if I run 4 Testcases, it is showing as 4 suites in the Overview Section instead of 1 suite with 4 testcases, Is there a way to correct this issue, Please advise .

Attaching screenshot for your reference.

image