chore(deps): update dependency @playwright/test to v1.56.1 #1785
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Playwright Tests | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| setup-and-build: | |
| timeout-minutes: 15 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Node.js with Caching | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: lts/* | |
| cache: "yarn" | |
| - name: Install node dependencies | |
| # This will be fast on subsequent runs due to caching | |
| run: yarn --frozen-lockfile | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Create and Switch to Buildx Builder | |
| run: | | |
| docker buildx create --use --name mybuilder | |
| - name: Log in to GitHub Container Registry | |
| # You need to log in because the cache needs to be written to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build image and save as artifact (using ghcr for layered caching) | |
| # Build the application image once | |
| run: | | |
| CACHE_TAG=ghcr.io/${{ github.repository }}/playwright-cache:latest | |
| DOCKER_BUILDKIT=1 docker buildx build \ | |
| --output type=docker,name=websites-content-system:latest,dest=app-image.tar \ | |
| --cache-from type=registry,ref=$CACHE_TAG \ | |
| --cache-to type=registry,ref=$CACHE_TAG,mode=max \ | |
| . | |
| - name: Upload application image artifact | |
| # The artifact is downloaded and loaded by the test jobs | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: app-image | |
| path: app-image.tar | |
| retention-days: 1 | |
| run-playwright: | |
| needs: [setup-and-build] | |
| timeout-minutes: 60 | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| shardIndex: [1, 2, 3, 4] | |
| shardTotal: [4] | |
| services: | |
| redis: | |
| image: redis | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 6379:6379 | |
| postgres: | |
| image: postgres:latest | |
| env: | |
| POSTGRES_PASSWORD: postgres | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd "pg_isready -d postgres" | |
| --health-interval 1s | |
| --health-timeout 3s | |
| --health-retries 10 | |
| --health-start-period 80s | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download application image artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: app-image | |
| path: /tmp/ | |
| - name: Load application image | |
| run: docker load -i /tmp/app-image.tar | |
| - name: Set up Node.js with Cache restore | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: lts/* | |
| cache: "yarn" | |
| - name: Restore and Prepare Dependencies | |
| run: yarn --frozen-lockfile | |
| - name: Run image | |
| env: | |
| DISABLE_SSO: True | |
| SECRET_KEY: secret_key | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| REPO_ORG: https://github.com/canonical | |
| DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres | |
| GOOGLE_PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} | |
| GOOGLE_PRIVATE_KEY_ID: ${{ secrets.PRIVATE_KEY_ID }} | |
| JIRA_EMAIL: ${{ secrets.JIRA_EMAIL }} | |
| JIRA_TOKEN: ${{ secrets.JIRA_TOKEN }} | |
| JIRA_URL: https://warthogs.atlassian.net | |
| JIRA_LABELS: somelabel | |
| JIRA_COPY_UPDATES_EPIC: WD-12643 | |
| GOOGLE_DRIVE_FOLDER_ID: ${{ secrets.GOOGLE_DRIVE_FOLDER_ID }} | |
| COPYDOC_TEMPLATE_ID: ${{ secrets.COPYDOC_TEMPLATE_ID }} | |
| JIRA_REPORTER_ID: ${{ secrets.JIRA_REPORTER_ID }} | |
| run: | | |
| docker run \ | |
| -p 8104:8104 \ | |
| -e SECRET_KEY="$SECRET_KEY" \ | |
| -e REDIS_HOST=localhost \ | |
| -e REDIS_PORT=6379 \ | |
| -e GH_TOKEN="$GH_TOKEN" \ | |
| -e REPO_ORG="$REPO_ORG" \ | |
| -e DATABASE_URL="$DATABASE_URL" \ | |
| -e GOOGLE_PRIVATE_KEY="$GOOGLE_PRIVATE_KEY" \ | |
| -e GOOGLE_PRIVATE_KEY_ID="$GOOGLE_PRIVATE_KEY_ID" \ | |
| -e JIRA_EMAIL="$JIRA_EMAIL" \ | |
| -e JIRA_TOKEN="$JIRA_TOKEN" \ | |
| -e JIRA_URL="$JIRA_URL" \ | |
| -e JIRA_LABELS="$JIRA_LABELS" \ | |
| -e JIRA_COPY_UPDATES_EPIC="$JIRA_COPY_UPDATES_EPIC" \ | |
| -e GOOGLE_DRIVE_FOLDER_ID="$GOOGLE_DRIVE_FOLDER_ID" \ | |
| -e COPYDOC_TEMPLATE_ID="$COPYDOC_TEMPLATE_ID" \ | |
| -e JIRA_REPORTER_ID="$JIRA_REPORTER_ID" \ | |
| -e DISABLE_SSO="$DISABLE_SSO" \ | |
| -e FLASK_DEBUG=1 \ | |
| --network host \ | |
| websites-content-system & sleep 3 | |
| curl --head --fail --retry-delay 1 --retry 50 --retry-connrefused http://localhost | |
| - name: Run playwright image | |
| run: docker run -d --add-host=hostmachine:host-gateway -p 3000:3000 --init --workdir /home/pwuser --user pwuser mcr.microsoft.com/playwright:v1.50.1-noble /bin/sh -c "npx -y playwright@1.50.1 run-server --port 3000 --host 0.0.0.0" & sleep 60 | |
| - name: Run Playwright tests | |
| env: | |
| JIRA_REPORTER_ID: ${{ secrets.JIRA_REPORTER_ID }} | |
| run: | | |
| PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:3000/ JIRA_REPORTER_ID="$JIRA_REPORTER_ID" BASE_URL=http://hostmachine PORT=80 yarn playwright test --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --reporter=blob | |
| - name: Upload blob report to GitHub Actions Artifacts | |
| if: ${{ !cancelled() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: blob-report-${{ matrix.shardIndex }} | |
| path: blob-report | |
| retention-days: 1 | |
| merge-reports: | |
| # Merge reports after playwright-tests, even if some shards have failed | |
| if: ${{ !cancelled() }} | |
| needs: [run-playwright] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: lts/* | |
| cache: "yarn" | |
| - name: Install dependencies | |
| run: yarn --frozen-lockfile | |
| - name: Download blob reports from GitHub Actions Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: all-blob-reports | |
| pattern: blob-report-* | |
| merge-multiple: true | |
| - name: Merge into HTML Report | |
| run: npx playwright merge-reports --reporter html ./all-blob-reports | |
| - name: Upload HTML report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: html-report--attempt-${{ github.run_attempt }} | |
| path: playwright-report | |
| retention-days: 14 |