From 1615d9170a621a70dbf52d1586a92d14128ff49a Mon Sep 17 00:00:00 2001 From: Volodymyr Kolesnykov Date: Thu, 8 Aug 2024 23:07:41 +0300 Subject: [PATCH] feat(playwright): allow for specifying Playwright version --- features/src/playwright/NOTES.md | 3 +++ features/src/playwright/devcontainer-feature.json | 8 +++++++- features/src/playwright/install.sh | 3 ++- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 features/src/playwright/NOTES.md diff --git a/features/src/playwright/NOTES.md b/features/src/playwright/NOTES.md new file mode 100644 index 00000000..ebd11df6 --- /dev/null +++ b/features/src/playwright/NOTES.md @@ -0,0 +1,3 @@ +This feature is available only for Debian-based containers. + +Alpine-based containers are **not** supported because the browsers used by Playwright are built against `libs`, not `musl`. diff --git a/features/src/playwright/devcontainer-feature.json b/features/src/playwright/devcontainer-feature.json index 25b822d2..8a022764 100644 --- a/features/src/playwright/devcontainer-feature.json +++ b/features/src/playwright/devcontainer-feature.json @@ -2,12 +2,18 @@ "id": "playwright", "name": "Playwright", "description": "Sets up Playwright into the Dev Environment", - "version": "1.0.0", + "documentationURL": "https://github.com/Automattic/vip-codespaces/tree/trunk/features/src/playwright", + "version": "1.1.0", "options": { "enabled": { "type": "boolean", "default": true, "description": "Enable Playwright" + }, + "version": { + "type": "string", + "default": "latest", + "description": "Playwright version to install" } } } diff --git a/features/src/playwright/install.sh b/features/src/playwright/install.sh index 42693c3f..d4620ffd 100755 --- a/features/src/playwright/install.sh +++ b/features/src/playwright/install.sh @@ -11,6 +11,7 @@ fi : "${_REMOTE_USER:?"_REMOTE_USER is required"}" : "${ENABLED:=}" +PLAYWRIGHT_VERSION="${VERSION:=latest}" if [ "${ENABLED}" = "true" ]; then echo '(*) Installing Playwright...' @@ -47,7 +48,7 @@ if [ "${ENABLED}" = "true" ]; then apt-get install -y nodejs fi - npm i -g playwright-core + npm i -g "playwright-core@${PLAYWRIGHT_VERSION}" playwright-core install-deps su -s /bin/sh -c 'playwright-core install' "${_REMOTE_USER}"