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

[Regression]: testInfo.attach() and testInfo.attachments.push() produce different reporter data #34389

Open
vitalets opened this issue Jan 18, 2025 · 3 comments

Comments

@vitalets
Copy link
Contributor

vitalets commented Jan 18, 2025

Last Good Version

1.49

First Bad Version

1.50

Steps to reproduce

Follow the steps in https://github.com/vitalets/playwright-issues/tree/testinfo-attachments-consistency.
Actually it uses test example from #34037, this test.

Expected behavior

I expect the behavior of testInfo.attach() and testInfo.attachments.push() is consistent: both produce equal reporter data structure.

Actual behavior

  • testInfo.attach() adds extra step attach "foo-attach"
  • testInfo.attachments.push() does not add extra step attach "foo-push", it stores attachment directly in step.attachments.

Additional context

I've read the discussion in #34037 but still not sure, is it expected behavior with new step.attachments field.
In Playwright 1.49 both methods of adding attachments behave equally.
Maybe it's worth highlighting the difference in the docs.

Environment

System:
    OS: macOS 14.7.2
    CPU: (10) arm64 Apple M1 Pro
    Memory: 79.66 MB / 16.00 GB
  Binaries:
    Node: 20.11.1 - ~/.nvm/versions/node/v20.11.1/bin/node
    npm: 10.2.4 - ~/.nvm/versions/node/v20.11.1/bin/npm
  Languages:
    Bash: 3.2.57 - /bin/bash
  npmPackages:
    @playwright/test: ^1.50.0-beta-1737179657000 => 1.50.0-beta-1737179657000
@Skn0tt
Copy link
Member

Skn0tt commented Jan 20, 2025

Yes, this change is intended. The docs already discourage pushing onto testInfo.attachments:

To add an attachment, use testInfo.attach() instead of directly pushing onto this array.
https://playwright.dev/docs/api/class-testinfo#test-info-attachments

@vitalets
Copy link
Contributor Author

Per the #34037 description I thought attach "foo" steps should dissapear.

the icon button goes from the removed attach "foo" step to their parent step

Is it correct that they disappear only for attachments.push()?

@Skn0tt
Copy link
Member

Skn0tt commented Jan 20, 2025

Yes, that was the intention.

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

No branches or pull requests

2 participants