Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing Playwright tests / CI #1433

Merged
merged 12 commits into from
Jul 16, 2024
9 changes: 8 additions & 1 deletion .github/actions/browser-tests-playwright/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,11 @@ runs:
uses: ./.github/actions/setup-playwright
- name: run tests
shell: bash
run: npx playwright test e2e/*
run: npx playwright test --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} e2e/*
- name: Upload blob report to GitHub Actions Artifacts
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: blob-report-${{ matrix.shardIndex }}
loganmcdonald-noaa marked this conversation as resolved.
Show resolved Hide resolved
path: ${{ defaults.run.working-directory }}
retention-days: 1
45 changes: 44 additions & 1 deletion .github/workflows/code-standards.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,11 @@ jobs:
name: playwright end to end tests
runs-on: ubuntu-latest
needs: [populate-database, should-test]

strategy:
fail-fast: false
matrix:
shardIndex: [1, 2, 3, 4]
shardTotal: [4]
steps:
- name: checkout
if: needs.should-test.outputs.yes == 'true'
Expand All @@ -207,6 +211,45 @@ jobs:
if: needs.should-test.outputs.yes == 'true'
uses: ./.github/actions/browser-tests-playwright

merge-reports:
# Merge reports after playwright-tests, even if some shards have failed
if: ${{ !cancelled() }}
needs: [new-end-to-end-tests]

runs-on: ubuntu-latest
steps:
- uses: browser-actions/setup-chrome@v1
- uses: browser-actions/setup-edge@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- name: install dependencies
shell: bash
run: npm ci
- name: install browsers
shell: bash
run: npx playwright install --with-deps
- name: Install dependencies
run: npm ci

- 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

end-to-end-tests:
name: end-to-end tests
runs-on: ubuntu-latest
Expand Down
2 changes: 0 additions & 2 deletions playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ const config = {
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: process.env.CI ? "github" : "line",
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
Expand Down
Loading