Skip to content

Fix flaky profile picture test in account settings - #35935

Merged
t3chguy merged 2 commits into
element-hq:developfrom
Mohsintl:fix-avatar-thumbnail-flake
Nov 20, 2026
Merged

t3chguy merged 2 commits into
element-hq:developfrom
Mohsintl:fix-avatar-thumbnail-flake

Conversation

@Mohsintl

@Mohsintl Mohsintl commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #35267

What was wrong

After uploading a profile picture, Element loads its thumbnail. Firefox and WebKit block service workers in these tests, and Element relies on the service worker to add the access token to media requests. Without the token, the homeserver returns a 404, so Element falls back to the letter "B". The test was flaky because it sometimes passed before the image disappeared.

How I found it

Network logging showed the upload and avatar save returning 200, but the thumbnail request returning 404 every time, whether the test passed or failed.

The fix

Following t3chguy's suggestion, I skipped this test on Firefox and WebKit with test.skip(browserName !== "chromium", ...) and removed the thumbnail mock. Chrome still runs the test and checks that the real thumbnail loads.

Before and after

Browser Before After
Firefox 5/10 failed skipped
WebKit 2/5 failed skipped
Chrome not flaky 5/5 passed

How to test

cd apps/web && pnpm test:playwright playwright/e2e/settings/account-user-settings-tab.spec.ts --project=Chrome --repeat-each=5 -g "should support adding and removing a profile picture"

Tests only, T-Task please.

Checklist

  • I have read through review guidelines and CONTRIBUTING.md.
  • I have linked the PR to an issue that describes what needs changing.
  • I have written tests for new code (and old code if feasible).
  • I have ensured new or updated public/exported symbols have accurate TSDoc documentation.
  • I have confirmed linter and other CI checks pass.
  • I have have included screenshots if what the user sees will change
  • I have licensed the changes to Element by completing the Contributor License Agreement (CLA)
  • I will no longer force push to this branch

AI assistance

  • I used AI tools to help create this PR.

The test homeserver only serves media to authenticated requests, so the thumbnail got a 404 and the avatar fell back to the initial, often before the test saw the image.
@t3chguy

t3chguy commented Nov 19, 2026

Copy link
Copy Markdown
Member

I think this test should just be disabled on firefox & webkit

@Mohsintl

Copy link
Copy Markdown
Contributor Author

Agreed, I’ve made the change. The test is now skipped on Firefox and WebKit, and I’ve removed the thumbnail mock. Chrome still runs the test and checks the real thumbnail loads.

@t3chguy
t3chguy enabled auto-merge November 20, 2026 09:38
@t3chguy
t3chguy added this pull request to the merge queue Nov 20, 2026
Merged via the queue into element-hq:develop with commit a160bf6 Nov 20, 2026
50 checks passed

This branch was successfully deployed

3 active deployments
EndToEndTests — be28c80f Deployed Nov 20, 2026 by github-actions[bot]
SharedComponentStorybook — be28c80f Deployed Nov 20, 2026 by github-actions[bot]
Netlify — be28c80f Deployed Nov 20, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-Task Tasks for the team like planning Z-Community-PR Issue is solved by a community member's PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky playwright test: settings/account-user-settings-tab.spec.ts: should support adding and removing a profile picture

3 participants