diff --git a/src/playwright/devcontainer-feature.json b/src/playwright/devcontainer-feature.json index 8b6c238..7896e00 100644 --- a/src/playwright/devcontainer-feature.json +++ b/src/playwright/devcontainer-feature.json @@ -4,6 +4,14 @@ "version": "1.0.0", "description": "Install Playwright's dependencies and cache installed browsers", "keywords": ["playwright", "testing", "browser-testing"], + "containerEnv": { + "PLAYWRIGHT_BROWSERS_PATH": "/playwright/browsers" + }, + "mounts": [{ + "source": "playwright-browsers", + "target": "/playwright/browsers", + "type": "volume" + }], "options": { "browsers": { "type": "string", diff --git a/test/playwright/browser_volume.sh b/test/playwright/browser_volume.sh new file mode 100644 index 0000000..64b55f8 --- /dev/null +++ b/test/playwright/browser_volume.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e + +source dev-container-features-test-lib + +CACHE_DIR="/playwright/browsers" + +check "playwright-browsers volume is mounted" test -d "$CACHE_DIR" + +check "PLAYWRIGHT_BROWSERS_PATH is set" env | grep "PLAYWRIGHT_BROWSERS_PATH=$CACHE_DIR" diff --git a/test/playwright/scenarios.json b/test/playwright/scenarios.json index 033905e..e340b98 100644 --- a/test/playwright/scenarios.json +++ b/test/playwright/scenarios.json @@ -1,4 +1,11 @@ { + "browser_volume": { + "image": "debian:latest", + "features": { + "ghcr.io/devcontainers/features/node:1": {}, + "playwright": {} + } + }, "chromium_dependencies": { "image": "debian:latest", "features": {