1 year ago
#379000
nataly go
Cucumber-js + playwright: receiving "Error: toMatchSnapshot() must be called during the test" error when using .toMatchSnapshot()
I have a need to setup a visual regression framework playwright + cucumber-js. I finally made it to work somehow, but I can't make it to match screenshots via Playwright. When execution reaches the row:
expect(await page.locator(`${element}`).screenshot({ path: `${process.env.SCREENSHOTS_FOLDER}/${name}.png` }))
.toMatchSnapshot(`${name}.png`);
it all ends with the error:
Then screen matches the base image for 'FrontPage' page 'header' element
Error: toMatchSnapshot() must be called during the test
Seems like Playwright is missing the 'test' context, but I'm using cucumber and gherkin notation. Is there any good way to make it work somehow?
playwright
cucumberjs
0 Answers
Your Answer