Skip to content

Instantly share code, notes, and snippets.

@observethenoyes
Last active September 4, 2025 15:20
Show Gist options
  • Select an option

  • Save observethenoyes/d457b4c5db032c8476f89952f546d5be to your computer and use it in GitHub Desktop.

Select an option

Save observethenoyes/d457b4c5db032c8476f89952f546d5be to your computer and use it in GitHub Desktop.
Visual Regression Masking Example
const { expect, test } = require('@playwright/test')
test('wait for an element to become visible', async ({ page }) => {
await page.goto(process.env.ENVIRONMENT_URL || 'https://www.winzogames.us')
await page.waitForLoadState('networkidle');
// Use the "toHaveScreenshot" matcher to compare screenshots between check runs
// Don't forget to --update-snapshots on your first run!
await expect(page).toHaveScreenshot({
maxDiffPixelRatio: 0.2, //Define your thresholds here
maxDiffPixels: 1000, //Define your thresholds here
threshold: 0.2, //Define your thresholds here
fullPage: true,
animations: 'disabled',
mask: [ // Mask out dynamic content on WinZO Homepage
page.locator('[class*="MatchMakingComponent_root"] .container').locator('> div').first().locator('> div')
],
omitBackground: true,
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment