Playwright fixes and improvements (#28925)

* Fix playwright-image-updates.yaml workflow

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Add `X-Run-All-Tests` label for running all tests

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Ignore failing tests in stale-screenshot-reporter.ts to avoid confusing errors

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
pull/28209/merge
Michael Telatynski 2025-01-08 12:37:11 +00:00 committed by GitHub
parent 5caad70191
commit 3e27a0019d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 14 additions and 8 deletions

2
.github/CODEOWNERS vendored
View File

@ -15,5 +15,5 @@
/src/i18n/strings /src/i18n/strings
/src/i18n/strings/en_EN.json @element-hq/element-web-reviewers /src/i18n/strings/en_EN.json @element-hq/element-web-reviewers
# Ignore the synapse plugin as this is updated by GHA for docker image updating # Ignore the synapse plugin as this is updated by GHA for docker image updating
/playwright/plugins/homeserver/synapse/index.ts /playwright/testcontainers/synapse.ts

3
.github/labels.yml vendored
View File

@ -210,6 +210,9 @@
- name: "X-Upcoming-Release-Blocker" - name: "X-Upcoming-Release-Blocker"
description: "This does not affect the current release cycle but will affect the next one" description: "This does not affect the current release cycle but will affect the next one"
color: "e99695" color: "e99695"
- name: "X-Run-All-Tests"
description: "When applied to PRs, it'll run the full gamut of end-to-end tests on the PR"
color: "ff7979"
- name: "Z-Actions" - name: "Z-Actions"
color: "ededed" color: "ededed"
- name: "Z-Cache-Confusion" - name: "Z-Cache-Confusion"

View File

@ -114,13 +114,13 @@ jobs:
- Chrome - Chrome
- Firefox - Firefox
- WebKit - WebKit
isCron: runAllTests:
- ${{ github.event_name == 'schedule' }} - ${{ github.event_name == 'schedule' || contains(github.event.pull_request.labels.*.name, 'X-Run-All-Tests') }}
# Skip the Firefox & Safari runs unless this was a cron trigger # Skip the Firefox & Safari runs unless this was a cron trigger or PR has X-Run-All-Tests label
exclude: exclude:
- isCron: false - runAllTests: false
project: Firefox project: Firefox
- isCron: false - runAllTests: false
project: WebKit project: WebKit
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -170,7 +170,7 @@ jobs:
yarn playwright test \ yarn playwright test \
--shard "${{ matrix.runner }}/${{ needs.build.outputs.num-runners }}" \ --shard "${{ matrix.runner }}/${{ needs.build.outputs.num-runners }}" \
--project="${{ matrix.project }}" \ --project="${{ matrix.project }}" \
${{ github.event_name == 'pull_request' && '--grep-invert @mergequeue' || '' }} ${{ (github.event_name == 'pull_request' && matrix.runAllTests == false ) && '--grep-invert @mergequeue' || '' }}
- name: Upload blob report to GitHub Actions Artifacts - name: Upload blob report to GitHub Actions Artifacts
if: always() if: always()

View File

@ -17,7 +17,7 @@ jobs:
docker pull "$IMAGE" docker pull "$IMAGE"
INSPECT=$(docker inspect --format='{{index .RepoDigests 0}}' "$IMAGE") INSPECT=$(docker inspect --format='{{index .RepoDigests 0}}' "$IMAGE")
DIGEST=${INSPECT#*@} DIGEST=${INSPECT#*@}
sed -i "s/const DOCKER_TAG.*/const DOCKER_TAG = \"develop@$DIGEST\";/" playwright/plugins/homeserver/synapse/index.ts sed -i "s/const TAG.*/const TAG = \"develop@$DIGEST\";/" playwright/testcontainers/synapse.ts
env: env:
IMAGE: ghcr.io/element-hq/synapse:develop IMAGE: ghcr.io/element-hq/synapse:develop

View File

@ -227,6 +227,8 @@ has to be disabled in Playwright on Firefox & Webkit to retain routing functiona
Anything testing VoIP/microphone will need to have `@no-webkit` as fake microphone functionality is not available Anything testing VoIP/microphone will need to have `@no-webkit` as fake microphone functionality is not available
there at this time. there at this time.
If you wish to run all tests in a PR, you can give it the label `X-Run-All-Tests`.
## Supporter container runtimes ## Supporter container runtimes
We use testcontainers to spin up various instances of Synapse, Matrix Authentication Service, and more. We use testcontainers to spin up various instances of Synapse, Matrix Authentication Service, and more.

View File

@ -23,6 +23,7 @@ class StaleScreenshotReporter implements Reporter {
private success = true; private success = true;
public onTestEnd(test: TestCase): void { public onTestEnd(test: TestCase): void {
if (!test.ok()) return;
for (const annotation of test.annotations) { for (const annotation of test.annotations) {
if (annotation.type === "_screenshot") { if (annotation.type === "_screenshot") {
this.screenshots.add(annotation.description); this.screenshots.add(annotation.description);