1818 runs-on : ubuntu-latest
1919 timeout-minutes : 60
2020 steps :
21- - uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
21+ - uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
2222 with :
2323 fetch-depth : 100
2424 persist-credentials : false
@@ -54,51 +54,26 @@ jobs:
5454 id : soft-release
5555 run : vp dlx pkg-pr-new publish './packages/*' # TODO disabled only for AI branch--compact
5656
57- playwright-build :
58- name : " Playwright Build"
57+ e2e :
58+ # Vitest Browser Mode runs in the Playwright Linux container — the same
59+ # environment as the local Docker run — so behaviour matches local dev.
60+ # The suite resolves every `@blocknote/*` import to its `src/` via the
61+ # aliases in `tests/vite.config.browser.ts` (vite transpiles the package
62+ # sources on the fly), so the packages do NOT need to be built to `dist`
63+ # first — `vp install` + the checked-out sources are enough.
64+ name : " E2E - ${{ matrix.browser }} (${{ matrix.shardIndex }}/${{ matrix.shardTotal }})"
5965 runs-on : ubuntu-latest
6066 timeout-minutes : 30
61- steps :
62- - uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
63- with :
64- fetch-depth : 100
65- persist-credentials : false
66-
67- - uses : voidzero-dev/setup-vp@2dec1e33f4ab2c6d5bce1b0c4607961bb1a3f7a1 # v1
68- with :
69- node-version-file : " .node-version"
70- cache : true
71-
72- - name : Install dependencies
73- run : vp install
74-
75- - name : Build packages
76- run : vp run -r build
77-
78- - name : Upload build artifacts
79- uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
80- with :
81- name : playwright-build
82- path : |
83- packages/*/dist
84- playground/dist
85- retention-days : 1
86-
87- playwright :
88- name : " Playwright Tests - ${{ matrix.browser }} (${{ matrix.shardIndex }}/${{ matrix.shardTotal }})"
89- runs-on : ubuntu-latest
90- needs : playwright-build
91- timeout-minutes : 30
9267 container :
93- image : mcr.microsoft.com/playwright:v1.51.1 -noble
68+ image : mcr.microsoft.com/playwright:v1.60.0 -noble
9469 strategy :
9570 fail-fast : false
9671 matrix :
9772 browser : [chromium, firefox, webkit]
9873 shardIndex : [1, 2]
9974 shardTotal : [2]
10075 steps :
101- - uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
76+ - uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
10277 with :
10378 fetch-depth : 100
10479 persist-credentials : false
@@ -108,44 +83,53 @@ jobs:
10883 node-version-file : " .node-version"
10984 cache : true
11085
111- - name : Download build artifacts
112- uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
113- with :
114- name : playwright-build
115-
11686 - name : Install dependencies
11787 run : vp install
11888
119- - name : Run server and Playwright tests
120- run : |
121- HOME=/root vp exec concurrently --success=first -r --kill-others \
122- "vp run --filter @blocknote/example-editor preview" \
123- "wait-on http://localhost:3000 && cd tests && vp exec playwright test --project ${{ matrix.browser }} --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}"
89+ # No preview server: Vitest Browser Mode serves the tests + mounted example
90+ # apps itself. `--browser` selects this matrix job's browser and
91+ # `--shard=<index>/<total>` splits that browser's test files across two
92+ # parallel machines. Each shard records a machine-readable `blob` report
93+ # (named per browser+shard so they don't collide); the `merge-reports` job
94+ # stitches every browser's shards into one HTML report afterwards.
95+ - name : Run e2e tests (${{ matrix.browser }} ${{ matrix.shardIndex }}/${{ matrix.shardTotal }})
96+ run : HOME=/root vp test -c vite.config.browser.ts --run --browser ${{ matrix.browser }} --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --reporter=default --reporter=blob --outputFile.blob=blob-report/blob-${{ matrix.browser }}-${{ matrix.shardIndex }}.json
97+ working-directory : tests
12498
125- - name : Upload blob report
99+ - name : Upload blob report (${{ matrix.browser }} ${{ matrix.shardIndex }}/${{ matrix.shardTotal }})
126100 uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
127101 if : ${{ !cancelled() }}
128102 with :
129103 name : blob-report-${{ matrix.browser }}-${{ matrix.shardIndex }}
130104 path : tests/blob-report/
131105 retention-days : 1
132106
133- - name : Upload HTML report
107+ - name : Upload failure artifacts
134108 uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
135- if : ${{ !cancelled () }}
109+ if : ${{ failure () }}
136110 with :
137- name : playwright-report -${{ matrix.browser }}-${{ matrix.shardIndex }}
138- path : tests/playwright-report /
139- retention-days : 30
111+ name : e2e-attachments -${{ matrix.browser }}-${{ matrix.shardIndex }}
112+ path : tests/.vitest-attachments /
113+ retention-days : 7
140114
141115 merge-reports :
142- name : " Merge Playwright Reports"
143- if : ${{ !cancelled() }}
144- needs : playwright
116+ # Stitch every browser+shard blob report into a single navigable HTML
117+ # report (the Vitest equivalent of `playwright merge-reports`). Runs even
118+ # when a shard failed, so the report always covers every browser.
119+ name : " E2E Report"
145120 runs-on : ubuntu-latest
121+ needs : e2e
122+ if : ${{ !cancelled() }}
123+ timeout-minutes : 15
124+ # Same container as the e2e shards: `--mergeReports` doesn't run tests or
125+ # launch browsers, but the HTML reporter still resolves the test files'
126+ # browser environment, so the browser config must stay enabled (and present).
127+ container :
128+ image : mcr.microsoft.com/playwright:v1.60.0-noble
146129 steps :
147- - uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
130+ - uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
148131 with :
132+ fetch-depth : 100
149133 persist-credentials : false
150134
151135 - uses : voidzero-dev/setup-vp@2dec1e33f4ab2c6d5bce1b0c4607961bb1a3f7a1 # v1
@@ -156,20 +140,62 @@ jobs:
156140 - name : Install dependencies
157141 run : vp install
158142
143+ # Gather every shard's blob into one directory (blob-report-chromium-1, …).
159144 - name : Download blob reports
160145 uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
161146 with :
162- path : tests/all- blob-reports
147+ path : tests/blob-report
163148 pattern : blob-report-*
164149 merge-multiple : true
165150
166- - name : Merge reports
167- run : vp exec playwright merge-reports --reporter html ./all-blob-reports
151+ # Re-emit a single HTML report from the merged blobs (no tests are run).
152+ - name : Merge into HTML report
153+ run : HOME=/root vp test -c vite.config.browser.ts --mergeReports=blob-report --reporter=html
168154 working-directory : tests
169155
170156 - name : Upload merged HTML report
171157 uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
158+ if : ${{ !cancelled() }}
172159 with :
173- name : playwright -report-merged
160+ name : e2e -report
174161 path : tests/playwright-report/
175- retention-days : 30
162+ retention-days : 7
163+
164+ deploy-report :
165+ # Publish the merged report to a GitHub Pages PR preview and comment the
166+ # link on the PR (Vercel-style). Pages serves it over HTTP, so the report's
167+ # data loads correctly — unlike opening the downloaded artifact over file://
168+ # (the @vitest/ui report fetches its data and is blocked by CORS there).
169+ #
170+ # Default `needs` semantics: this runs only when `merge-reports` succeeded
171+ # (i.e. a report exists) — but regardless of whether the tests passed, so a
172+ # red run still gets a navigable preview. Skipped for fork PRs, whose
173+ # read-only token can't push to gh-pages or comment (they keep the artifact).
174+ name : " E2E Report Preview"
175+ runs-on : ubuntu-latest
176+ needs : merge-reports
177+ if : ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository }}
178+ permissions :
179+ contents : write
180+ pull-requests : write
181+ steps :
182+ - uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
183+ with :
184+ persist-credentials : false
185+
186+ - name : Download merged report
187+ uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
188+ with :
189+ name : e2e-report
190+ path : e2e-report
191+
192+ # Deploys to the `gh-pages` branch under `pr-preview/pr-<N>/` and posts a
193+ # sticky comment with the URL. The companion `pr-preview-cleanup` workflow
194+ # removes it when the PR closes.
195+ - name : Deploy report to PR preview
196+ uses : rossjrw/pr-preview-action@ffa7509e91a3ec8dfc2e5536c4d5c1acdf7a6de9 # v1
197+ with :
198+ source-dir : e2e-report
199+ preview-branch : gh-pages
200+ umbrella-dir : pr-preview
201+ action : deploy
0 commit comments