Playwright / Quiz
The Pixel Tribunal
toHaveScreenshot, platform-suffixed baselines, masks, and diff thresholds: visual testing that convicts real regressions and acquits antialiasing.
- Difficulty
- Medium
- Format
- Quiz
- Points
- 150
- Estimate
- 10 min
// MISSION BRIEF
Your Mission
The functional suite is green and the pricing table is rendering on top of the nav bar. Only pixels know. Playwright's visual assertions put them on the stand, if you can keep the testimony stable.
This quiz covers toHaveScreenshot mechanics: baseline generation, updates, platform suffixes, masking, and tolerance tuning.
Speed bonus active.
// FIRST CONTACT
Battle teaser
The very first run of `await expect(page).toHaveScreenshot('home.png')`:
- AThrows a syntax error, names are not allowed
- BCompares against an empty white image
- CPasses silently and saves the baseline
- DFails with 'snapshot doesn't exist' and writes the new baseline, so the next run has something to compare against
Answers, scoring, hints, and the full battle stay sealed.
// SKILL TAGS
playwrightvisual-testingsnapshotsci-cde2e-testing