Skip to content

Commit 181796b

Browse files
committed
WIP
1 parent 9797d24 commit 181796b

235 files changed

Lines changed: 6664 additions & 630 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Keep the e2e image build context lean and Linux-clean: never copy host
2+
# (macOS) node_modules or build outputs — deps are installed fresh inside the
3+
# image. What actually lands in the image is selected explicitly by the COPY
4+
# steps in tests/Dockerfile (manifests + example apps), not by exclusions here;
5+
# these entries just stop the heavy/irrelevant trees from bloating the context.
6+
**/node_modules
7+
**/dist
8+
**/types
9+
**/.vite
10+
**/.vite-plus
11+
**/*.tsbuildinfo
12+
**/.DS_Store
13+
.git
14+
**/test-results
15+
**/blob-report
16+
**/playwright-report
17+
tests/.vitest-attachments

.github/workflows/build.yml

Lines changed: 25 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ jobs:
5050
id: soft-release
5151
run: vp dlx pkg-pr-new publish './packages/*' # TODO disabled only for AI branch--compact
5252

53-
playwright-build:
54-
name: "Playwright Build"
53+
e2e-build:
54+
name: "E2E Build"
5555
runs-on: ubuntu-latest
5656
timeout-minutes: 30
5757
steps:
@@ -67,79 +67,36 @@ jobs:
6767
- name: Install dependencies
6868
run: vp install
6969

70+
# Example apps mounted by the e2e tests import the @blocknote/* packages'
71+
# built dist.
7072
- name: Build packages
71-
run: vp run -r build
73+
run: vp run --filter ./packages build
7274

73-
- name: Upload build artifacts
75+
- name: Upload package dist
7476
uses: actions/upload-artifact@v7
7577
with:
76-
name: playwright-build
77-
path: |
78-
packages/*/dist
79-
playground/dist
78+
name: e2e-package-dist
79+
path: packages/*/dist
8080
retention-days: 1
8181

82-
playwright:
83-
name: "Playwright Tests - ${{ matrix.browser }} (${{ matrix.shardIndex }}/${{ matrix.shardTotal }})"
82+
e2e:
83+
# Vitest Browser Mode runs in the Playwright Linux container — the same
84+
# environment as the local Docker run — so behaviour matches local dev.
85+
name: "E2E - ${{ matrix.browser }}"
8486
runs-on: ubuntu-latest
85-
needs: playwright-build
87+
needs: e2e-build
8688
timeout-minutes: 30
8789
container:
8890
image: mcr.microsoft.com/playwright:v1.51.1-noble
8991
strategy:
9092
fail-fast: false
9193
matrix:
9294
browser: [chromium, firefox, webkit]
93-
shardIndex: [1, 2]
94-
shardTotal: [2]
9595
steps:
9696
- uses: actions/checkout@v6
9797
with:
9898
fetch-depth: 100
9999

100-
- uses: voidzero-dev/setup-vp@v1
101-
with:
102-
node-version-file: ".node-version"
103-
cache: true
104-
105-
- name: Download build artifacts
106-
uses: actions/download-artifact@v8
107-
with:
108-
name: playwright-build
109-
110-
- name: Install dependencies
111-
run: vp install
112-
113-
- name: Run server and Playwright tests
114-
run: |
115-
HOME=/root vp exec concurrently --success=first -r --kill-others \
116-
"vp run --filter @blocknote/example-editor preview" \
117-
"wait-on http://localhost:3000 && cd tests && vp exec playwright test --project ${{ matrix.browser }} --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}"
118-
119-
- name: Upload blob report
120-
uses: actions/upload-artifact@v7
121-
if: ${{ !cancelled() }}
122-
with:
123-
name: blob-report-${{ matrix.browser }}-${{ matrix.shardIndex }}
124-
path: tests/blob-report/
125-
retention-days: 1
126-
127-
- name: Upload HTML report
128-
uses: actions/upload-artifact@v7
129-
if: ${{ !cancelled() }}
130-
with:
131-
name: playwright-report-${{ matrix.browser }}-${{ matrix.shardIndex }}
132-
path: tests/playwright-report/
133-
retention-days: 30
134-
135-
merge-reports:
136-
name: "Merge Playwright Reports"
137-
if: ${{ !cancelled() }}
138-
needs: playwright
139-
runs-on: ubuntu-latest
140-
steps:
141-
- uses: actions/checkout@v6
142-
143100
- uses: voidzero-dev/setup-vp@v1
144101
with:
145102
node-version-file: ".node-version"
@@ -148,20 +105,22 @@ jobs:
148105
- name: Install dependencies
149106
run: vp install
150107

151-
- name: Download blob reports
108+
- name: Download package dist
152109
uses: actions/download-artifact@v8
153110
with:
154-
path: tests/all-blob-reports
155-
pattern: blob-report-*
156-
merge-multiple: true
111+
name: e2e-package-dist
112+
path: packages
157113

158-
- name: Merge reports
159-
run: vp exec playwright merge-reports --reporter html ./all-blob-reports
114+
# No preview server: Vitest Browser Mode serves the tests + mounted example
115+
# apps itself. `--browser` selects this matrix shard's browser.
116+
- name: Run e2e tests (${{ matrix.browser }})
117+
run: HOME=/root vp test -c vite.config.browser.ts --run --browser ${{ matrix.browser }}
160118
working-directory: tests
161119

162-
- name: Upload merged HTML report
120+
- name: Upload failure artifacts
163121
uses: actions/upload-artifact@v7
122+
if: ${{ failure() }}
164123
with:
165-
name: playwright-report-merged
166-
path: tests/playwright-report/
167-
retention-days: 30
124+
name: e2e-attachments-${{ matrix.browser }}
125+
path: tests/.vitest-attachments/
126+
retention-days: 7
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Update e2e snapshots
2+
3+
# Manually triggered: regenerates the Linux-rendered visual-regression baselines
4+
# (and any JSON doc snapshots) for the Vitest Browser Mode e2e suite and commits
5+
# them. Visual baselines are intentionally Linux-only (see matchPageScreenshot),
6+
# so they must be produced here rather than from a developer's macOS machine.
7+
on:
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: write
12+
13+
jobs:
14+
update-snapshots:
15+
name: "Update e2e snapshots"
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 45
18+
container:
19+
image: mcr.microsoft.com/playwright:v1.51.1-noble
20+
steps:
21+
- uses: actions/checkout@v6
22+
23+
- uses: voidzero-dev/setup-vp@v1
24+
with:
25+
node-version-file: ".node-version"
26+
cache: true
27+
28+
- name: Install dependencies
29+
run: vp install
30+
31+
- name: Build packages
32+
run: vp run -r build
33+
34+
- name: Regenerate snapshots (all browsers)
35+
run: HOME=/root E2E_ALL_BROWSERS=1 vp test -c vite.config.browser.ts --run -u
36+
working-directory: tests
37+
38+
- name: Commit updated snapshots
39+
run: |
40+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
41+
git config user.name "github-actions[bot]"
42+
git config user.email "github-actions[bot]@users.noreply.github.com"
43+
git add 'tests/src/end-to-end/**/__screenshots__' 'tests/src/end-to-end/**/__snapshots__'
44+
git commit -m "chore(tests): update e2e Linux snapshots" || echo "No snapshot changes."
45+
git push

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ examples/*/types
1010
tsconfig.tsbuildinfo
1111
# testing
1212
coverage
13+
# Vitest's attachment store (failure screenshots / diffs). Accumulates across
14+
# runs; the HTML reporter copies what it needs into playwright-report/data,
15+
# so the originals are unreferenced cruft.
16+
.vitest-attachments/
1317

1418
# production
1519
/build

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@
2222
"deploy": "echo not working:(",
2323
"gen": "vp run --filter @blocknote/dev-scripts gen",
2424
"install-playwright": "cd tests && vp exec playwright install --with-deps",
25-
"e2e": "vp run -r build && cd tests && vp test -c vite.config.browser.ts --run",
26-
"e2e:updateSnaps": "vp run -r build && cd tests && vp test -c vite.config.browser.ts --run -u",
25+
"e2e:image": "docker build -t blocknote-e2e -f tests/Dockerfile .",
26+
"e2e": "bash tests/docker-run.sh -e CI=1 -- --run",
27+
"e2e:ui": "echo '\\n ▶ Vitest UI: http://localhost:63315/__vitest__/ (ignore the :51204 line the container logs below)\\n' && bash tests/docker-run.sh -p 127.0.0.1:63315:63315 -- --ui --watch --no-open",
28+
"e2e:updateSnaps": "bash tests/docker-run.sh -e CI=1 -- --run -u",
29+
"e2e:report": "serve -l 4173 tests/playwright-report",
2730
"lint": "vp lint",
2831
"postpublish": "rm -rf packages/core/README.md && rm -rf packages/react/README.md",
2932
"prebuild": "cp README.md packages/core/README.md && cp README.md packages/react/README.md",

0 commit comments

Comments
 (0)