Repository navigation
Update pharos-toast-close event test to use fake times so it is less flaky - #1489
Merged
Merged
Conversation
|
Contributor
size-limit report 📦
|
brentswisher
marked this pull request as ready for review
November 5, 2026 00:34
brentswisher
requested review from
daneah,
jialin-he and
satya-achanta-venkata
and removed request for
a team
November 5, 2026 00:34
daneah
approved these changes
Nov 5, 2026
The close event fires at least 6500ms after focusout (6000ms toast life plus a 500ms dispatch delay), but the test waited only 7000ms in real time. Passing CI runs took 6508-6862ms, and slow Firefox timers on GitHub runners regularly went past the limit. Advance a fake clock instead, so the result no longer depends on how fast the runner is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
brentswisher
force-pushed
the
hotfix/toast-close-test-flaky
branch
from
November 5, 2026 12:56
e77d0d6 to
8c66ec7
Compare
brentswisher
enabled auto-merge (squash)
November 5, 2026 12:56
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change: (check at least one)
Is this a breaking change? (check one)
Is the: (complete all)
What does this change address?
The
pharos-toast > fires a custom event pharos-toast-close after closingtest fails intermittently in Firefox on GitHub Actions withAssertionError: expected '' to be 'toast'. It caused 5 of the 7 recent "Verify changes" failures, and passes when the tests are re-run.How does this change work?
focusout, the toast waits 6000ms (TOAST_LIFE) before closing, andclose()waits another 500ms before firingpharos-toast-close. So the event can't fire until 6500ms at the earliest.vi.waitFor(..., { timeout: 7000 }), which left only 500ms of slack. In passing CI runs this test took 6508–6862ms. When a runner was busy, Firefox's timers ran late enough to miss the limit.vi.useFakeTimers()andvi.advanceTimersByTimeAsync(6500), so the result no longer depends on how fast the runner is.vi.useRealTimers()runs in afinallyblock so fake timers can't leak into other tests.Verification
Additional context