Skip to content

Commit 3e27a00

Browse files
authored
Playwright fixes and improvements (#28925)
* Fix playwright-image-updates.yaml workflow Signed-off-by: Michael Telatynski <[email protected]> * Add `X-Run-All-Tests` label for running all tests Signed-off-by: Michael Telatynski <[email protected]> * Ignore failing tests in stale-screenshot-reporter.ts to avoid confusing errors Signed-off-by: Michael Telatynski <[email protected]> --------- Signed-off-by: Michael Telatynski <[email protected]>
1 parent 5caad70 commit 3e27a00

File tree

6 files changed

+14
-8
lines changed

6 files changed

+14
-8
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
/src/i18n/strings
1616
/src/i18n/strings/en_EN.json @element-hq/element-web-reviewers
1717
# Ignore the synapse plugin as this is updated by GHA for docker image updating
18-
/playwright/plugins/homeserver/synapse/index.ts
18+
/playwright/testcontainers/synapse.ts
1919

.github/labels.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,9 @@
210210
- name: "X-Upcoming-Release-Blocker"
211211
description: "This does not affect the current release cycle but will affect the next one"
212212
color: "e99695"
213+
- name: "X-Run-All-Tests"
214+
description: "When applied to PRs, it'll run the full gamut of end-to-end tests on the PR"
215+
color: "ff7979"
213216
- name: "Z-Actions"
214217
color: "ededed"
215218
- name: "Z-Cache-Confusion"

.github/workflows/end-to-end-tests.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@ jobs:
114114
- Chrome
115115
- Firefox
116116
- WebKit
117-
isCron:
118-
- ${{ github.event_name == 'schedule' }}
119-
# Skip the Firefox & Safari runs unless this was a cron trigger
117+
runAllTests:
118+
- ${{ github.event_name == 'schedule' || contains(github.event.pull_request.labels.*.name, 'X-Run-All-Tests') }}
119+
# Skip the Firefox & Safari runs unless this was a cron trigger or PR has X-Run-All-Tests label
120120
exclude:
121-
- isCron: false
121+
- runAllTests: false
122122
project: Firefox
123-
- isCron: false
123+
- runAllTests: false
124124
project: WebKit
125125
steps:
126126
- uses: actions/checkout@v4
@@ -170,7 +170,7 @@ jobs:
170170
yarn playwright test \
171171
--shard "${{ matrix.runner }}/${{ needs.build.outputs.num-runners }}" \
172172
--project="${{ matrix.project }}" \
173-
${{ github.event_name == 'pull_request' && '--grep-invert @mergequeue' || '' }}
173+
${{ (github.event_name == 'pull_request' && matrix.runAllTests == false ) && '--grep-invert @mergequeue' || '' }}
174174
175175
- name: Upload blob report to GitHub Actions Artifacts
176176
if: always()

.github/workflows/playwright-image-updates.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
docker pull "$IMAGE"
1818
INSPECT=$(docker inspect --format='{{index .RepoDigests 0}}' "$IMAGE")
1919
DIGEST=${INSPECT#*@}
20-
sed -i "s/const DOCKER_TAG.*/const DOCKER_TAG = \"develop@$DIGEST\";/" playwright/plugins/homeserver/synapse/index.ts
20+
sed -i "s/const TAG.*/const TAG = \"develop@$DIGEST\";/" playwright/testcontainers/synapse.ts
2121
env:
2222
IMAGE: ghcr.io/element-hq/synapse:develop
2323

docs/playwright.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,8 @@ has to be disabled in Playwright on Firefox & Webkit to retain routing functiona
227227
Anything testing VoIP/microphone will need to have `@no-webkit` as fake microphone functionality is not available
228228
there at this time.
229229

230+
If you wish to run all tests in a PR, you can give it the label `X-Run-All-Tests`.
231+
230232
## Supporter container runtimes
231233

232234
We use testcontainers to spin up various instances of Synapse, Matrix Authentication Service, and more.

playwright/stale-screenshot-reporter.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class StaleScreenshotReporter implements Reporter {
2323
private success = true;
2424

2525
public onTestEnd(test: TestCase): void {
26+
if (!test.ok()) return;
2627
for (const annotation of test.annotations) {
2728
if (annotation.type === "_screenshot") {
2829
this.screenshots.add(annotation.description);

0 commit comments

Comments
 (0)