Skip to content

Commit 6015fb6

Browse files
committed
test: migrate new e2e test cases to vitest browser mode
Migrate the test cases added on main (after the vite-plus squash-merge) into the vitest-browser .tsx suites, since the branch replaced the Playwright .test.ts files: - colors: add color-picker-from-toolbar and color-picker-from-side-menu screenshot tests - comments: add 'add reactions' test (pierces the emoji-mart shadow DOM to click emoji buttons) - tables: add 'render table cell colors' screenshot test in its own advancedtables.test.tsx so it can mount the advanced-tables example app via a single render (re-rendering a second app inside a test that already rendered one in beforeEach paints blank) Generate the -linux screenshot baselines in the Playwright container and drop the unused Playwright-style cursor helpers from editor.ts. Also harden the workflows: SHA-pin all actions and set least-privilege permissions (zizmor).
1 parent ca55214 commit 6015fb6

16 files changed

Lines changed: 1002 additions & 629 deletions

.github/workflows/build.yml

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
pull_request:
77
types: [opened, synchronize, reopened, edited]
88

9+
permissions:
10+
contents: read
11+
912
env:
1013
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
1114

@@ -15,11 +18,12 @@ jobs:
1518
runs-on: ubuntu-latest
1619
timeout-minutes: 60
1720
steps:
18-
- uses: actions/checkout@v6
21+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
1922
with:
2023
fetch-depth: 100
24+
persist-credentials: false
2125

22-
- uses: voidzero-dev/setup-vp@v1
26+
- uses: voidzero-dev/setup-vp@2dec1e33f4ab2c6d5bce1b0c4607961bb1a3f7a1 # v1
2327
with:
2428
node-version-file: ".node-version"
2529
cache: true
@@ -41,7 +45,7 @@ jobs:
4145
working-directory: tests
4246

4347
- name: Upload webpack stats artifact (editor)
44-
uses: relative-ci/agent-upload-artifact-action@v2
48+
uses: relative-ci/agent-upload-artifact-action@a2b5741b4f7e6a989c84ec1a3059696b23c152e5 # v2
4549
with:
4650
webpackStatsFile: ./playground/dist/webpack-stats.json
4751
artifactName: relative-ci-artifacts-editor
@@ -67,11 +71,12 @@ jobs:
6771
matrix:
6872
browser: [chromium, firefox, webkit]
6973
steps:
70-
- uses: actions/checkout@v6
74+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
7175
with:
7276
fetch-depth: 100
77+
persist-credentials: false
7378

74-
- uses: voidzero-dev/setup-vp@v1
79+
- uses: voidzero-dev/setup-vp@2dec1e33f4ab2c6d5bce1b0c4607961bb1a3f7a1 # v1
7580
with:
7681
node-version-file: ".node-version"
7782
cache: true
@@ -88,15 +93,15 @@ jobs:
8893
working-directory: tests
8994

9095
- name: Upload blob report (${{ matrix.browser }})
91-
uses: actions/upload-artifact@v7
96+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
9297
if: ${{ !cancelled() }}
9398
with:
9499
name: blob-report-${{ matrix.browser }}
95100
path: tests/blob-report/
96101
retention-days: 1
97102

98103
- name: Upload failure artifacts
99-
uses: actions/upload-artifact@v7
104+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
100105
if: ${{ failure() }}
101106
with:
102107
name: e2e-attachments-${{ matrix.browser }}
@@ -118,11 +123,12 @@ jobs:
118123
container:
119124
image: mcr.microsoft.com/playwright:v1.51.1-noble
120125
steps:
121-
- uses: actions/checkout@v6
126+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
122127
with:
123128
fetch-depth: 100
129+
persist-credentials: false
124130

125-
- uses: voidzero-dev/setup-vp@v1
131+
- uses: voidzero-dev/setup-vp@2dec1e33f4ab2c6d5bce1b0c4607961bb1a3f7a1 # v1
126132
with:
127133
node-version-file: ".node-version"
128134
cache: true
@@ -132,7 +138,7 @@ jobs:
132138

133139
# Gather every shard's blob into one directory (blob-report-chromium, …).
134140
- name: Download blob reports
135-
uses: actions/download-artifact@v8
141+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
136142
with:
137143
path: tests/blob-report
138144
pattern: blob-report-*
@@ -144,7 +150,7 @@ jobs:
144150
working-directory: tests
145151

146152
- name: Upload merged HTML report
147-
uses: actions/upload-artifact@v7
153+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
148154
if: ${{ !cancelled() }}
149155
with:
150156
name: e2e-report
@@ -169,10 +175,12 @@ jobs:
169175
contents: write
170176
pull-requests: write
171177
steps:
172-
- uses: actions/checkout@v6
178+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
179+
with:
180+
persist-credentials: false
173181

174182
- name: Download merged report
175-
uses: actions/download-artifact@v8
183+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
176184
with:
177185
name: e2e-report
178186
path: e2e-report
@@ -181,7 +189,7 @@ jobs:
181189
# sticky comment with the URL. The companion `pr-preview-cleanup` workflow
182190
# removes it when the PR closes.
183191
- name: Deploy report to PR preview
184-
uses: rossjrw/pr-preview-action@v1
192+
uses: rossjrw/pr-preview-action@ffa7509e91a3ec8dfc2e5536c4d5c1acdf7a6de9 # v1
185193
with:
186194
source-dir: e2e-report
187195
preview-branch: gh-pages

.github/workflows/pr-preview-cleanup.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ jobs:
1818
# Fork PRs never got a preview (read-only token), so nothing to remove.
1919
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
2020
steps:
21-
- uses: actions/checkout@v6
21+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
22+
with:
23+
persist-credentials: false
2224

2325
- name: Remove PR preview
24-
uses: rossjrw/pr-preview-action@v1
26+
uses: rossjrw/pr-preview-action@ffa7509e91a3ec8dfc2e5536c4d5c1acdf7a6de9 # v1
2527
with:
2628
preview-branch: gh-pages
2729
umbrella-dir: pr-preview

0 commit comments

Comments
 (0)