-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[Feature]: Provide more reliable way to map attachments with steps #29323
Comments
We lack expressiveness of the API to reliably map attachments to steps. If steps run concurrently, we don't know which step to insert the attachment into without changing the step API and passing the attachment sink in it. test("my test", async () => {
await Promise.all([
test.step('step 1', async () => {
await test.info().attach('my attachment', { body: 'foo' });
});
test.step('step 2', async () => {
await test.info().attach('my attachment', { body: 'bar' });
});
]);
}); In the interim, you can compare attachments before and after the step to attribute them to the step from within onStepBegin/End. That's not perfect, but gives you a fairly good approximation. |
Fair enough, thanks for the idea! Btw, what is the purpose of steps with |
@pavelfeldman I've tried approach with mapping attachments in onStepBegin/End. It works fine with regular Playwright run, but breaks on merge-reports. When running merge-reports I've created a repro here: https://github.com/vitalets/playwright-issues/tree/attachment-step-map Do you have any suggestions how to bind attachments with steps in merge-reports run? |
Why was this issue closed?Thank you for your involvement. This issue was closed due to limited engagement (upvotes/activity), lack of recent activity, and insufficient actionability. To maintain a manageable database, we prioritize issues based on these factors. If you disagree with this closure, please open a new issue and reference this one. More support or clarity on its necessity may prompt a review. Your understanding and cooperation are appreciated. |
@pavelfeldman could you have a look on this question:
|
🚀 Feature Request
Provide more reliable way to map attachments with steps. It can be unique
attachmentId
field or some other approach.Please, see example below.
Motivation
This feature will give more opportunities to third-party reporters.
Personally I need this for implementing Cucumber reports in playwright-bdd. As in Cucumber each attachment is mapped to a particular step although in Playwright attachments are mapped to a whole test result.
Example
Imagine the following test:
When running this test I get in
onTestEnd
the following (Playwright version 1.41.2):result.attachments:
result.steps:
In my custom reporter I want to show that:
my attachment
with textfoo
belongs tostep 1
my attachment
with textbar
belongs tostep 2
Currently I don't see a reliable way to do that. I can try to match attachments names with
attach "xxx"
titles or play with startTimes.But it would be more reliable if we have a unique attachmentId field:
result.attachments:
result.steps:
Pitch
Reporter data is coming from the Playwright core and can't be implemented in a third-party module.
The text was updated successfully, but these errors were encountered: