-
Notifications
You must be signed in to change notification settings - Fork 129
Description
Describe the bug
In the repro project (branch attachment-with-trace-type), when using @cucumber/cucumber + allure-cucumberjs/reporter + allure-js-commons, a Playwright trace (zip) attached with content type application/vnd.allure.playwright-trace via attachment()/attachmentPath() is not referenced in the generated allure-results/*-result.json when the attach call is executed in a Cucumber After hook.
The same trace attachment becomes referenced in *-result.json when the attach is executed from AfterStep (e.g. on FAILED step).
Repro repository/branch: https://github.com/bionikokex/allure/tree/attachment-with-trace-type
To Reproduce
Steps to reproduce the behavior:
- Clone repo and checkout branch:
git clone https://github.com/bionikokex/allure.git
cd allure && git checkout attachment-with-trace-type- Install dependencies:
node 24+
yarn install- Run the tagged scenario:
yarn cucumber-js --tags @attach- Observe the results:
- Attachment file(s) may appear in
allure-results(e.g.*-attachment.zip), but allure-results/*-result.jsoncontains"attachments": []for the test and steps when the trace attachment is added inAfter.
- Switch hooks to the
AfterStepimplementation (attach on failed step) and rerun:
- Now
allure-results/*-result.jsonincludes the attachment reference (typically under a nested step like"steps" -> "steps" -> "attachments").
Expected behavior
When calling attachment() / attachmentPath() with content type application/vnd.allure.playwright-trace inside a Cucumber After hook, the attachment should be referenced in *-result.json (either at the test level or as an after-fixture/after-step entity), similarly to how it works from AfterStep.
Desktop (please complete the following information)
- OS: Windows 11
- Node.js: v24.4.1
- @cucumber/cucumber: 12.4.0
- allure-cucumberjs: 3.4.3
- allure-js-commons: 3.4.3
- playwright: 1.56.1
Additional context
- The trace zip is generated correctly by Playwright (
context.tracing.stop({ path })), so the issue seems to be about how the Allure runtime binds attachments to the current test/step context in Cucumber lifecycle hooks. - The issue is specific to the trace mime type
application/vnd.allure.playwright-traceand theAfterhook;AfterStepworks.