Skip to content

Commit e65db12

Browse files
committed
test: cache split
1 parent 37bf5a8 commit e65db12

File tree

5 files changed

+12
-4
lines changed

5 files changed

+12
-4
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ node_modules
1717
/styles/*css
1818

1919
/test-results/
20-
/playwright-report/
20+
/playwright-report*
2121
/blob-report/
22-
/playwright/playwright/.cache/
22+
.cache*

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"test:watch": "jest --watchAll --maxWorkers=25%",
6060
"playwright": "playwright test --config=playwright/playwright.config.ts",
6161
"playwright:update": "npm run playwright -- -u",
62+
"playwright:clear-cache": "rm -rf ./playwright/.cache",
6263
"playwright:docker": "./scripts/playwright-docker.sh 'npm run playwright'",
6364
"playwright:docker:update": "./scripts/playwright-docker.sh 'npm run playwright:update'",
6465
"playwright:docker:clear-cache": "./scripts/playwright-docker.sh clear-cache",

playwright/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@
132132
- `npm run playwright:install` - install playwright browsers and dependencies
133133
- `npm run playwright` - run tests
134134
- `npm run playwright:update` - update screenshots
135+
- `npm run playwright:clear-cache` - clear cache vite
135136
- `npm run playwright:docker` - run tests using docker
136137
- `npm run playwright:docker:update` - update screenshots using docker
137-
- `npm run playwright:docker:clear-cache` - clear node_modules cache for docker container
138+
- `npm run playwright:docker:clear-cache` - clear node_modules cache for docker container and clear cache vite

playwright/playwright.config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ reporter.push(
1818
'html',
1919
{
2020
open: process.env.CI ? 'never' : 'on-failure',
21-
outputFolder: resolve(process.cwd(), 'playwright-report'),
21+
outputFolder: resolve(
22+
process.cwd(),
23+
process.env.IS_DOCKER ? 'playwright-report-docker' : 'playwright-report',
24+
),
2225
},
2326
],
2427
);
@@ -54,6 +57,7 @@ const config: PlaywrightTestConfig = {
5457
/* Port to use for Playwright component endpoint. */
5558
screenshot: 'only-on-failure',
5659
timezoneId: 'UTC',
60+
ctCacheDir: process.env.IS_DOCKER ? '.cache-docker' : '.cache',
5761
ctViteConfig: {
5862
publicDir: pathFromRoot('.storybook/public'),
5963
json: {

scripts/playwright-docker.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ run_command() {
1515
$CONTAINER_TOOL run --rm --network host -it -w /work \
1616
-v $(pwd):/work \
1717
-v "$NODE_MODULES_CACHE_DIR:/work/node_modules" \
18+
-e IS_DOCKER=1 \
1819
"$IMAGE_NAME:$IMAGE_TAG" \
1920
/bin/bash -c "$1"
2021
}
@@ -30,6 +31,7 @@ fi
3031

3132
if [[ "$1" = "clear-cache" ]]; then
3233
rm -rf "$NODE_MODULES_CACHE_DIR"
34+
rm -rf "./playwright/.cache-docker"
3335
exit 0
3436
fi
3537

0 commit comments

Comments
 (0)