diff --git a/.github/workflows/actions/test-e2e/action.yml b/.github/workflows/actions/test-e2e/action.yml index d0c564c2..6a0fa2ca 100644 --- a/.github/workflows/actions/test-e2e/action.yml +++ b/.github/workflows/actions/test-e2e/action.yml @@ -55,10 +55,8 @@ runs: npx playwright test --shard=${{ inputs.shard }}/${{ inputs.totalShards }} --update-snapshots git add src/\*.png --force mkdir updated-screenshots - echo 'made dir' rsync -R --progress $(git diff --name-only --cached) updated-screenshots - echo 'copied images' - if [ -d updated-screenshots ]; then + if [ "$(ls -A updated-screenshots)" ]; then echo "hasUpdatedScreenshots=$(echo 'true')" >> $GITHUB_OUTPUT cd updated-screenshots ls diff --git a/playwright.config.ts b/playwright.config.ts index 0fd6b239..75bb8982 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -52,14 +52,7 @@ const config: PlaywrightTestConfig = { * Maximum time expect() should wait for the condition to be met. * For example in `await expect(locator).toHaveText();` */ - timeout: 5000, - toMatchSnapshot: { - /** - * Increases the maximum allowed pixel difference to account - * for slight browser rendering inconsistencies. - */ - maxDiffPixelRatio: 0.02 - } + timeout: 5000 }, /* Fail the build on CI if you accidentally left test.only in the source code. */ forbidOnly: !!process.env.CI, diff --git a/src/components/icon/test/icon.e2e.ts b/src/components/icon/test/icon.e2e.ts index f92a2ebb..0588465d 100644 --- a/src/components/icon/test/icon.e2e.ts +++ b/src/components/icon/test/icon.e2e.ts @@ -8,7 +8,7 @@ test.describe('icon: basic', () => { // Wait for all SVGs to be lazily loaded before taking screenshots await page.waitForLoadState('networkidle'); - expect(await page.screenshot({ fullPage: true })).toMatchSnapshot(`icon-diff.png`); + await expect(page).toHaveScreenshot(`icon-diff.png`, { fullPage: true }); }); test('some icons should flip when rtl', async ({ page }) => { diff --git a/src/components/icon/test/icon.e2e.ts-snapshots/icon-diff-Mobile-Chrome-linux.png b/src/components/icon/test/icon.e2e.ts-snapshots/icon-diff-Mobile-Chrome-linux.png index ed1002be..adc216a0 100644 Binary files a/src/components/icon/test/icon.e2e.ts-snapshots/icon-diff-Mobile-Chrome-linux.png and b/src/components/icon/test/icon.e2e.ts-snapshots/icon-diff-Mobile-Chrome-linux.png differ diff --git a/src/components/icon/test/icon.e2e.ts-snapshots/icon-diff-Mobile-Safari-linux.png b/src/components/icon/test/icon.e2e.ts-snapshots/icon-diff-Mobile-Safari-linux.png index 140fe97b..67e510a0 100644 Binary files a/src/components/icon/test/icon.e2e.ts-snapshots/icon-diff-Mobile-Safari-linux.png and b/src/components/icon/test/icon.e2e.ts-snapshots/icon-diff-Mobile-Safari-linux.png differ diff --git a/src/components/test/dynamic-type/icon.e2e.ts b/src/components/test/dynamic-type/icon.e2e.ts index 5097720d..7613f75d 100644 --- a/src/components/test/dynamic-type/icon.e2e.ts +++ b/src/components/test/dynamic-type/icon.e2e.ts @@ -13,7 +13,7 @@ test.describe('icon: dynamic type', () => { const icons = page.locator('#icons'); - expect(await icons.screenshot()).toMatchSnapshot(`icon-dynamic-type-diff.png`); + await expect(icons).toHaveScreenshot(`icon-dynamic-type-diff.png`); }); }); diff --git a/src/components/test/dynamic-type/icon.e2e.ts-snapshots/icon-dynamic-type-diff-Mobile-Chrome-linux.png b/src/components/test/dynamic-type/icon.e2e.ts-snapshots/icon-dynamic-type-diff-Mobile-Chrome-linux.png index da8e93bc..fc6f8449 100644 Binary files a/src/components/test/dynamic-type/icon.e2e.ts-snapshots/icon-dynamic-type-diff-Mobile-Chrome-linux.png and b/src/components/test/dynamic-type/icon.e2e.ts-snapshots/icon-dynamic-type-diff-Mobile-Chrome-linux.png differ diff --git a/src/components/test/dynamic-type/icon.e2e.ts-snapshots/icon-dynamic-type-diff-Mobile-Safari-linux.png b/src/components/test/dynamic-type/icon.e2e.ts-snapshots/icon-dynamic-type-diff-Mobile-Safari-linux.png index 986c0f7c..6f4c2d83 100644 Binary files a/src/components/test/dynamic-type/icon.e2e.ts-snapshots/icon-dynamic-type-diff-Mobile-Safari-linux.png and b/src/components/test/dynamic-type/icon.e2e.ts-snapshots/icon-dynamic-type-diff-Mobile-Safari-linux.png differ