fix: support all commong screenshot options in toHaveScreenshot (#12670)
This patch adds support for all common options in `expect.toHaveScreenshot`.
This commit is contained in:
parent
65b9cba143
commit
e83549e8a0
|
|
@ -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?: {
|
||||
|
|
|
|||
|
|
@ -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: string
|
||||
|
||||
LaunchOptions:
|
||||
type: mixin
|
||||
|
|
@ -1009,21 +1035,9 @@ Page:
|
|||
screenshotOptions:
|
||||
type: object?
|
||||
properties:
|
||||
omitBackground: boolean?
|
||||
fullPage: boolean?
|
||||
animations:
|
||||
type: enum?
|
||||
literals:
|
||||
- disabled
|
||||
- allow
|
||||
clip: Rect?
|
||||
mask:
|
||||
type: array?
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
frame: Frame
|
||||
selector: string
|
||||
$mixin: CommonScreenshotOptions
|
||||
returns:
|
||||
diff: binary?
|
||||
errorMessage: string?
|
||||
|
|
@ -1044,31 +1058,9 @@ Page:
|
|||
- png
|
||||
- jpeg
|
||||
quality: number?
|
||||
omitBackground: boolean?
|
||||
fullPage: boolean?
|
||||
animations:
|
||||
type: enum?
|
||||
literals:
|
||||
- disabled
|
||||
- allow
|
||||
clip: 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: CommonScreenshotOptions
|
||||
returns:
|
||||
binary: binary
|
||||
tracing:
|
||||
|
|
@ -2221,29 +2213,7 @@ ElementHandle:
|
|||
- png
|
||||
- jpeg
|
||||
quality: 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: CommonScreenshotOptions
|
||||
returns:
|
||||
binary: binary
|
||||
tracing:
|
||||
|
|
|
|||
|
|
@ -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({
|
||||
|
|
|
|||
Loading…
Reference in a new issue