Skip to content

fix(#4082): wait on real tooltip state in work side menu browser tests#4083

Draft
Spark450 wants to merge 1 commit into
devfrom
mark/worksidemenu-tooltip-flake
Draft

fix(#4082): wait on real tooltip state in work side menu browser tests#4083
Spark450 wants to merge 1 commit into
devfrom
mark/worksidemenu-tooltip-flake

Conversation

@Spark450

Copy link
Copy Markdown
Collaborator

Before (the change)

The work side menu tooltip browser tests (libs/react-components/specs/work-side-menu.browser.spec.tsx) used vi.useFakeTimers() with a fixed vi.advanceTimersByTimeAsync(400) before asserting tooltipEl?.classList.contains("show").

The .show class is applied by a real setTimeout that runs only after the browser delivers a real mouseenter from the Playwright hover() interaction. Because the real event is not governed by fake timers, advancing fake time by a fixed amount raced the real event: when the mouseenter had not yet been delivered, the 300ms timer was never registered, so advancing fake time fired nothing and .show was never applied. The assertion then failed intermittently right after the fixed advance.

The same tests also used expect(tooltipEl).toBeTruthy(), a truthy assertion on a query result that our testing standards flag as meaningless.

After (the change)

The three tooltip tests now drop fake timers and wait on the actual .show class state via vi.waitFor against real timers. The redundant toBeTruthy() assertions are removed, since asserting on .show already requires the element to exist.

This is a test only change. No component, prop, event, or wrapper behavior changed, so React and Angular wrappers are untouched.

Make sure that you've checked the boxes below before you submit the PR

  • I have read and followed the setup steps
  • I have created necessary unit tests
  • I have tested the functionality in both React and Angular.

Steps needed to test

  1. Check out the branch and run npx vitest --run --project='*-headless' work-side-menu.browser -t "tooltip".
  2. Confirm the three tooltip tests pass.
  3. Run it repeatedly (or under CI load) and confirm there are no intermittent failures on expect(tooltipEl?.classList.contains("show")).toBe(true).

Verified locally: 6/6 tooltip assertions pass across 3 repeat runs, and the full work-side-menu.browser spec passes 26/26.

Fixes #4082

🤖 Generated with Claude Code

The tooltip show/hide browser tests mixed fake timers with real browser
hover interactions. The .show class is applied after a real setTimeout
following a browser-delivered mouseenter, so advancing fake time by a
fixed amount raced the real event and intermittently never fired the
timer, leaving .show unapplied.

Drop fake timers and wait on the actual .show class state via vi.waitFor
against real timers. Also remove the toBeTruthy() truthy assertions on
query results, which test nothing meaningful.

Fixes #4082

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 19, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://GovAlta.github.io/ui-components/pr-preview-angular/pr-4083/

Built to branch gh-pages at 2026-06-19 22:57 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions

Copy link
Copy Markdown

Preview links

Target URL
Docs https://govalta.github.io/ui-components/pr-preview/pr-4083/
React playground https://govalta.github.io/ui-components/pr-preview-react/pr-4083/
Angular playground https://govalta.github.io/ui-components/pr-preview-angular/pr-4083/

Built from commit 17affc1. Previews are removed automatically when this PR closes.

@Spark450

Copy link
Copy Markdown
Collaborator Author

@vanessatran-ddi I very quickly got in over my head here, I can leave this hanging around if you think it could be something we can use but if not, happy to close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Work side menu: tooltip browser tests are flaky due to fake-timer/rAF mismatch

1 participant