Skip to content

Commit 49f9e95

Browse files
committed
fix: add screenshot assertions maxDiffPixelRatio
1 parent 4223530 commit 49f9e95

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tests/e2e/code-snippets-list.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { SnippetsTestHelper } from './helpers/SnippetsTestHelper'
33
import { SELECTORS } from './helpers/constants'
44

55
const TEST_SNIPPET_NAME = 'E2E List Test Snippet'
6+
const MAX_DIFF_PIXEL_RATIO = 0.1
67

78
test.describe('Code Snippets List Page Actions', () => {
89
let helper: SnippetsTestHelper
@@ -29,7 +30,7 @@ test.describe('Code Snippets List Page Actions', () => {
2930
await expect(toggleSwitch).toHaveAttribute('title', 'Deactivate')
3031

3132
// Check that the toggle is rendered to the right (active)
32-
await expect(snippetRow).toHaveScreenshot('snippet-row-active.png')
33+
await expect(snippetRow).toHaveScreenshot('snippet-row-active.png', { maxDiffPixelRatio: MAX_DIFF_PIXEL_RATIO })
3334

3435
await toggleSwitch.click()
3536
await page.waitForLoadState('networkidle')
@@ -39,7 +40,7 @@ test.describe('Code Snippets List Page Actions', () => {
3940
await expect(updatedToggle).toHaveAttribute('title', 'Activate')
4041

4142
// Check that the toggle is rendered to the left (inactive)
42-
await expect(updatedRow).toHaveScreenshot('snippet-row-inactive.png')
43+
await expect(updatedRow).toHaveScreenshot('snippet-row-inactive.png', { maxDiffPixelRatio: MAX_DIFF_PIXEL_RATIO })
4344

4445
await updatedToggle.click()
4546
await page.waitForLoadState('networkidle')

0 commit comments

Comments
 (0)