From 8167f8bf548308ad8c6f1188508aadee84f26023 Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Wed, 14 Dec 2022 09:58:19 -0800 Subject: [PATCH] chore: hide "comparator" option from documentation and types (#19441) --- docs/src/api/class-locatorassertions.md | 6 -- docs/src/api/class-pageassertions.md | 6 -- docs/src/api/class-snapshotassertions.md | 6 -- docs/src/api/params.md | 8 +- docs/src/test-api/class-testconfig.md | 6 +- docs/src/test-api/class-testproject.md | 6 +- .../src/server/dispatchers/pageDispatcher.ts | 4 + .../playwright-core/src/utils/comparators.ts | 8 +- .../src/matchers/toMatchSnapshot.ts | 13 ++-- packages/playwright-test/types/test.d.ts | 74 +++---------------- tests/playwright-test/golden.spec.ts | 8 +- .../to-have-screenshot.spec.ts | 8 +- 12 files changed, 39 insertions(+), 114 deletions(-) diff --git a/docs/src/api/class-locatorassertions.md b/docs/src/api/class-locatorassertions.md index c578608a74..f7c5e7a2fa 100644 --- a/docs/src/api/class-locatorassertions.md +++ b/docs/src/api/class-locatorassertions.md @@ -1362,9 +1362,6 @@ Snapshot name. ### option: LocatorAssertions.toHaveScreenshot#1.scale = %%-screenshot-option-scale-default-css-%% * since: v1.23 -### option: LocatorAssertions.toHaveScreenshot#1.comparator = %%-assertions-comparator-%% -* since: v1.29 - ### option: LocatorAssertions.toHaveScreenshot#1.maxDiffPixels = %%-assertions-max-diff-pixels-%% * since: v1.23 @@ -1408,9 +1405,6 @@ Note that screenshot assertions only work with Playwright test runner. ### option: LocatorAssertions.toHaveScreenshot#2.scale = %%-screenshot-option-scale-default-css-%% * since: v1.23 -### option: LocatorAssertions.toHaveScreenshot#2.comparator = %%-assertions-comparator-%% -* since: v1.29 - ### option: LocatorAssertions.toHaveScreenshot#2.maxDiffPixels = %%-assertions-max-diff-pixels-%% * since: v1.23 diff --git a/docs/src/api/class-pageassertions.md b/docs/src/api/class-pageassertions.md index d52d562439..b1e68dc2f2 100644 --- a/docs/src/api/class-pageassertions.md +++ b/docs/src/api/class-pageassertions.md @@ -170,9 +170,6 @@ Snapshot name. ### option: PageAssertions.toHaveScreenshot#1.scale = %%-screenshot-option-scale-default-css-%% * since: v1.23 -### option: PageAssertions.toHaveScreenshot#1.comparator = %%-assertions-comparator-%% -* since: v1.29 - ### option: PageAssertions.toHaveScreenshot#1.maxDiffPixels = %%-assertions-max-diff-pixels-%% * since: v1.23 @@ -221,9 +218,6 @@ Note that screenshot assertions only work with Playwright test runner. ### option: PageAssertions.toHaveScreenshot#2.scale = %%-screenshot-option-scale-default-css-%% * since: v1.23 -### option: PageAssertions.toHaveScreenshot#2.comparator = %%-assertions-comparator-%% -* since: v1.29 - ### option: PageAssertions.toHaveScreenshot#2.maxDiffPixels = %%-assertions-max-diff-pixels-%% * since: v1.23 diff --git a/docs/src/api/class-snapshotassertions.md b/docs/src/api/class-snapshotassertions.md index faac9465a5..a61a4752b1 100644 --- a/docs/src/api/class-snapshotassertions.md +++ b/docs/src/api/class-snapshotassertions.md @@ -43,9 +43,6 @@ Note that matching snapshots only work with Playwright test runner. Snapshot name. -### option: SnapshotAssertions.toMatchSnapshot#1.comparator = %%-assertions-comparator-%% -* since: v1.29 - ### option: SnapshotAssertions.toMatchSnapshot#1.maxDiffPixels = %%-assertions-max-diff-pixels-%% * since: v1.22 @@ -82,9 +79,6 @@ Learn more about [visual comparisons](../test-snapshots.md). Note that matching snapshots only work with Playwright test runner. -### option: SnapshotAssertions.toMatchSnapshot#2.comparator = %%-assertions-comparator-%% -* since: v1.29 - ### option: SnapshotAssertions.toMatchSnapshot#2.maxDiffPixels = %%-assertions-max-diff-pixels-%% * since: v1.22 diff --git a/docs/src/api/params.md b/docs/src/api/params.md index 0e07bcfc99..3179780161 100644 --- a/docs/src/api/params.md +++ b/docs/src/api/params.md @@ -806,12 +806,6 @@ Time to retry the assertion for. An acceptable amount of pixels that could be different. Default is configurable with `TestConfig.expect`. Unset by default. -## assertions-comparator -* langs: js -- `comparator` <[string]> Either `"pixelmatch"` or `"ssim-cie94"`. - -A comparator function to use when comparing images. Defaults to `"pixelmatch"`. - ## assertions-max-diff-pixel-ratio * langs: js - `maxDiffPixelRatio` <[float]> @@ -824,7 +818,7 @@ An acceptable ratio of pixels that are different to the total amount of pixels, An acceptable perceived color difference in the [YIQ color space](https://en.wikipedia.org/wiki/YIQ) between the same pixel in compared images, between zero (strict) and one (lax), default is configurable with -`TestConfig.expect`. Defaults to `0.2`. This option is used by "pixelmatch" image comparator. +`TestConfig.expect`. Defaults to `0.2`. ## shared-context-params-list-v1.8 - %%-context-option-acceptdownloads-%% diff --git a/docs/src/test-api/class-testconfig.md b/docs/src/test-api/class-testconfig.md index b58cb20bad..61e4e256e2 100644 --- a/docs/src/test-api/class-testconfig.md +++ b/docs/src/test-api/class-testconfig.md @@ -39,16 +39,14 @@ export default config; - type: ?<[Object]> - `timeout` ?<[int]> Default timeout for async expect matchers in milliseconds, defaults to 5000ms. - `toHaveScreenshot` ?<[Object]> Configuration for the [`method: PageAssertions.toHaveScreenshot#1`] method. - - `comparator` ?<[string]> a comparator function to use, either `"pixelmatch"` or `"ssim-cie94"`. Defaults to `"pixelmatch"`. - - `threshold` ?<[float]> an acceptable perceived color difference between the same pixel in compared images, ranging from `0` (strict) and `1` (lax). `"pixelmatch"` comparator computes color difference in [YIQ color space](https://en.wikipedia.org/wiki/YIQ) and defaults `threshold` value to `0.2`. This option is used by `pixelmatch` image comparator. + - `threshold` ?<[float]> an acceptable perceived color difference between the same pixel in compared images, ranging from `0` (strict) and `1` (lax). `"pixelmatch"` comparator computes color difference in [YIQ color space](https://en.wikipedia.org/wiki/YIQ) and defaults `threshold` value to `0.2`. - `maxDiffPixels` ?<[int]> an acceptable amount of pixels that could be different, unset by default. - `maxDiffPixelRatio` ?<[float]> an acceptable ratio of pixels that are different to the total amount of pixels, between `0` and `1` , unset by default. - `animations` ?<[ScreenshotAnimations]<"allow"|"disabled">> See [`option: animations`] in [`method: Page.screenshot`]. Defaults to `"disabled"`. - `caret` ?<[ScreenshotCaret]<"hide"|"initial">> See [`option: caret`] in [`method: Page.screenshot`]. Defaults to `"hide"`. - `scale` ?<[ScreenshotScale]<"css"|"device">> See [`option: scale`] in [`method: Page.screenshot`]. Defaults to `"css"`. - `toMatchSnapshot` ?<[Object]> Configuration for the [`method: SnapshotAssertions.toMatchSnapshot#1`] method. - - `comparator` ?<[string]> a comparator function to use, either `"pixelmatch"` or `"ssim-cie94"`. Defaults to `"pixelmatch"`. - - `threshold` ?<[float]> an acceptable perceived color difference between the same pixel in compared images, ranging from `0` (strict) and `1` (lax). `"pixelmatch"` comparator computes color difference in [YIQ color space](https://en.wikipedia.org/wiki/YIQ) and defaults `threshold` value to `0.2`. This option is used by `pixelmatch` image comparator. + - `threshold` ?<[float]> an acceptable perceived color difference between the same pixel in compared images, ranging from `0` (strict) and `1` (lax). `"pixelmatch"` comparator computes color difference in [YIQ color space](https://en.wikipedia.org/wiki/YIQ) and defaults `threshold` value to `0.2`. - `maxDiffPixels` ?<[int]> an acceptable amount of pixels that could be different, unset by default. - `maxDiffPixelRatio` ?<[float]> an acceptable ratio of pixels that are different to the total amount of pixels, between `0` and `1` , unset by default. diff --git a/docs/src/test-api/class-testproject.md b/docs/src/test-api/class-testproject.md index c988944657..51588c2c2e 100644 --- a/docs/src/test-api/class-testproject.md +++ b/docs/src/test-api/class-testproject.md @@ -110,16 +110,14 @@ export default config; - type: ?<[Object]> - `timeout` ?<[int]> Default timeout for async expect matchers in milliseconds, defaults to 5000ms. - `toHaveScreenshot` ?<[Object]> Configuration for the [`method: PageAssertions.toHaveScreenshot#1`] method. - - `comparator` ?<[string]> a comparator function to use, either `"pixelmatch"` or `"ssim-cie94"`. Defaults to `"pixelmatch"`. - - `threshold` ?<[float]> an acceptable perceived color difference between the same pixel in compared images, ranging from `0` (strict) and `1` (lax). `"pixelmatch"` comparator computes color difference in [YIQ color space](https://en.wikipedia.org/wiki/YIQ) and defaults `threshold` value to `0.2`. This option is used by `pixelmatch` image comparator. + - `threshold` ?<[float]> an acceptable perceived color difference between the same pixel in compared images, ranging from `0` (strict) and `1` (lax). `"pixelmatch"` comparator computes color difference in [YIQ color space](https://en.wikipedia.org/wiki/YIQ) and defaults `threshold` value to `0.2`. - `maxDiffPixels` ?<[int]> an acceptable amount of pixels that could be different, unset by default. - `maxDiffPixelRatio` ?<[float]> an acceptable ratio of pixels that are different to the total amount of pixels, between `0` and `1` , unset by default. - `animations` ?<[ScreenshotAnimations]<"allow"|"disabled">> See [`option: animations`] in [`method: Page.screenshot`]. Defaults to `"disabled"`. - `caret` ?<[ScreenshotCaret]<"hide"|"initial">> See [`option: caret`] in [`method: Page.screenshot`]. Defaults to `"hide"`. - `scale` ?<[ScreenshotScale]<"css"|"device">> See [`option: scale`] in [`method: Page.screenshot`]. Defaults to `"css"`. - `toMatchSnapshot` ?<[Object]> Configuration for the [`method: SnapshotAssertions.toMatchSnapshot#1`] method. - - `comparator` ?<[string]> a comparator function to use, either `"pixelmatch"` or `"ssim-cie94"`. Defaults to `"pixelmatch"`. - - `threshold` ?<[float]> an acceptable perceived color difference between the same pixel in compared images, ranging from `0` (strict) and `1` (lax). `"pixelmatch"` comparator computes color difference in [YIQ color space](https://en.wikipedia.org/wiki/YIQ) and defaults `threshold` value to `0.2`. This option is used by `pixelmatch` image comparator. + - `threshold` ?<[float]> an acceptable perceived color difference between the same pixel in compared images, ranging from `0` (strict) and `1` (lax). `"pixelmatch"` comparator computes color difference in [YIQ color space](https://en.wikipedia.org/wiki/YIQ) and defaults `threshold` value to `0.2`. - `maxDiffPixels` ?<[int]> an acceptable amount of pixels that could be different, unset by default. - `maxDiffPixelRatio` ?<[float]> an acceptable ratio of pixels that are different to the total amount of pixels, between `0` and `1` , unset by default. diff --git a/packages/playwright-core/src/server/dispatchers/pageDispatcher.ts b/packages/playwright-core/src/server/dispatchers/pageDispatcher.ts index f7cbd1db2f..7d62a70eea 100644 --- a/packages/playwright-core/src/server/dispatchers/pageDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/pageDispatcher.ts @@ -176,6 +176,10 @@ export class PageDispatcher extends Dispatcher ComparatorResult; @@ -60,18 +60,18 @@ function compareImages(mimeType: string, actualBuffer: Buffer | string, expected } const diff = new PNG({ width: expected.width, height: expected.height }); let count; - if (options.comparator === 'ssim-cie94') { + if (options._comparator === 'ssim-cie94') { count = compare(expected.data, actual.data, diff.data, expected.width, expected.height, { // All ΔE* formulae are originally designed to have the difference of 1.0 stand for a "just noticeable difference" (JND). // See https://en.wikipedia.org/wiki/Color_difference#CIELAB_%CE%94E* maxColorDeltaE94: 1.0, }); - } else if ((options.comparator ?? 'pixelmatch') === 'pixelmatch') { + } else if ((options._comparator ?? 'pixelmatch') === 'pixelmatch') { count = pixelmatch(expected.data, actual.data, diff.data, expected.width, expected.height, { threshold: options.threshold ?? 0.2, }); } else { - throw new Error(`Configuration specifies unknown comparator "${options.comparator}"`); + throw new Error(`Configuration specifies unknown comparator "${options._comparator}"`); } const maxDiffPixels1 = options.maxDiffPixels; diff --git a/packages/playwright-test/src/matchers/toMatchSnapshot.ts b/packages/playwright-test/src/matchers/toMatchSnapshot.ts index f08ea37780..2e083cc259 100644 --- a/packages/playwright-test/src/matchers/toMatchSnapshot.ts +++ b/packages/playwright-test/src/matchers/toMatchSnapshot.ts @@ -145,7 +145,7 @@ class SnapshotHelper { maxDiffPixels: options.maxDiffPixels, maxDiffPixelRatio: options.maxDiffPixelRatio, threshold: options.threshold, - comparator: options.comparator, + _comparator: options._comparator, }; this.kind = this.mimeType.startsWith('image/') ? 'Screenshot' : 'Snapshot'; } @@ -306,7 +306,7 @@ export async function toHaveScreenshot( const helper = new SnapshotHelper( testInfo, snapshotPathResolver, 'png', { - comparator: config?.comparator, + _comparator: config?._comparator, maxDiffPixels: config?.maxDiffPixels, maxDiffPixelRatio: config?.maxDiffPixelRatio, threshold: config?.threshold, @@ -342,7 +342,10 @@ export async function toHaveScreenshot( expected: await fs.promises.readFile(helper.snapshotPath), isNot: true, locator, - comparatorOptions: helper.comparatorOptions, + comparatorOptions: { + ...helper.comparatorOptions, + comparator: helper.comparatorOptions._comparator, + }, screenshotOptions, timeout: currentExpectTimeout(helper.allOptions), })).errorMessage; @@ -360,7 +363,7 @@ export async function toHaveScreenshot( expected: undefined, isNot: false, locator, - comparatorOptions: helper.comparatorOptions, + comparatorOptions: { ...helper.comparatorOptions, comparator: helper.comparatorOptions._comparator }, screenshotOptions, timeout, }); @@ -382,7 +385,7 @@ export async function toHaveScreenshot( expected, isNot: false, locator, - comparatorOptions: helper.comparatorOptions, + comparatorOptions: { ...helper.comparatorOptions, comparator: helper.comparatorOptions._comparator }, screenshotOptions, timeout: currentExpectTimeout(helper.allOptions), }); diff --git a/packages/playwright-test/types/test.d.ts b/packages/playwright-test/types/test.d.ts index 1daf2ec532..fa5da42c34 100644 --- a/packages/playwright-test/types/test.d.ts +++ b/packages/playwright-test/types/test.d.ts @@ -530,16 +530,10 @@ interface TestConfig { * method. */ toHaveScreenshot?: { - /** - * a comparator function to use, either `"pixelmatch"` or `"ssim-cie94"`. Defaults to `"pixelmatch"`. - */ - comparator?: string; - /** * an acceptable perceived color difference between the same pixel in compared images, ranging from `0` (strict) and * `1` (lax). `"pixelmatch"` comparator computes color difference in - * [YIQ color space](https://en.wikipedia.org/wiki/YIQ) and defaults `threshold` value to `0.2`. This option is used - * by `pixelmatch` image comparator. + * [YIQ color space](https://en.wikipedia.org/wiki/YIQ) and defaults `threshold` value to `0.2`. */ threshold?: number; @@ -579,16 +573,10 @@ interface TestConfig { * method. */ toMatchSnapshot?: { - /** - * a comparator function to use, either `"pixelmatch"` or `"ssim-cie94"`. Defaults to `"pixelmatch"`. - */ - comparator?: string; - /** * an acceptable perceived color difference between the same pixel in compared images, ranging from `0` (strict) and * `1` (lax). `"pixelmatch"` comparator computes color difference in - * [YIQ color space](https://en.wikipedia.org/wiki/YIQ) and defaults `threshold` value to `0.2`. This option is used - * by `pixelmatch` image comparator. + * [YIQ color space](https://en.wikipedia.org/wiki/YIQ) and defaults `threshold` value to `0.2`. */ threshold?: number; @@ -3825,11 +3813,6 @@ interface LocatorAssertions { */ caret?: "hide"|"initial"; - /** - * A comparator function to use when comparing images. Defaults to `"pixelmatch"`. - */ - comparator?: string; - /** * Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink * box `#FF00FF` that completely covers its bounding box. @@ -3866,7 +3849,7 @@ interface LocatorAssertions { /** * An acceptable perceived color difference in the [YIQ color space](https://en.wikipedia.org/wiki/YIQ) between the * same pixel in compared images, between zero (strict) and one (lax), default is configurable with - * `TestConfig.expect`. Defaults to `0.2`. This option is used by "pixelmatch" image comparator. + * `TestConfig.expect`. Defaults to `0.2`. */ threshold?: number; @@ -3907,11 +3890,6 @@ interface LocatorAssertions { */ caret?: "hide"|"initial"; - /** - * A comparator function to use when comparing images. Defaults to `"pixelmatch"`. - */ - comparator?: string; - /** * Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink * box `#FF00FF` that completely covers its bounding box. @@ -3948,7 +3926,7 @@ interface LocatorAssertions { /** * An acceptable perceived color difference in the [YIQ color space](https://en.wikipedia.org/wiki/YIQ) between the * same pixel in compared images, between zero (strict) and one (lax), default is configurable with - * `TestConfig.expect`. Defaults to `0.2`. This option is used by "pixelmatch" image comparator. + * `TestConfig.expect`. Defaults to `0.2`. */ threshold?: number; @@ -4160,11 +4138,6 @@ interface PageAssertions { height: number; }; - /** - * A comparator function to use when comparing images. Defaults to `"pixelmatch"`. - */ - comparator?: string; - /** * When true, takes a screenshot of the full scrollable page, instead of the currently visible viewport. Defaults to * `false`. @@ -4207,7 +4180,7 @@ interface PageAssertions { /** * An acceptable perceived color difference in the [YIQ color space](https://en.wikipedia.org/wiki/YIQ) between the * same pixel in compared images, between zero (strict) and one (lax), default is configurable with - * `TestConfig.expect`. Defaults to `0.2`. This option is used by "pixelmatch" image comparator. + * `TestConfig.expect`. Defaults to `0.2`. */ threshold?: number; @@ -4272,11 +4245,6 @@ interface PageAssertions { height: number; }; - /** - * A comparator function to use when comparing images. Defaults to `"pixelmatch"`. - */ - comparator?: string; - /** * When true, takes a screenshot of the full scrollable page, instead of the currently visible viewport. Defaults to * `false`. @@ -4319,7 +4287,7 @@ interface PageAssertions { /** * An acceptable perceived color difference in the [YIQ color space](https://en.wikipedia.org/wiki/YIQ) between the * same pixel in compared images, between zero (strict) and one (lax), default is configurable with - * `TestConfig.expect`. Defaults to `0.2`. This option is used by "pixelmatch" image comparator. + * `TestConfig.expect`. Defaults to `0.2`. */ threshold?: number; @@ -4407,11 +4375,6 @@ interface SnapshotAssertions { * @param options */ toMatchSnapshot(name: string|Array, options?: { - /** - * A comparator function to use when comparing images. Defaults to `"pixelmatch"`. - */ - comparator?: string; - /** * An acceptable ratio of pixels that are different to the total amount of pixels, between `0` and `1`. Default is * configurable with `TestConfig.expect`. Unset by default. @@ -4427,7 +4390,7 @@ interface SnapshotAssertions { /** * An acceptable perceived color difference in the [YIQ color space](https://en.wikipedia.org/wiki/YIQ) between the * same pixel in compared images, between zero (strict) and one (lax), default is configurable with - * `TestConfig.expect`. Defaults to `0.2`. This option is used by "pixelmatch" image comparator. + * `TestConfig.expect`. Defaults to `0.2`. */ threshold?: number; }): void; @@ -4460,11 +4423,6 @@ interface SnapshotAssertions { * @param options */ toMatchSnapshot(options?: { - /** - * A comparator function to use when comparing images. Defaults to `"pixelmatch"`. - */ - comparator?: string; - /** * An acceptable ratio of pixels that are different to the total amount of pixels, between `0` and `1`. Default is * configurable with `TestConfig.expect`. Unset by default. @@ -4485,7 +4443,7 @@ interface SnapshotAssertions { /** * An acceptable perceived color difference in the [YIQ color space](https://en.wikipedia.org/wiki/YIQ) between the * same pixel in compared images, between zero (strict) and one (lax), default is configurable with - * `TestConfig.expect`. Defaults to `0.2`. This option is used by "pixelmatch" image comparator. + * `TestConfig.expect`. Defaults to `0.2`. */ threshold?: number; }): void; @@ -4590,16 +4548,10 @@ interface TestProject { * method. */ toHaveScreenshot?: { - /** - * a comparator function to use, either `"pixelmatch"` or `"ssim-cie94"`. Defaults to `"pixelmatch"`. - */ - comparator?: string; - /** * an acceptable perceived color difference between the same pixel in compared images, ranging from `0` (strict) and * `1` (lax). `"pixelmatch"` comparator computes color difference in - * [YIQ color space](https://en.wikipedia.org/wiki/YIQ) and defaults `threshold` value to `0.2`. This option is used - * by `pixelmatch` image comparator. + * [YIQ color space](https://en.wikipedia.org/wiki/YIQ) and defaults `threshold` value to `0.2`. */ threshold?: number; @@ -4639,16 +4591,10 @@ interface TestProject { * method. */ toMatchSnapshot?: { - /** - * a comparator function to use, either `"pixelmatch"` or `"ssim-cie94"`. Defaults to `"pixelmatch"`. - */ - comparator?: string; - /** * an acceptable perceived color difference between the same pixel in compared images, ranging from `0` (strict) and * `1` (lax). `"pixelmatch"` comparator computes color difference in - * [YIQ color space](https://en.wikipedia.org/wiki/YIQ) and defaults `threshold` value to `0.2`. This option is used - * by `pixelmatch` image comparator. + * [YIQ color space](https://en.wikipedia.org/wiki/YIQ) and defaults `threshold` value to `0.2`. */ threshold?: number; diff --git a/tests/playwright-test/golden.spec.ts b/tests/playwright-test/golden.spec.ts index 102fa55530..6c19a39f51 100644 --- a/tests/playwright-test/golden.spec.ts +++ b/tests/playwright-test/golden.spec.ts @@ -631,13 +631,13 @@ test('should respect comparator name', async ({ runInlineTest }) => { test('should pass', ({}) => { expect(Buffer.from('${actual.toString('base64')}', 'base64')).toMatchSnapshot('snapshot.png', { threshold: 0, - comparator: 'ssim-cie94', + _comparator: 'ssim-cie94', }); }); test('should fail', ({}) => { expect(Buffer.from('${actual.toString('base64')}', 'base64')).toMatchSnapshot('snapshot.png', { threshold: 0, - comparator: 'pixelmatch', + _comparator: 'pixelmatch', }); }); ` @@ -662,7 +662,7 @@ test('should respect comparator in config', async ({ runInlineTest }) => { name: 'should-pass', expect: { toMatchSnapshot: { - comparator: 'ssim-cie94', + _comparator: 'ssim-cie94', } }, }, @@ -670,7 +670,7 @@ test('should respect comparator in config', async ({ runInlineTest }) => { name: 'should-fail', expect: { toMatchSnapshot: { - comparator: 'pixelmatch', + _comparator: 'pixelmatch', } }, }, diff --git a/tests/playwright-test/to-have-screenshot.spec.ts b/tests/playwright-test/to-have-screenshot.spec.ts index dd121e8308..9daed62bc2 100644 --- a/tests/playwright-test/to-have-screenshot.spec.ts +++ b/tests/playwright-test/to-have-screenshot.spec.ts @@ -1035,14 +1035,14 @@ test('should respect comparator name', async ({ runInlineTest }) => { await page.goto('${actualURL}'); await expect(page.locator('img')).toHaveScreenshot('snapshot.png', { threshold: 0, - comparator: 'ssim-cie94', + _comparator: 'ssim-cie94', }); }); pwt.test('should fail', async ({ page }) => { await page.goto('${actualURL}'); await expect(page.locator('img')).toHaveScreenshot('snapshot.png', { threshold: 0, - comparator: 'pixelmatch', + _comparator: 'pixelmatch', }); }); ` @@ -1065,7 +1065,7 @@ test('should respect comparator in config', async ({ runInlineTest }) => { name: 'should-pass', expect: { toHaveScreenshot: { - comparator: 'ssim-cie94', + _comparator: 'ssim-cie94', } }, }, @@ -1073,7 +1073,7 @@ test('should respect comparator in config', async ({ runInlineTest }) => { name: 'should-fail', expect: { toHaveScreenshot: { - comparator: 'pixelmatch', + _comparator: 'pixelmatch', } }, },