Skip to content

Commit

Permalink
uploads Playwright html report for e2e Playwright tests (#1010)
Browse files Browse the repository at this point in the history
Co-authored-by: Marlon <[email protected]>
  • Loading branch information
jschuurk-kr and marlonbaeten authored Feb 11, 2025
1 parent bdef1f1 commit 0b2a427
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 7 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/build-lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,13 @@ jobs:
if: runner.os != 'Windows'
- name: Run e2e playwright tests
run: npm run test:e2e
- name: Upload Playwright report
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report-${{ matrix.os }}
path: frontend/playwright-report/
retention-days: 30

deploy:
name: Deploy to abacus-test.nl
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,12 @@ jobs:
path: ${{ matrix.target.binary }}

playwright-e2e:
name: Playwright e2e tests (${{ matrix.os }}, ${{ matrix.shardIndex }}/${{ matrix.shardTotal }})
name: Playwright e2e tests (${{ matrix.os }}
needs:
- build
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
shardIndex: [1, 2, 3]
shardTotal: [3]
runs-on: ${{ matrix.os }}
defaults:
run:
Expand All @@ -90,9 +88,16 @@ jobs:
run: chmod a+x ../builds/backend/abacus
if: runner.os != 'Windows'
- name: Run Playwright e2e tests
run: npm run test:e2e -- --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
run: npm run test:e2e
env:
BACKEND_BUILD: release
- name: Upload Playwright report
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report-release-${{ matrix.os }}
path: frontend/playwright-report/
retention-days: 30

release:
name: Release
Expand Down
1 change: 1 addition & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ test-results
coverage
mock
test-report.junit.xml
playwright-report/

# Automatically created: https://github.com/mswjs/msw/discussions/1015#discussioncomment-1747585
mockServiceWorker.js
3 changes: 3 additions & 0 deletions frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ npm run test:ladle
npm run test:e2e
# run tests, expect builds and database to be available:
npm run test:e2e-dev

# view reports and traces, e.g. the ones saved by our pipeline:
npx playwright show-report <path-to-unzipped-report-folder>
```

### UI Component development
Expand Down
5 changes: 2 additions & 3 deletions frontend/playwright.common.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ const commonConfig: PlaywrightTestConfig = defineConfig({
workers: process.env.CI ? "100%" : undefined,
// Increase the test timeout on CI, which is usually slower
timeout: process.env.CI ? 30_000 : 10_000,
// Use the list reporter even on CI, to get immediate feedback
reporter: "list",
fullyParallel: true,
use: {
trace: "retain-on-failure",
// Local runs don't have retries, so we have a trace of each failure. On CI we do have retries, so keeping the trace of the first failure allows us to investigate flaky tests.
trace: "retain-on-first-failure",
testIdAttribute: "id",
},
projects: [
Expand Down
1 change: 1 addition & 0 deletions frontend/playwright.e2e.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function returnWebserverCommand(): string {

const config: PlaywrightTestConfig = defineConfig({
...commonConfig,
reporter: process.env.CI ? [["list"], ["html", { open: "never" }]] : "list",
testDir: "./e2e-tests",
outputDir: "./test-results/e2e-tests",
testMatch: /\.e2e\.ts/,
Expand Down
2 changes: 2 additions & 0 deletions frontend/playwright.ladle.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import commonConfig from "./playwright.common.config";

const config: PlaywrightTestConfig = defineConfig({
...commonConfig,
// Use the list reporter even on CI, to get immediate feedback
reporter: "list",
testDir: "./lib/ui",
outputDir: "./test-results/ladle",
testMatch: /\.e2e\.ts/,
Expand Down

0 comments on commit 0b2a427

Please sign in to comment.