Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(test-runner): introduce pixelCount and pixelRatio options #12169

Merged
merged 2 commits into from
Feb 17, 2022

Conversation

aslushnikov
Copy link
Collaborator

@aslushnikov aslushnikov commented Feb 17, 2022

This patch adds additional options to toMatchSnapshot method:

  • pixelCount - acceptable number of pixels that differ to still
    consider images equal, unset by default.
  • pixelRatio - acceptable percentage of pixels that differ to still
    consider images equal, unset by default.

Fixes #12167, #10219

docs/src/test-api/class-testconfig.md Outdated Show resolved Hide resolved
docs/src/test-api/class-testconfig.md Outdated Show resolved Hide resolved
tests/playwright-test/golden.spec.ts Outdated Show resolved Hide resolved
tests/playwright-test/golden.spec.ts Outdated Show resolved Hide resolved
utils/generate_types/overrides-test.d.ts Outdated Show resolved Hide resolved
utils/generate_types/overrides-test.d.ts Show resolved Hide resolved
packages/playwright-test/src/matchers/golden.ts Outdated Show resolved Hide resolved
packages/playwright-test/src/matchers/toMatchSnapshot.ts Outdated Show resolved Hide resolved
packages/playwright-test/types/test.d.ts Outdated Show resolved Hide resolved
This patch adds additional options to `toMatchSnapshot` method:
- `pixelCount` - acceptable number of pixels that differ to still
  consider images equal.
- `pixelRatio` - acceptable percentage of pixels that differ to still
  consider images equal.

Since some anti-aliasing artifacts still can cripple in, we default
`pixelCount` to some arbitrary small number - `17` - to improve
tolerance.

Fixes microsoft#12167, microsoft#10219
@aslushnikov aslushnikov merged commit a98babe into microsoft:main Feb 17, 2022
@aslushnikov aslushnikov deleted the introduce-pixel-delta-option branch February 17, 2022 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Visual Regression testing with Playwright test toMatchSnapshot stops on single pixel difference
2 participants