Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/playwright/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

set -e

# Source nvm so npx is available during feature installation
# (containerEnv PATH additions from the node feature don't apply to install scripts)
export NVM_DIR="${NVM_DIR:-/usr/local/share/nvm}"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

# Install Playwright browsers
# If _REMOTE_USER is set and not root, install as that user
# Otherwise install as root (test scenarios)
if [ -n "${_REMOTE_USER}" ] && [ "${_REMOTE_USER}" != "root" ] && id -u "${_REMOTE_USER}" > /dev/null 2>&1; then
su "${_REMOTE_USER}" -c "npx playwright install --with-deps ${BROWSERS}"
su "${_REMOTE_USER}" -c "export NVM_DIR=\"${NVM_DIR}\"; [ -s \"\$NVM_DIR/nvm.sh\" ] && . \"\$NVM_DIR/nvm.sh\"; npx playwright install --with-deps ${BROWSERS}"
else
npx playwright install --with-deps ${BROWSERS}
fi