-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
[Bug]: mask
for toHaveScreenshot masking also not visible element
#34860
Comments
I agree this is surprising. I'll discuss with the team whether this is on purpose, but most likely we can't change this without a breaking change. To unblock yourself, try masking |
wow, this is a nice workaround |
You could |
it's impossible for us to identify if a semi-transparent overlay is visible or not. your best bet is to hide those semi-transparent elements, if you absolutely need to screenshot an element behind it. |
We discussed this issue yesterday, and concluded that we won't make any breaking changes to this API without a strong reasoning. One thing that came up though is that you might be better off using That would allow you to override styles for the elements you don't want to see, and for example set I'm assuming that your |
thank you for your efforts
I think it would be beneficial adding info about
yes. our use case - many (2K+) storybook tests.
With masking, we wanted to remove core/generic elements from non-related tests ( like 1 core element could exist on the majority of screenshots ) to not update many unrelated pages - faster, and less noise for related teams. So we mask elements conditionally before will check |
Version
1.50.0
Steps to reproduce
Expected behavior
hidden elements shouldn't be masked
Actual behavior
also hidden/not visible elements are being masked
Additional context
hidden but masked elements add unneeded noise to the image and/or make it unusable in image comparison
as an extra example - changing
mask
tomask: [page.locator("[aria-hidden=true]")]
makes thisEnvironment
System: OS: macOS 15.3 CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz Memory: 95.25 MB / 32.00 GB Binaries: Node: 22.12.0 - /usr/local/bin/node npm: 10.9.0 - /usr/local/bin/npm pnpm: 10.3.0 - /usr/local/bin/pnpm Languages: Bash: 3.2.57 - /bin/bash npmPackages: @playwright/test: 1.50.0 => 1.50.0
The text was updated successfully, but these errors were encountered: