Rayrun
← Back to Discord Forum

toMatchSnapshot question

.aleksandaraleksandrovposted in #help-playwright
Open in Discord
.aleksandaraleksandrov
.aleksandaraleksandrov

I am having a hard time comparing two snapshots:

First: await page.locator("//body[1]/div[4]/div[2]/div[1]/div[1]").screenshot({ path: 'tests/badAutoReg/reservationcheck.png', }); Second: expect (await page.locator("//body[1]/div[3]/div[2]/div[1]/div[1]").screenshot({ path: 'tests/badAutoReg/Details.png', })).toMatchSnapshot('tests/badAutoReg/reservationcheck.png',{ maxDiffPixels: 100, maxDiffPixelRatio: 0.01, });

Getting this error "Error: A snapshot doesn't exist at c:\Users\Alex Aleksandrov\Playwright\tests\badAutoReg\Check-out.spec.ts-snapshots\tests-badAutoReg-reservationcheck-chromium-win32.png, writing actual. at tests\badAutoReg\Check-out.spec.ts:105:9".

This thread is trying to answer question "Why is the user getting an error when trying to compare two snapshots using toMatchSnapshot in Playwright?"

2 replies
ntodorov99

I think comparing two different screenshots is stil not implemented -> https://github.com/microsoft/playwright/issues/18937

Maybe you can vote on the feature and comment.

.aleksandaraleksandrov
.aleksandaraleksandrov

Thank you a lot @ntodorov99

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].