diff --git a/.gitignore b/.gitignore index 45875d046..2f0397a01 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,6 @@ node_modules .env .env.development /test-results/ -/playwright-report/ +playwright-report* /blob-report/ -/playwright/playwright/.cache/ +.cache* diff --git a/package.json b/package.json index 6410a41cb..7255d36d0 100644 --- a/package.json +++ b/package.json @@ -80,6 +80,7 @@ "test:watch": "jest --watchAll", "playwright": "playwright test --config=playwright/playwright.config.ts", "playwright:update": "npm run playwright -- -u", + "playwright:clear-cache": "rm -rf ./playwright/.cache", "playwright:docker": "./scripts/playwright-docker.sh 'npm run playwright'", "playwright:docker:update": "./scripts/playwright-docker.sh 'npm run playwright:update'", "playwright:docker:clear-cache": "./scripts/playwright-docker.sh clear-cache", diff --git a/playwright/README.md b/playwright/README.md index f968ca87c..4f5031f32 100644 --- a/playwright/README.md +++ b/playwright/README.md @@ -132,6 +132,7 @@ - `npm run playwright:install` - install playwright browsers and dependencies - `npm run playwright` - run tests - `npm run playwright:update` - update screenshots +- `npm run playwright:clear-cache` - clear cache vite - `npm run playwright:docker` - run tests using docker - `npm run playwright:docker:update` - update screenshots using docker -- `npm run playwright:docker:clear-cache` - clear node_modules cache for docker container +- `npm run playwright:docker:clear-cache` - clear node_modules cache for docker container and clear cache vite diff --git a/playwright/playwright.config.ts b/playwright/playwright.config.ts index 72afed40c..a8e7c7f6f 100644 --- a/playwright/playwright.config.ts +++ b/playwright/playwright.config.ts @@ -18,7 +18,10 @@ reporter.push( 'html', { open: process.env.CI ? 'never' : 'on-failure', - outputFolder: resolve(process.cwd(), 'playwright-report'), + outputFolder: resolve( + process.cwd(), + process.env.IS_DOCKER ? 'playwright-report-docker' : 'playwright-report', + ), }, ], ); @@ -54,6 +57,7 @@ const config: PlaywrightTestConfig = { /* Port to use for Playwright component endpoint. */ screenshot: 'only-on-failure', timezoneId: 'UTC', + ctCacheDir: process.env.IS_DOCKER ? '.cache-docker' : '.cache', ctViteConfig: { publicDir: pathFromRoot('.storybook/public'), json: { diff --git a/scripts/playwright-docker.sh b/scripts/playwright-docker.sh index ec48bbf02..9e50c0cc8 100755 --- a/scripts/playwright-docker.sh +++ b/scripts/playwright-docker.sh @@ -15,6 +15,7 @@ run_command() { $CONTAINER_TOOL run --rm --network host -it -w /work \ -v $(pwd):/work \ -v "$NODE_MODULES_CACHE_DIR:/work/node_modules" \ + -e IS_DOCKER=1 \ "$IMAGE_NAME:$IMAGE_TAG" \ /bin/bash -c "$1" } @@ -30,6 +31,7 @@ fi if [[ "$1" = "clear-cache" ]]; then rm -rf "$NODE_MODULES_CACHE_DIR" + rm -rf "./playwright/.cache-docker" exit 0 fi diff --git a/src/blocks/Map/__snapshots__/Map.visual.test.tsx-snapshots/Map-render-stories-Default-light-chromium-linux.png b/src/blocks/Map/__snapshots__/Map.visual.test.tsx-snapshots/Map-render-stories-Default-light-chromium-linux.png index c04cfaf9d..15e8423c2 100644 Binary files a/src/blocks/Map/__snapshots__/Map.visual.test.tsx-snapshots/Map-render-stories-Default-light-chromium-linux.png and b/src/blocks/Map/__snapshots__/Map.visual.test.tsx-snapshots/Map-render-stories-Default-light-chromium-linux.png differ diff --git a/src/blocks/Map/__snapshots__/Map.visual.test.tsx-snapshots/Map-render-stories-Default-light-webkit-linux.png b/src/blocks/Map/__snapshots__/Map.visual.test.tsx-snapshots/Map-render-stories-Default-light-webkit-linux.png index 1f9a78442..aa84d6ecb 100644 Binary files a/src/blocks/Map/__snapshots__/Map.visual.test.tsx-snapshots/Map-render-stories-Default-light-webkit-linux.png and b/src/blocks/Map/__snapshots__/Map.visual.test.tsx-snapshots/Map-render-stories-Default-light-webkit-linux.png differ diff --git a/src/blocks/Map/__snapshots__/Map.visual.test.tsx-snapshots/Map-render-stories-Direction-light-chromium-linux.png b/src/blocks/Map/__snapshots__/Map.visual.test.tsx-snapshots/Map-render-stories-Direction-light-chromium-linux.png index 1d0396406..ea96bf0cb 100644 Binary files a/src/blocks/Map/__snapshots__/Map.visual.test.tsx-snapshots/Map-render-stories-Direction-light-chromium-linux.png and b/src/blocks/Map/__snapshots__/Map.visual.test.tsx-snapshots/Map-render-stories-Direction-light-chromium-linux.png differ diff --git a/src/blocks/Map/__snapshots__/Map.visual.test.tsx-snapshots/Map-render-stories-Direction-light-webkit-linux.png b/src/blocks/Map/__snapshots__/Map.visual.test.tsx-snapshots/Map-render-stories-Direction-light-webkit-linux.png index d2ec8bae7..7f0e11134 100644 Binary files a/src/blocks/Map/__snapshots__/Map.visual.test.tsx-snapshots/Map-render-stories-Direction-light-webkit-linux.png and b/src/blocks/Map/__snapshots__/Map.visual.test.tsx-snapshots/Map-render-stories-Direction-light-webkit-linux.png differ diff --git a/src/blocks/Map/__snapshots__/Map.visual.test.tsx-snapshots/Map-render-stories-MapsTypes-light-chromium-linux.png b/src/blocks/Map/__snapshots__/Map.visual.test.tsx-snapshots/Map-render-stories-MapsTypes-light-chromium-linux.png index 9bd52dc9d..0c92e6ec3 100644 Binary files a/src/blocks/Map/__snapshots__/Map.visual.test.tsx-snapshots/Map-render-stories-MapsTypes-light-chromium-linux.png and b/src/blocks/Map/__snapshots__/Map.visual.test.tsx-snapshots/Map-render-stories-MapsTypes-light-chromium-linux.png differ diff --git a/src/blocks/Map/__snapshots__/Map.visual.test.tsx-snapshots/Map-render-stories-MapsTypes-light-webkit-linux.png b/src/blocks/Map/__snapshots__/Map.visual.test.tsx-snapshots/Map-render-stories-MapsTypes-light-webkit-linux.png index dcdb960de..fa301661c 100644 Binary files a/src/blocks/Map/__snapshots__/Map.visual.test.tsx-snapshots/Map-render-stories-MapsTypes-light-webkit-linux.png and b/src/blocks/Map/__snapshots__/Map.visual.test.tsx-snapshots/Map-render-stories-MapsTypes-light-webkit-linux.png differ diff --git a/src/blocks/Map/__snapshots__/Map.visual.test.tsx-snapshots/Map-render-stories-Size-light-chromium-linux.png b/src/blocks/Map/__snapshots__/Map.visual.test.tsx-snapshots/Map-render-stories-Size-light-chromium-linux.png index 0e85c8437..3ee8409b6 100644 Binary files a/src/blocks/Map/__snapshots__/Map.visual.test.tsx-snapshots/Map-render-stories-Size-light-chromium-linux.png and b/src/blocks/Map/__snapshots__/Map.visual.test.tsx-snapshots/Map-render-stories-Size-light-chromium-linux.png differ diff --git a/src/blocks/Map/__snapshots__/Map.visual.test.tsx-snapshots/Map-render-stories-Size-light-webkit-linux.png b/src/blocks/Map/__snapshots__/Map.visual.test.tsx-snapshots/Map-render-stories-Size-light-webkit-linux.png index 50f2ddda8..db8df2a60 100644 Binary files a/src/blocks/Map/__snapshots__/Map.visual.test.tsx-snapshots/Map-render-stories-Size-light-webkit-linux.png and b/src/blocks/Map/__snapshots__/Map.visual.test.tsx-snapshots/Map-render-stories-Size-light-webkit-linux.png differ diff --git a/src/blocks/Map/__tests__/Map.visual.test.tsx b/src/blocks/Map/__tests__/Map.visual.test.tsx index e33ee0cee..1b2bf8281 100644 --- a/src/blocks/Map/__tests__/Map.visual.test.tsx +++ b/src/blocks/Map/__tests__/Map.visual.test.tsx @@ -4,30 +4,28 @@ import {test} from '../../../../playwright/core/index'; import {Default, Direction, MapsTypes, Size} from './helpers'; -const DEFAULT_MAP_DELAY = 20 * 1000; - test.describe('Map', () => { - test.skip('render stories ', async ({mount, expectScreenshot, delay}) => { + test('render stories ', async ({mount, expectScreenshot, page}) => { await mount(); - await delay(DEFAULT_MAP_DELAY); - await expectScreenshot({skipTheme: 'dark'}); + + await expectScreenshot({skipTheme: 'dark', mask: [page.locator('.pc-map')]}); }); - test.skip('render stories ', async ({mount, expectScreenshot, delay}) => { + test('render stories ', async ({mount, expectScreenshot, page}) => { await mount(); - await delay(DEFAULT_MAP_DELAY); - await expectScreenshot({skipTheme: 'dark'}); + + await expectScreenshot({skipTheme: 'dark', mask: [page.locator('.pc-map')]}); }); - test.skip('render stories ', async ({mount, expectScreenshot, delay}) => { + test('render stories ', async ({mount, expectScreenshot, page}) => { await mount(); - await delay(DEFAULT_MAP_DELAY); - await expectScreenshot({skipTheme: 'dark'}); + + await expectScreenshot({skipTheme: 'dark', mask: [page.locator('.pc-map')]}); }); - test.skip('render stories ', async ({mount, expectScreenshot, delay}) => { + test('render stories ', async ({mount, expectScreenshot, page}) => { await mount(); - await delay(DEFAULT_MAP_DELAY); - await expectScreenshot({skipTheme: 'dark'}); + + await expectScreenshot({skipTheme: 'dark', mask: [page.locator('.pc-map')]}); }); });