Skip to content

Commit 093d3eb

Browse files
committed
feat(playwright): deprecate expect.toMatchScreenshot() in favor of world.expectScreenshotMatch
1 parent 3afe782 commit 093d3eb

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

.changeset/cyan-groups-rule.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@quickpickle/playwright": patch
3+
---
4+
5+
Marking playwright expect.toMatchScreenshot() as deprecated

packages/playwright/src/snapshotMatcher.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,14 @@ declare global {
141141

142142
// Override the default implementation
143143
playwrightExpect.extend({
144+
/**
145+
* A custom matcher to check if a screenshot matches a snapshot.
146+
* @param received the page or locator to take the screenshot from
147+
* @param nameOrOptions the name of the screenshot or the options for the screenshot
148+
* @param optOptions the options for the screenshot
149+
* @returns the result of the screenshot comparison
150+
* @deprecated Use world.expectScreenshotMatch instead
151+
*/
144152
async toMatchScreenshot(received: Page | Locator, nameOrOptions?: string | Partial<ToHaveScreenshotOptions>, optOptions?: Partial<ToHaveScreenshotOptions>) {
145153
const name = typeof nameOrOptions === 'string' ? nameOrOptions : 'screenshot';
146154
const options = typeof nameOrOptions === 'object' ? nameOrOptions : optOptions;

0 commit comments

Comments
 (0)