Skip to content

test(dashboard): Read push notifications only after Chrome displays them - #4056

Merged
dcramer merged 2 commits into
mainfrom
fix-flaky/push-notification-no-tag
Nov 23, 2026
Merged

dcramer merged 2 commits into
mainfrom
fix-flaky/push-notification-no-tag

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Fixes the flaky "shows a push notification that has no tag" e2e test. The classic copy (e2e/settings.spec.ts) and the inbox copy (e2e/inbox/settings.spec.ts) have the same flake. Its final getNotifications() poll sees [] for the full 10s, for example in https://github.com/getsentry/junior/actions/runs/45070158782/job/137357691017.

Why it flakes. Chrome has a race between showing a persistent notification and reading notifications. showNotification() stores the notification in Chrome's notification database first, then displays it. getNotifications() deletes each stored notification that the platform does not list as displayed, unless the notification was created after the read started. So a read that starts between the store and the display deletes the new notification. Every later read then returns [], even with the notification on screen. The test started to poll right after deliverPushMessage, so sometimes its first poll overlapped the worker's showNotification().

The service worker does not hit this race. It reads the badge count after showNotification() resolves, and that happens after the display.

Change.

  • New helper e2e/push-notification.ts (showPlainTextPush), which both tests use. It delivers the same plain text push as before, then waits for the DevTools BackgroundService "Notification displayed" event before one getNotifications() read. Chrome sends this event only after it stores and displays the notification, so the read cannot overlap the show.
  • The dashboard-spec-page-script baseline for both spec files is lower, because the page script moved into the helper.
  • The helper is now in the dashboard type-check project.

via automation evt_ca7e4de75a7c7b194d53107f21c973ee · Run ID dispatch_848193028721465afcdd769442de502e.

--

View Session [Sentry]

Chrome stores a persistent notification before it displays it. A
getNotifications() call in that gap deletes the stored notification, so
later reads return none. The no-tag push test polled getNotifications()
while the worker showed the notification, and sometimes saw [] forever.

Wait for the DevTools "Notification displayed" event, then read once.
Share the push delivery in one helper for the classic and inbox tests.
@vercel

vercel Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
junior-docs Ready Ready Preview Nov 22, 2026 10:54pm UTC

Request Review

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 22, 2026
…cation-no-tag

# Conflicts:
#	packages/junior-dashboard/e2e/inbox/settings.spec.ts
#	packages/junior-dashboard/e2e/settings.spec.ts
@blacksmith-sh

blacksmith-sh Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Found 3 test failures on Blacksmith runners:

Failures

Test View Logs
[classic] › packages/junior-dashboard/e2e/
lead-home.spec.ts:286:3 › on a touch screen › the navigation sheet lists the Lead @clas
sic
View Logs
[inbox] › packages/junior-dashboard/e2e/inbox/
settings.spec.ts:397:3 › new UI › marks the section in view in the pane on pages of sec
tions @new
View Logs
[inbox] › packages/junior-dashboard/e2e/inbox/
system.spec.ts:469:5 › new UI › keeps the people directory across window focus › loads
System People within its request budget @new
View Logs

Fix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@dcramer
dcramer merged commit 43c2a84 into main Nov 23, 2026
53 of 56 checks passed
@dcramer
dcramer deleted the fix-flaky/push-notification-no-tag branch November 23, 2026 00:15

This branch was successfully deployed

1 active deployment
Preview – junior-docs — fb3b6632 Deployed Nov 22, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant