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

cherry-pick(#14200): chore: fix wrong toHaveScreenshot defaults in docs #14201

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions docs/src/api/class-locatorassertions.md
Expand Up @@ -1022,11 +1022,12 @@ await expect(locator).toHaveScreenshot('image.png');
Snapshot name.

### option: LocatorAssertions.toHaveScreenshot#1.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.toHaveScreenshot#1.animations = %%-screenshot-option-animations-%%
### option: LocatorAssertions.toHaveScreenshot#1.animations = %%-screenshot-option-animations-default-disabled-%%

### option: LocatorAssertions.toHaveScreenshot#1.caret = %%-screenshot-option-caret-%%
### option: LocatorAssertions.toHaveScreenshot#1.mask = %%-screenshot-option-mask-%%
### option: LocatorAssertions.toHaveScreenshot#1.omitBackground = %%-screenshot-option-omit-background-%%
### option: LocatorAssertions.toHaveScreenshot#1.scale = %%-screenshot-option-scale-%%
### option: LocatorAssertions.toHaveScreenshot#1.scale = %%-screenshot-option-scale-default-css-%%
### option: LocatorAssertions.toHaveScreenshot#1.maxDiffPixels = %%-assertions-max-diff-pixels-%%
### option: LocatorAssertions.toHaveScreenshot#1.maxDiffPixelRatio = %%-assertions-max-diff-pixel-ratio-%%
### option: LocatorAssertions.toHaveScreenshot#1.threshold = %%-assertions-threshold-%%
Expand All @@ -1046,11 +1047,12 @@ await expect(locator).toHaveScreenshot();
```

### option: LocatorAssertions.toHaveScreenshot#2.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.toHaveScreenshot#2.animations = %%-screenshot-option-animations-%%
### option: LocatorAssertions.toHaveScreenshot#2.animations = %%-screenshot-option-animations-default-disabled-%%

### option: LocatorAssertions.toHaveScreenshot#2.caret = %%-screenshot-option-caret-%%
### option: LocatorAssertions.toHaveScreenshot#2.mask = %%-screenshot-option-mask-%%
### option: LocatorAssertions.toHaveScreenshot#2.omitBackground = %%-screenshot-option-omit-background-%%
### option: LocatorAssertions.toHaveScreenshot#2.scale = %%-screenshot-option-scale-%%
### option: LocatorAssertions.toHaveScreenshot#2.scale = %%-screenshot-option-scale-default-css-%%
### option: LocatorAssertions.toHaveScreenshot#2.maxDiffPixels = %%-assertions-max-diff-pixels-%%
### option: LocatorAssertions.toHaveScreenshot#2.maxDiffPixelRatio = %%-assertions-max-diff-pixel-ratio-%%
### option: LocatorAssertions.toHaveScreenshot#2.threshold = %%-assertions-threshold-%%
Expand Down
8 changes: 4 additions & 4 deletions docs/src/api/class-pageassertions.md
Expand Up @@ -133,13 +133,13 @@ await expect(page).toHaveScreenshot('image.png');
Snapshot name.

### option: PageAssertions.toHaveScreenshot#1.timeout = %%-js-assertions-timeout-%%
### option: PageAssertions.toHaveScreenshot#1.animations = %%-screenshot-option-animations-%%
### option: PageAssertions.toHaveScreenshot#1.animations = %%-screenshot-option-animations-default-disabled-%%
### option: PageAssertions.toHaveScreenshot#1.caret = %%-screenshot-option-caret-%%
### option: PageAssertions.toHaveScreenshot#1.clip = %%-screenshot-option-clip-%%
### option: PageAssertions.toHaveScreenshot#1.fullPage = %%-screenshot-option-full-page-%%
### option: PageAssertions.toHaveScreenshot#1.mask = %%-screenshot-option-mask-%%
### option: PageAssertions.toHaveScreenshot#1.omitBackground = %%-screenshot-option-omit-background-%%
### option: PageAssertions.toHaveScreenshot#1.scale = %%-screenshot-option-scale-%%
### option: PageAssertions.toHaveScreenshot#1.scale = %%-screenshot-option-scale-default-css-%%
### option: PageAssertions.toHaveScreenshot#1.maxDiffPixels = %%-assertions-max-diff-pixels-%%
### option: PageAssertions.toHaveScreenshot#1.maxDiffPixelRatio = %%-assertions-max-diff-pixel-ratio-%%
### option: PageAssertions.toHaveScreenshot#1.threshold = %%-assertions-threshold-%%
Expand All @@ -159,13 +159,13 @@ await expect(page).toHaveScreenshot();
```

### option: PageAssertions.toHaveScreenshot#2.timeout = %%-js-assertions-timeout-%%
### option: PageAssertions.toHaveScreenshot#2.animations = %%-screenshot-option-animations-%%
### option: PageAssertions.toHaveScreenshot#2.animations = %%-screenshot-option-animations-default-disabled-%%
### option: PageAssertions.toHaveScreenshot#2.caret = %%-screenshot-option-caret-%%
### option: PageAssertions.toHaveScreenshot#2.clip = %%-screenshot-option-clip-%%
### option: PageAssertions.toHaveScreenshot#2.fullPage = %%-screenshot-option-full-page-%%
### option: PageAssertions.toHaveScreenshot#2.mask = %%-screenshot-option-mask-%%
### option: PageAssertions.toHaveScreenshot#2.omitBackground = %%-screenshot-option-omit-background-%%
### option: PageAssertions.toHaveScreenshot#2.scale = %%-screenshot-option-scale-%%
### option: PageAssertions.toHaveScreenshot#2.scale = %%-screenshot-option-scale-default-css-%%
### option: PageAssertions.toHaveScreenshot#2.maxDiffPixels = %%-assertions-max-diff-pixels-%%
### option: PageAssertions.toHaveScreenshot#2.maxDiffPixelRatio = %%-assertions-max-diff-pixel-ratio-%%
### option: PageAssertions.toHaveScreenshot#2.threshold = %%-assertions-threshold-%%
Expand Down
20 changes: 19 additions & 1 deletion docs/src/api/params.md
Expand Up @@ -910,6 +910,15 @@ When set to `"disabled"`, stops CSS animations, CSS transitions and Web Animatio

Defaults to `"allow"` that leaves animations untouched.

## screenshot-option-animations-default-disabled
- `animations` <[ScreenshotAnimations]<"disabled"|"allow">>

When set to `"disabled"`, stops CSS animations, CSS transitions and Web Animations. Animations get different treatment depending on their duration:
* finite animations are fast-forwarded to completion, so they'll fire `transitionend` event.
* infinite animations are canceled to initial state, and then played over after the screenshot.

Defaults to `"disabled"` that disables animations.

## screenshot-option-omit-background
- `omitBackground` <[boolean]>

Expand Down Expand Up @@ -957,7 +966,16 @@ An object which specifies clipping of the resulting image. Should have the follo
## screenshot-option-scale
- `scale` <[ScreenshotScale]<"css"|"device">>

When set to `"css"`, screenshot will have a single pixel per each css pixel on the page. For high-dpi devices, this will keep screenshots small. Using `"device"` option will produce a single pixel per each device pixel, so screenhots of high-dpi devices will be twice as large or even larger. Defaults to `"device"`.
When set to `"css"`, screenshot will have a single pixel per each css pixel on the page. For high-dpi devices, this will keep screenshots small. Using `"device"` option will produce a single pixel per each device pixel, so screenhots of high-dpi devices will be twice as large or even larger.

Defaults to `"device"`.

## screenshot-option-scale-default-css
- `scale` <[ScreenshotScale]<"css"|"device">>

When set to `"css"`, screenshot will have a single pixel per each css pixel on the page. For high-dpi devices, this will keep screenshots small. Using `"device"` option will produce a single pixel per each device pixel, so screenhots of high-dpi devices will be twice as large or even larger.

Defaults to `"css"`.

## screenshot-option-caret
- `caret` <[ScreenshotCaret]<"hide"|"initial">>
Expand Down
12 changes: 9 additions & 3 deletions packages/playwright-core/types/types.d.ts
Expand Up @@ -8202,7 +8202,9 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
/**
* When set to `"css"`, screenshot will have a single pixel per each css pixel on the page. For high-dpi devices, this will
* keep screenshots small. Using `"device"` option will produce a single pixel per each device pixel, so screenhots of
* high-dpi devices will be twice as large or even larger. Defaults to `"device"`.
* high-dpi devices will be twice as large or even larger.
*
* Defaults to `"device"`.
*/
scale?: "css"|"device";

Expand Down Expand Up @@ -15844,7 +15846,9 @@ export interface LocatorScreenshotOptions {
/**
* When set to `"css"`, screenshot will have a single pixel per each css pixel on the page. For high-dpi devices, this will
* keep screenshots small. Using `"device"` option will produce a single pixel per each device pixel, so screenhots of
* high-dpi devices will be twice as large or even larger. Defaults to `"device"`.
* high-dpi devices will be twice as large or even larger.
*
* Defaults to `"device"`.
*/
scale?: "css"|"device";

Expand Down Expand Up @@ -16027,7 +16031,9 @@ export interface PageScreenshotOptions {
/**
* When set to `"css"`, screenshot will have a single pixel per each css pixel on the page. For high-dpi devices, this will
* keep screenshots small. Using `"device"` option will produce a single pixel per each device pixel, so screenhots of
* high-dpi devices will be twice as large or even larger. Defaults to `"device"`.
* high-dpi devices will be twice as large or even larger.
*
* Defaults to `"device"`.
*/
scale?: "css"|"device";

Expand Down
24 changes: 16 additions & 8 deletions packages/playwright-test/types/test.d.ts
Expand Up @@ -3349,7 +3349,7 @@ interface LocatorAssertions {
* - finite animations are fast-forwarded to completion, so they'll fire `transitionend` event.
* - infinite animations are canceled to initial state, and then played over after the screenshot.
*
* Defaults to `"allow"` that leaves animations untouched.
* Defaults to `"disabled"` that disables animations.
*/
animations?: "disabled"|"allow";

Expand Down Expand Up @@ -3386,7 +3386,9 @@ interface LocatorAssertions {
/**
* When set to `"css"`, screenshot will have a single pixel per each css pixel on the page. For high-dpi devices, this will
* keep screenshots small. Using `"device"` option will produce a single pixel per each device pixel, so screenhots of
* high-dpi devices will be twice as large or even larger. Defaults to `"device"`.
* high-dpi devices will be twice as large or even larger.
*
* Defaults to `"css"`.
*/
scale?: "css"|"device";

Expand Down Expand Up @@ -3424,7 +3426,7 @@ interface LocatorAssertions {
* - finite animations are fast-forwarded to completion, so they'll fire `transitionend` event.
* - infinite animations are canceled to initial state, and then played over after the screenshot.
*
* Defaults to `"allow"` that leaves animations untouched.
* Defaults to `"disabled"` that disables animations.
*/
animations?: "disabled"|"allow";

Expand Down Expand Up @@ -3461,7 +3463,9 @@ interface LocatorAssertions {
/**
* When set to `"css"`, screenshot will have a single pixel per each css pixel on the page. For high-dpi devices, this will
* keep screenshots small. Using `"device"` option will produce a single pixel per each device pixel, so screenhots of
* high-dpi devices will be twice as large or even larger. Defaults to `"device"`.
* high-dpi devices will be twice as large or even larger.
*
* Defaults to `"css"`.
*/
scale?: "css"|"device";

Expand Down Expand Up @@ -3578,7 +3582,7 @@ interface PageAssertions {
* - finite animations are fast-forwarded to completion, so they'll fire `transitionend` event.
* - infinite animations are canceled to initial state, and then played over after the screenshot.
*
* Defaults to `"allow"` that leaves animations untouched.
* Defaults to `"disabled"` that disables animations.
*/
animations?: "disabled"|"allow";

Expand Down Expand Up @@ -3646,7 +3650,9 @@ interface PageAssertions {
/**
* When set to `"css"`, screenshot will have a single pixel per each css pixel on the page. For high-dpi devices, this will
* keep screenshots small. Using `"device"` option will produce a single pixel per each device pixel, so screenhots of
* high-dpi devices will be twice as large or even larger. Defaults to `"device"`.
* high-dpi devices will be twice as large or even larger.
*
* Defaults to `"css"`.
*/
scale?: "css"|"device";

Expand Down Expand Up @@ -3683,7 +3689,7 @@ interface PageAssertions {
* - finite animations are fast-forwarded to completion, so they'll fire `transitionend` event.
* - infinite animations are canceled to initial state, and then played over after the screenshot.
*
* Defaults to `"allow"` that leaves animations untouched.
* Defaults to `"disabled"` that disables animations.
*/
animations?: "disabled"|"allow";

Expand Down Expand Up @@ -3751,7 +3757,9 @@ interface PageAssertions {
/**
* When set to `"css"`, screenshot will have a single pixel per each css pixel on the page. For high-dpi devices, this will
* keep screenshots small. Using `"device"` option will produce a single pixel per each device pixel, so screenhots of
* high-dpi devices will be twice as large or even larger. Defaults to `"device"`.
* high-dpi devices will be twice as large or even larger.
*
* Defaults to `"css"`.
*/
scale?: "css"|"device";

Expand Down
36 changes: 25 additions & 11 deletions tests/config/experimental.d.ts
Expand Up @@ -8204,7 +8204,9 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
/**
* When set to `"css"`, screenshot will have a single pixel per each css pixel on the page. For high-dpi devices, this will
* keep screenshots small. Using `"device"` option will produce a single pixel per each device pixel, so screenhots of
* high-dpi devices will be twice as large or even larger. Defaults to `"device"`.
* high-dpi devices will be twice as large or even larger.
*
* Defaults to `"device"`.
*/
scale?: "css"|"device";

Expand Down Expand Up @@ -15846,7 +15848,9 @@ export interface LocatorScreenshotOptions {
/**
* When set to `"css"`, screenshot will have a single pixel per each css pixel on the page. For high-dpi devices, this will
* keep screenshots small. Using `"device"` option will produce a single pixel per each device pixel, so screenhots of
* high-dpi devices will be twice as large or even larger. Defaults to `"device"`.
* high-dpi devices will be twice as large or even larger.
*
* Defaults to `"device"`.
*/
scale?: "css"|"device";

Expand Down Expand Up @@ -16029,7 +16033,9 @@ export interface PageScreenshotOptions {
/**
* When set to `"css"`, screenshot will have a single pixel per each css pixel on the page. For high-dpi devices, this will
* keep screenshots small. Using `"device"` option will produce a single pixel per each device pixel, so screenhots of
* high-dpi devices will be twice as large or even larger. Defaults to `"device"`.
* high-dpi devices will be twice as large or even larger.
*
* Defaults to `"device"`.
*/
scale?: "css"|"device";

Expand Down Expand Up @@ -19555,7 +19561,7 @@ interface LocatorAssertions {
* - finite animations are fast-forwarded to completion, so they'll fire `transitionend` event.
* - infinite animations are canceled to initial state, and then played over after the screenshot.
*
* Defaults to `"allow"` that leaves animations untouched.
* Defaults to `"disabled"` that disables animations.
*/
animations?: "disabled"|"allow";

Expand Down Expand Up @@ -19592,7 +19598,9 @@ interface LocatorAssertions {
/**
* When set to `"css"`, screenshot will have a single pixel per each css pixel on the page. For high-dpi devices, this will
* keep screenshots small. Using `"device"` option will produce a single pixel per each device pixel, so screenhots of
* high-dpi devices will be twice as large or even larger. Defaults to `"device"`.
* high-dpi devices will be twice as large or even larger.
*
* Defaults to `"css"`.
*/
scale?: "css"|"device";

Expand Down Expand Up @@ -19630,7 +19638,7 @@ interface LocatorAssertions {
* - finite animations are fast-forwarded to completion, so they'll fire `transitionend` event.
* - infinite animations are canceled to initial state, and then played over after the screenshot.
*
* Defaults to `"allow"` that leaves animations untouched.
* Defaults to `"disabled"` that disables animations.
*/
animations?: "disabled"|"allow";

Expand Down Expand Up @@ -19667,7 +19675,9 @@ interface LocatorAssertions {
/**
* When set to `"css"`, screenshot will have a single pixel per each css pixel on the page. For high-dpi devices, this will
* keep screenshots small. Using `"device"` option will produce a single pixel per each device pixel, so screenhots of
* high-dpi devices will be twice as large or even larger. Defaults to `"device"`.
* high-dpi devices will be twice as large or even larger.
*
* Defaults to `"css"`.
*/
scale?: "css"|"device";

Expand Down Expand Up @@ -19784,7 +19794,7 @@ interface PageAssertions {
* - finite animations are fast-forwarded to completion, so they'll fire `transitionend` event.
* - infinite animations are canceled to initial state, and then played over after the screenshot.
*
* Defaults to `"allow"` that leaves animations untouched.
* Defaults to `"disabled"` that disables animations.
*/
animations?: "disabled"|"allow";

Expand Down Expand Up @@ -19852,7 +19862,9 @@ interface PageAssertions {
/**
* When set to `"css"`, screenshot will have a single pixel per each css pixel on the page. For high-dpi devices, this will
* keep screenshots small. Using `"device"` option will produce a single pixel per each device pixel, so screenhots of
* high-dpi devices will be twice as large or even larger. Defaults to `"device"`.
* high-dpi devices will be twice as large or even larger.
*
* Defaults to `"css"`.
*/
scale?: "css"|"device";

Expand Down Expand Up @@ -19889,7 +19901,7 @@ interface PageAssertions {
* - finite animations are fast-forwarded to completion, so they'll fire `transitionend` event.
* - infinite animations are canceled to initial state, and then played over after the screenshot.
*
* Defaults to `"allow"` that leaves animations untouched.
* Defaults to `"disabled"` that disables animations.
*/
animations?: "disabled"|"allow";

Expand Down Expand Up @@ -19957,7 +19969,9 @@ interface PageAssertions {
/**
* When set to `"css"`, screenshot will have a single pixel per each css pixel on the page. For high-dpi devices, this will
* keep screenshots small. Using `"device"` option will produce a single pixel per each device pixel, so screenhots of
* high-dpi devices will be twice as large or even larger. Defaults to `"device"`.
* high-dpi devices will be twice as large or even larger.
*
* Defaults to `"css"`.
*/
scale?: "css"|"device";

Expand Down