Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
fix: support all commong screenshot options in toHaveScreenshot (#12670)
Andrey Lushnikove83549e8a09c
diff --git a/packages/playwright-core/src/protocol/channels.ts b/packages/playwright-core/src/protocol/channels.tsindex 72b3046941..c8c15e3307 100644--- a/packages/playwright-core/src/protocol/channels.ts+++ b/packages/playwright-core/src/protocol/channels.ts@@ -1501,10 +1501,12 @@ export type PageExpectScreenshotParams = {threshold?: number,},screenshotOptions?: {- omitBackground?: boolean,fullPage?: boolean,- animations?: 'disabled' | 'allow',clip?: Rect,+ omitBackground?: boolean,+ animations?: 'disabled' | 'allow',+ size?: 'css' | 'device',+ fonts?: 'ready' | 'nowait',mask?: {frame: FrameChannel,selector: string,@@ -1524,10 +1526,12 @@ export type PageExpectScreenshotOptions = {threshold?: number,},screenshotOptions?: {- omitBackground?: boolean,fullPage?: boolean,- animations?: 'disabled' | 'allow',clip?: Rect,+ omitBackground?: boolean,+ animations?: 'disabled' | 'allow',+ size?: 'css' | 'device',+ fonts?: 'ready' | 'nowait',mask?: {frame: FrameChannel,selector: string,@@ -1545,10 +1549,10 @@ export type PageScreenshotParams = {timeout?: number,type?: 'png' | 'jpeg',quality?: number,- omitBackground?: boolean,fullPage?: boolean,- animations?: 'disabled' | 'allow',clip?: Rect,+ omitBackground?: boolean,+ animations?: 'disabled' | 'allow',size?: 'css' | 'device',fonts?: 'ready' | 'nowait',mask?: {@@ -1560,10 +1564,10 @@ export type PageScreenshotOptions = {timeout?: number,type?: 'png' | 'jpeg',quality?: number,- omitBackground?: boolean,fullPage?: boolean,- animations?: 'disabled' | 'allow',clip?: Rect,+ omitBackground?: boolean,+ animations?: 'disabled' | 'allow',size?: 'css' | 'device',fonts?: 'ready' | 'nowait',mask?: {diff --git a/packages/playwright-core/src/protocol/protocol.yml b/packages/playwright-core/src/protocol/protocol.ymlindex 8f2ff845b6..db70c9a36b 100644--- a/packages/playwright-core/src/protocol/protocol.yml+++ b/packages/playwright-core/src/protocol/protocol.yml@@ -309,6 +309,32 @@ LifecycleEvent:- networkidle- commit+CommonScreenshotOptions:+ type: mixin+ properties:+ omitBackground: boolean?+ animations:+ type: enum?+ literals:+ - disabled+ - allow+ size:+ type: enum?+ literals:+ - css+ - device+ fonts:+ type: enum?+ literals:+ - ready+ - nowait+ mask:+ type: array?+ items:+ type: object+ properties:+ frame: Frame+ selector: stringLaunchOptions:type: mixin@@ -1009,21 +1035,9 @@ Page:screenshotOptions:type: object?properties:- omitBackground: boolean?fullPage: boolean?- animations:- type: enum?- literals:- - disabled- - allowclip: Rect?- mask:- type: array?- items:- type: object- properties:- frame: Frame- selector: string+ $mixin: CommonScreenshotOptionsreturns:diff: binary?errorMessage: string?@@ -1044,31 +1058,9 @@ Page:- png- jpegquality: number?- omitBackground: boolean?fullPage: boolean?- animations:- type: enum?- literals:- - disabled- - allowclip: Rect?- size:- type: enum?- literals:- - css- - device- fonts:- type: enum?- literals:- - ready- - nowait- mask:- type: array?- items:- type: object- properties:- frame: Frame- selector: string+ $mixin: CommonScreenshotOptionsreturns:binary: binarytracing:@@ -2221,29 +2213,7 @@ ElementHandle:- png- jpegquality: number?- omitBackground: boolean?- animations:- type: enum?- literals:- - disabled- - allow- size:- type: enum?- literals:- - css- - device- fonts:- type: enum?- literals:- - ready- - nowait- mask:- type: array?- items:- type: object- properties:- frame: Frame- selector: string+ $mixin: CommonScreenshotOptionsreturns:binary: binarytracing:diff --git a/packages/playwright-core/src/protocol/validator.ts b/packages/playwright-core/src/protocol/validator.tsindex 4266f4f31a..723c3f0507 100644--- a/packages/playwright-core/src/protocol/validator.ts+++ b/packages/playwright-core/src/protocol/validator.ts@@ -554,10 +554,12 @@ export function createScheme(tChannel: (name: string) => Validator): Scheme {threshold: tOptional(tNumber),})),screenshotOptions: tOptional(tObject({- omitBackground: tOptional(tBoolean),fullPage: tOptional(tBoolean),- animations: tOptional(tEnum(['disabled', 'allow'])),clip: tOptional(tType('Rect')),+ omitBackground: tOptional(tBoolean),+ animations: tOptional(tEnum(['disabled', 'allow'])),+ size: tOptional(tEnum(['css', 'device'])),+ fonts: tOptional(tEnum(['ready', 'nowait'])),mask: tOptional(tArray(tObject({frame: tChannel('Frame'),selector: tString,@@ -568,10 +570,10 @@ export function createScheme(tChannel: (name: string) => Validator): Scheme {timeout: tOptional(tNumber),type: tOptional(tEnum(['png', 'jpeg'])),quality: tOptional(tNumber),- omitBackground: tOptional(tBoolean),fullPage: tOptional(tBoolean),- animations: tOptional(tEnum(['disabled', 'allow'])),clip: tOptional(tType('Rect')),+ omitBackground: tOptional(tBoolean),+ animations: tOptional(tEnum(['disabled', 'allow'])),size: tOptional(tEnum(['css', 'device'])),fonts: tOptional(tEnum(['ready', 'nowait'])),mask: tOptional(tArray(tObject({