chore(screenshot): warn about visibility of masked elements (#34881)

This commit is contained in:
Simon Knott 2025-02-21 13:52:44 +01:00 committed by GitHub
parent e4ceac8e4c
commit 48fb536e12
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 19 additions and 9 deletions

View file

@ -1229,6 +1229,7 @@ Specify screenshot type, defaults to `png`.
Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with
a pink box `#FF00FF` (customized by [`option: maskColor`]) that completely covers its bounding box. a pink box `#FF00FF` (customized by [`option: maskColor`]) that completely covers its bounding box.
The mask is also applied to invisible elements, see [Matching only visible elements](../locators.md#matching-only-visible-elements) to disable that.
## screenshot-option-mask-color ## screenshot-option-mask-color
* since: v1.35 * since: v1.35

View file

@ -11751,7 +11751,8 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
* Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink * Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink
* box `#FF00FF` (customized by * box `#FF00FF` (customized by
* [`maskColor`](https://playwright.dev/docs/api/class-elementhandle#element-handle-screenshot-option-mask-color)) * [`maskColor`](https://playwright.dev/docs/api/class-elementhandle#element-handle-screenshot-option-mask-color))
* that completely covers its bounding box. * that completely covers its bounding box. The mask is also applied to invisible elements, see
* [Matching only visible elements](https://playwright.dev/docs/locators#matching-only-visible-elements) to disable that.
*/ */
mask?: Array<Locator>; mask?: Array<Locator>;
@ -22048,7 +22049,8 @@ export interface LocatorScreenshotOptions {
* Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink * Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink
* box `#FF00FF` (customized by * box `#FF00FF` (customized by
* [`maskColor`](https://playwright.dev/docs/api/class-locator#locator-screenshot-option-mask-color)) that completely * [`maskColor`](https://playwright.dev/docs/api/class-locator#locator-screenshot-option-mask-color)) that completely
* covers its bounding box. * covers its bounding box. The mask is also applied to invisible elements, see
* [Matching only visible elements](https://playwright.dev/docs/locators#matching-only-visible-elements) to disable that.
*/ */
mask?: Array<Locator>; mask?: Array<Locator>;
@ -22772,7 +22774,8 @@ export interface PageScreenshotOptions {
* Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink * Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink
* box `#FF00FF` (customized by * box `#FF00FF` (customized by
* [`maskColor`](https://playwright.dev/docs/api/class-page#page-screenshot-option-mask-color)) that completely covers * [`maskColor`](https://playwright.dev/docs/api/class-page#page-screenshot-option-mask-color)) that completely covers
* its bounding box. * its bounding box. The mask is also applied to invisible elements, see
* [Matching only visible elements](https://playwright.dev/docs/locators#matching-only-visible-elements) to disable that.
*/ */
mask?: Array<Locator>; mask?: Array<Locator>;

View file

@ -11751,7 +11751,8 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
* Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink * Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink
* box `#FF00FF` (customized by * box `#FF00FF` (customized by
* [`maskColor`](https://playwright.dev/docs/api/class-elementhandle#element-handle-screenshot-option-mask-color)) * [`maskColor`](https://playwright.dev/docs/api/class-elementhandle#element-handle-screenshot-option-mask-color))
* that completely covers its bounding box. * that completely covers its bounding box. The mask is also applied to invisible elements, see
* [Matching only visible elements](https://playwright.dev/docs/locators#matching-only-visible-elements) to disable that.
*/ */
mask?: Array<Locator>; mask?: Array<Locator>;
@ -22048,7 +22049,8 @@ export interface LocatorScreenshotOptions {
* Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink * Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink
* box `#FF00FF` (customized by * box `#FF00FF` (customized by
* [`maskColor`](https://playwright.dev/docs/api/class-locator#locator-screenshot-option-mask-color)) that completely * [`maskColor`](https://playwright.dev/docs/api/class-locator#locator-screenshot-option-mask-color)) that completely
* covers its bounding box. * covers its bounding box. The mask is also applied to invisible elements, see
* [Matching only visible elements](https://playwright.dev/docs/locators#matching-only-visible-elements) to disable that.
*/ */
mask?: Array<Locator>; mask?: Array<Locator>;
@ -22772,7 +22774,8 @@ export interface PageScreenshotOptions {
* Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink * Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink
* box `#FF00FF` (customized by * box `#FF00FF` (customized by
* [`maskColor`](https://playwright.dev/docs/api/class-page#page-screenshot-option-mask-color)) that completely covers * [`maskColor`](https://playwright.dev/docs/api/class-page#page-screenshot-option-mask-color)) that completely covers
* its bounding box. * its bounding box. The mask is also applied to invisible elements, see
* [Matching only visible elements](https://playwright.dev/docs/locators#matching-only-visible-elements) to disable that.
*/ */
mask?: Array<Locator>; mask?: Array<Locator>;

View file

@ -8514,7 +8514,8 @@ interface LocatorAssertions {
* Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink * Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink
* box `#FF00FF` (customized by * box `#FF00FF` (customized by
* [`maskColor`](https://playwright.dev/docs/api/class-locatorassertions#locator-assertions-to-have-screenshot-1-option-mask-color)) * [`maskColor`](https://playwright.dev/docs/api/class-locatorassertions#locator-assertions-to-have-screenshot-1-option-mask-color))
* that completely covers its bounding box. * that completely covers its bounding box. The mask is also applied to invisible elements, see
* [Matching only visible elements](https://playwright.dev/docs/locators#matching-only-visible-elements) to disable that.
*/ */
mask?: Array<Locator>; mask?: Array<Locator>;
@ -8606,7 +8607,8 @@ interface LocatorAssertions {
* Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink * Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink
* box `#FF00FF` (customized by * box `#FF00FF` (customized by
* [`maskColor`](https://playwright.dev/docs/api/class-locatorassertions#locator-assertions-to-have-screenshot-2-option-mask-color)) * [`maskColor`](https://playwright.dev/docs/api/class-locatorassertions#locator-assertions-to-have-screenshot-2-option-mask-color))
* that completely covers its bounding box. * that completely covers its bounding box. The mask is also applied to invisible elements, see
* [Matching only visible elements](https://playwright.dev/docs/locators#matching-only-visible-elements) to disable that.
*/ */
mask?: Array<Locator>; mask?: Array<Locator>;
@ -9768,7 +9770,8 @@ export interface PageAssertionsToHaveScreenshotOptions {
* Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink * Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink
* box `#FF00FF` (customized by * box `#FF00FF` (customized by
* [`maskColor`](https://playwright.dev/docs/api/class-pageassertions#page-assertions-to-have-screenshot-1-option-mask-color)) * [`maskColor`](https://playwright.dev/docs/api/class-pageassertions#page-assertions-to-have-screenshot-1-option-mask-color))
* that completely covers its bounding box. * that completely covers its bounding box. The mask is also applied to invisible elements, see
* [Matching only visible elements](https://playwright.dev/docs/locators#matching-only-visible-elements) to disable that.
*/ */
mask?: Array<Locator>; mask?: Array<Locator>;