Skip to content

Commit c936c05

Browse files
authored
Merge pull request #9054 from eth3lbert/e2e-percy-title
Separate e2e snapshots and enable parallel test suites for percy
2 parents 13924a2 + f90f31d commit c936c05

File tree

2 files changed

+27
-5
lines changed

2 files changed

+27
-5
lines changed

.github/workflows/ci.yml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,22 @@ jobs:
6868
non-rust: ${{ steps.changed-files-non-rust.outputs.any_modified }}
6969
rust-lockfile: ${{ steps.changed-files-rust-lockfile.outputs.any_modified }}
7070

71+
percy-nonce:
72+
name: Frontend / Percy Nonce
73+
runs-on: ubuntu-latest
74+
needs: changed-files
75+
if: needs.changed-files.outputs.non-rust == 'true'
76+
77+
# persist job results to other jobs in the workflow
78+
outputs:
79+
nonce: ${{ steps.percy-nonce.outputs.nonce }}
80+
81+
steps:
82+
# persist step results to other steps in the job
83+
- id: percy-nonce
84+
# adding a timestamp makes the nonce more unique for re-runs
85+
run: echo "nonce=${{ github.run_id }}-$(date +%s)" >> $GITHUB_OUTPUT
86+
7187
backend-lint:
7288
name: Backend / Lint
7389
runs-on: ubuntu-22.04
@@ -177,7 +193,7 @@ jobs:
177193
frontend-test:
178194
name: Frontend / Test
179195
runs-on: ubuntu-22.04
180-
needs: changed-files
196+
needs: [changed-files, percy-nonce]
181197
if: needs.changed-files.outputs.non-rust == 'true'
182198

183199
env:
@@ -186,6 +202,8 @@ jobs:
186202
# Percy secrets are included here to enable Percy's GitHub integration
187203
# on community-submitted PRs
188204
PERCY_TOKEN: web_0a783d8086b6f996809f3e751d032dd6d156782082bcd1423b9b860113c75054
205+
PERCY_PARALLEL_NONCE: ${{ needs.percy-nonce.outputs.nonce }}
206+
PERCY_PARALLEL_TOTAL: 2
189207

190208
steps:
191209
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
@@ -202,15 +220,15 @@ jobs:
202220
- run: pnpm install
203221

204222
- if: github.repository == 'rust-lang/crates.io'
205-
run: pnpm percy exec -- pnpm test-coverage
223+
run: pnpm percy exec --parallel -- pnpm test-coverage
206224

207225
- if: github.repository != 'rust-lang/crates.io'
208226
run: pnpm test-coverage
209227

210228
e2e-test:
211229
name: Frontend / Test (playwright)
212230
runs-on: ubuntu-22.04
213-
needs: changed-files
231+
needs: [changed-files, percy-nonce]
214232
timeout-minutes: 60
215233
if: needs.changed-files.outputs.non-rust == 'true'
216234

@@ -220,6 +238,8 @@ jobs:
220238
# Percy secrets are included here to enable Percy's GitHub integration
221239
# on community-submitted PRs
222240
PERCY_TOKEN: web_0a783d8086b6f996809f3e751d032dd6d156782082bcd1423b9b860113c75054
241+
PERCY_PARALLEL_NONCE: ${{ needs.percy-nonce.outputs.nonce }}
242+
PERCY_PARALLEL_TOTAL: 2
223243

224244
steps:
225245
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
@@ -238,7 +258,7 @@ jobs:
238258
- run: pnpm playwright install chromium
239259

240260
- if: github.repository == 'rust-lang/crates.io'
241-
run: pnpm percy exec -- pnpm e2e
261+
run: pnpm percy exec --parallel -- pnpm e2e
242262

243263
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4
244264
if: ${{ !cancelled() }}

e2e/fixtures/percy.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ export class PercyPage {
1414
private title(): string {
1515
// Skip the filename
1616
const paths = this.testInfo.titlePath.slice(1);
17-
return paths.join(' | ');
17+
// Add an "e2e" prefix to differentiate the snapshots from the QUnit tests.
18+
// This address the visual changes caused by the font not loading in QUnit tests (#9052).
19+
return ['e2e'].concat(paths).join(' | ');
1820
}
1921

2022
async snapshot(options?: Parameters<typeof percySnapshot>[2]) {

0 commit comments

Comments
 (0)