Udemy Playwright: Web Automation Testing From Zero to Hero: Difference between revisions
Jump to navigation
Jump to search
Udemy Playwright: Web Automation Testing From Zero to Hero (view source)
Revision as of 22:57, 12 June 2024
, 12 June→Visual Testing
m (→Visual Testing) |
|||
Line 2,054: | Line 2,054: | ||
<nowiki> | <nowiki> | ||
npx playwright test --update-snapshots</nowiki> | npx playwright test --update-snapshots</nowiki> | ||
I would like to try doing visual testing of small parts on the screen, and then test the integration of those parts but masking the smaller parts so that the larger integration test only checks that the sub parts are there, but not test the sub part internals. The mask option of <code>.toHaveScreenshot({mask: [maskedElement1,maskedElement2]})</code> can take an array of locators. However, this would apply the same colour to all of them, might try using CSS through <code>.toHaveScreenshot({ stylePath: path.join(__dirname, 'screenshot.css') })</code> to render the elements with a solid block with different colours. | |||
To do this I need to identify the child elements and set their <code>visibility: hidden;</code> and then the element to have <code>background-color: #123;</code> | |||
=== Playwright with Docker Container === | === Playwright with Docker Container === |