@@ -80,21 +80,20 @@ jobs:
8080 run : vp install
8181
8282 # No preview server: Vitest Browser Mode serves the tests + mounted example
83- # apps itself. `--browser` selects this matrix shard's browser.
83+ # apps itself. `--browser` selects this matrix shard's browser. Each shard
84+ # records a machine-readable `blob` report; the `merge-reports` job stitches
85+ # all three browsers' blobs into one HTML report afterwards.
8486 - name : Run e2e tests (${{ matrix.browser }})
85- run : HOME=/root vp test -c vite.config.browser.ts --run --browser ${{ matrix.browser }}
87+ run : HOME=/root vp test -c vite.config.browser.ts --run --browser ${{ matrix.browser }} --reporter=default --reporter=blob --outputFile.blob=blob-report/blob-${{ matrix.browser }}.json
8688 working-directory : tests
8789
88- # Navigable HTML report (the `html` reporter writes it here — same as the
89- # local `e2e:report` script serves). Uploaded whether the tests pass or
90- # fail so the run is always inspectable.
91- - name : Upload e2e report (${{ matrix.browser }})
90+ - name : Upload blob report (${{ matrix.browser }})
9291 uses : actions/upload-artifact@v7
9392 if : ${{ !cancelled() }}
9493 with :
95- name : e2e -report-${{ matrix.browser }}
96- path : tests/playwright -report/
97- retention-days : 7
94+ name : blob -report-${{ matrix.browser }}
95+ path : tests/blob -report/
96+ retention-days : 1
9897
9998 - name : Upload failure artifacts
10099 uses : actions/upload-artifact@v7
@@ -103,3 +102,88 @@ jobs:
103102 name : e2e-attachments-${{ matrix.browser }}
104103 path : tests/.vitest-attachments/
105104 retention-days : 7
105+
106+ merge-reports :
107+ # Stitch the three per-browser blob reports into a single navigable HTML
108+ # report (the Vitest equivalent of `playwright merge-reports`). Runs even
109+ # when a browser shard failed, so the report always covers every browser.
110+ name : " E2E Report"
111+ runs-on : ubuntu-latest
112+ needs : e2e
113+ if : ${{ !cancelled() }}
114+ timeout-minutes : 15
115+ # Same container as the e2e shards: `--mergeReports` doesn't run tests or
116+ # launch browsers, but the HTML reporter still resolves the test files'
117+ # browser environment, so the browser config must stay enabled (and present).
118+ container :
119+ image : mcr.microsoft.com/playwright:v1.51.1-noble
120+ steps :
121+ - uses : actions/checkout@v6
122+ with :
123+ fetch-depth : 100
124+
125+ - uses : voidzero-dev/setup-vp@v1
126+ with :
127+ node-version-file : " .node-version"
128+ cache : true
129+
130+ - name : Install dependencies
131+ run : vp install
132+
133+ # Gather every shard's blob into one directory (blob-report-chromium, …).
134+ - name : Download blob reports
135+ uses : actions/download-artifact@v8
136+ with :
137+ path : tests/blob-report
138+ pattern : blob-report-*
139+ merge-multiple : true
140+
141+ # Re-emit a single HTML report from the merged blobs (no tests are run).
142+ - name : Merge into HTML report
143+ run : HOME=/root vp test -c vite.config.browser.ts --mergeReports=blob-report --reporter=html
144+ working-directory : tests
145+
146+ - name : Upload merged HTML report
147+ uses : actions/upload-artifact@v7
148+ if : ${{ !cancelled() }}
149+ with :
150+ name : e2e-report
151+ path : tests/playwright-report/
152+ retention-days : 7
153+
154+ deploy-report :
155+ # Publish the merged report to a GitHub Pages PR preview and comment the
156+ # link on the PR (Vercel-style). Pages serves it over HTTP, so the report's
157+ # data loads correctly — unlike opening the downloaded artifact over file://
158+ # (the @vitest/ui report fetches its data and is blocked by CORS there).
159+ #
160+ # Default `needs` semantics: this runs only when `merge-reports` succeeded
161+ # (i.e. a report exists) — but regardless of whether the tests passed, so a
162+ # red run still gets a navigable preview. Skipped for fork PRs, whose
163+ # read-only token can't push to gh-pages or comment (they keep the artifact).
164+ name : " E2E Report Preview"
165+ runs-on : ubuntu-latest
166+ needs : merge-reports
167+ if : ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository }}
168+ permissions :
169+ contents : write
170+ pull-requests : write
171+ steps :
172+ - uses : actions/checkout@v6
173+
174+ - name : Download merged report
175+ uses : actions/download-artifact@v8
176+ with :
177+ name : e2e-report
178+ path : e2e-report
179+
180+ # Deploys to the `gh-pages` branch under `pr-preview/pr-<N>/` and posts a
181+ # sticky comment with the URL. The companion `pr-preview-cleanup` workflow
182+ # removes it when the PR closes.
183+ - name : Deploy report to PR preview
184+ uses : rossjrw/pr-preview-action@v1
185+ with :
186+ source-dir : e2e-report
187+ preview-branch : gh-pages
188+ umbrella-dir : pr-preview
189+ action : deploy
0 commit comments