Skip to content

Commit

Permalink
chore(screenshot): warn about visibility of masked elements (#34881)
Browse files Browse the repository at this point in the history
  • Loading branch information
Skn0tt authored Feb 21, 2025
1 parent e4ceac8 commit 48fb536
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
1 change: 1 addition & 0 deletions docs/src/api/params.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
* since: v1.35
Expand Down
9 changes: 6 additions & 3 deletions packages/playwright-client/types/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
* box `#FF00FF` (customized by
* [`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>;

Expand Down Expand Up @@ -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
* box `#FF00FF` (customized by
* [`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>;

Expand Down Expand Up @@ -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
* box `#FF00FF` (customized by
* [`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>;

Expand Down
9 changes: 6 additions & 3 deletions packages/playwright-core/types/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
* box `#FF00FF` (customized by
* [`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>;

Expand Down Expand Up @@ -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
* box `#FF00FF` (customized by
* [`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>;

Expand Down Expand Up @@ -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
* box `#FF00FF` (customized by
* [`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>;

Expand Down
9 changes: 6 additions & 3 deletions packages/playwright/types/test.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
* box `#FF00FF` (customized by
* [`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>;

Expand Down Expand Up @@ -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
* box `#FF00FF` (customized by
* [`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>;

Expand Down Expand Up @@ -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
* box `#FF00FF` (customized by
* [`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>;

Expand Down

0 comments on commit 48fb536

Please sign in to comment.