Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore(docker): upgrade to NPM 7 (#8915)

Max Schmitt5b93df0babfa
diff --git a/.github/workflows/tests_docker.yml b/.github/workflows/tests_docker.yml
index 1e349a4158..a526eab381 100644
--- a/.github/workflows/tests_docker.yml
+++ b/.github/workflows/tests_docker.yml
@@ -7,13 +7,13 @@ on:
- release-*
paths:
- '.github/workflows/tests_docker.yml'
- - '**/Dockerfile'
+ - '**/Dockerfile*'
- 'browsers.json'
- 'package.json'
pull_request:
paths:
- '.github/workflows/tests_docker.yml'
- - '**/Dockerfile'
+ - '**/Dockerfile*'
- 'browsers.json'
- 'package.json'
branches:
@@ -47,16 +47,19 @@ jobs:
run: |
npm run clean
rm -rf node_modules/
- # The whole folder has to be world-writable to avoid UID conflicts between this mount and docker.
- chmod -R 777 .
+ if [[ ${{ matrix.user }} == 'root' ]]; then
+ sudo chown -R 0 $(pwd)
+ else
+ sudo chown -R 1000 $(pwd)
+ fi
- name: Launch container
- run: docker run --rm -v $(pwd):/tmp/playwright --name playwright-docker-${{matrix.tag}}-test -d -t playwright:localbuild-${{ matrix.tag }} /bin/bash
+ run: docker run --rm --user=${{ matrix.user }} -v $(pwd):/tmp/playwright --workdir /tmp/playwright/ --name playwright-docker-${{ matrix.tag }}-test -d -t playwright:localbuild-${{ matrix.tag }} /bin/bash
- name: Run "npm ci" inside docker
- run: docker exec --workdir /tmp/playwright/ --user=${{ matrix.user }} playwright-docker-${{matrix.tag}}-test npm ci
+ run: docker exec playwright-docker-${{ matrix.tag }}-test npm ci
- name: Run "npm run build" inside docker
- run: docker exec --workdir /tmp/playwright/ --user=${{ matrix.user }} playwright-docker-${{matrix.tag}}-test npm run build
+ run: docker exec playwright-docker-${{ matrix.tag }}-test npm run build
- name: Run "npm run test" inside docker
- run: docker exec --workdir /tmp/playwright/ --user=${{ matrix.user }} -e INSIDE_DOCKER=1 -e CI=1 playwright-docker-${{matrix.tag}}-test xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" npm run test
+ run: docker exec -e INSIDE_DOCKER=1 -e CI=1 playwright-docker-${{ matrix.tag }}-test xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" npm run test
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
if: always()
- uses: actions/upload-artifact@v1
diff --git a/utils/docker/Dockerfile.bionic b/utils/docker/Dockerfile.bionic
index b83d1d9aed..5333c50f68 100644
--- a/utils/docker/Dockerfile.bionic
+++ b/utils/docker/Dockerfile.bionic
@@ -7,6 +7,9 @@ RUN apt-get update && apt-get install -y curl && \
curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
apt-get install -y nodejs
+# Upgrade to NPM7 (see https://github.com/microsoft/playwright/pull/8915)
+RUN npm install -g npm@7
+
# Feature-parity with node.js base images.
RUN apt-get update && apt-get install -y --no-install-recommends git ssh && \
npm install -g yarn
diff --git a/utils/docker/Dockerfile.focal b/utils/docker/Dockerfile.focal
index 0670490481..5a83f54a30 100644
--- a/utils/docker/Dockerfile.focal
+++ b/utils/docker/Dockerfile.focal
@@ -7,6 +7,9 @@ RUN apt-get update && apt-get install -y curl && \
curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
apt-get install -y nodejs
+# Upgrade to NPM7 (see https://github.com/microsoft/playwright/pull/8915)
+RUN npm install -g npm@7
+
# Feature-parity with node.js base images.
RUN apt-get update && apt-get install -y --no-install-recommends git ssh && \
npm install -g yarn