Skip to content

Commit

Permalink
Install playwright browser dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
gma committed Nov 5, 2024
1 parent b51c599 commit b409ae4
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/playwright/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "Playwright Test Dependencies",
"id": "playwright",
"version": "1.0.0",
"description": "Install Playwright's dependencies and cache installed browsers",
"keywords": ["playwright", "testing", "browser-testing"],
"options": {
"browsers": {
"type": "string",
"proposals": [
"chrome",
"chrome-beta",
"chromium",
"firefox",
"msedge",
"msedge-beta",
"msedge-dev",
"webkit"
],
"default": "chromium",
"description": "Browsers whose dependencies can be installed"
},
},
"installsAfter": [
"ghcr.io/devcontainers/features/node"
]
}
9 changes: 9 additions & 0 deletions src/playwright/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

set -e

echo "Installing dependencies for ${BROWSERS}"

su "${_CONTAINER_USER}" -c "npm install -g playwright"
su "${_CONTAINER_USER}" -c "npx playwright install-deps ${BROWSERS}"
su "${_CONTAINER_USER}" -c "npm uninstall -g playwright"
15 changes: 15 additions & 0 deletions test/playwright/chromium_dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set -e

source dev-container-features-test-lib

check "npm is available" command -v npm

DEPENDENCIES=(
libcairo2
libcups2
fonts-freefont-ttf
)

check "browser dependencies are installed" dpkg --no-pager -l "${DEPENDENCIES[@]}"
16 changes: 16 additions & 0 deletions test/playwright/firefox_dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

set -e

source dev-container-features-test-lib

check "npm is available" command -v npm


DEPENDENCIES=(
libcairo2
libxrender1
fonts-freefont-ttf
)

check "browser dependencies are installed" dpkg --no-pager -l "${DEPENDENCIES[@]}"
20 changes: 20 additions & 0 deletions test/playwright/scenarios.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"chromium_dependencies": {
"image": "debian:latest",
"features": {
"ghcr.io/devcontainers/features/node:1": {},
"playwright": {
"browsers": "chromium"
}
}
},
"firefox_dependencies": {
"image": "debian:latest",
"features": {
"ghcr.io/devcontainers/features/node:1": {},
"playwright": {
"browsers": "chromium"
}
}
}
}

0 comments on commit b409ae4

Please sign in to comment.