Commit a2773c4
authored
Fix NIC e2e test flake in safari (#3198)
Test failure in #3195 repros locally no problem:
<img width="747" height="409" alt="image"
src="https://github.com/user-attachments/assets/d1fed181-f26c-455b-a0ab-c8f8e962c1ae"
/>
Claude's speculation on why it suddenly became a problem after #3178 is
good enough for me. This is the second or third time lately we've run
into small issues because we're not awaiting
`queryClient.invalidateEndpoint` in the mutation handlers. Something to
keep an eye on.
> The race: `NetworkingTab` gates the Delete row action on `nic.primary
&& multipleNics`, where `multipleNics = nics.length > 1`. When the
`my-nic` delete mutation succeeds, `onSuccess` synchronously calls
`queryClient.invalidateEndpoint` (not awaited) and closes the confirm
modal. If the test opens nic-3's row-actions menu before the refetch
lands, `nics.length` is still 2, so Delete renders disabled and wrapped
in a `<Wrap with={<Tooltip/>}>`. When the refetch then lands mid-click,
the `<Wrap>` unwraps, the `Menu.Item` remounts (old DOM detached), and
on Safari/Firefox base-ui's Menu treats that focus/DOM churn as a close
— so Playwright's retry never resolves a clickable Delete and hits the
60s timeout.
>
> When it was introduced: the disable rule landed April 2025 in #2806
("Disable primary NIC delete when multiple NICs present"). The
`DropdownMenu.Item` `<Wrap>`-with-Tooltip pattern has been in place
since ~March 2025. So the race has been latent for about a year.
>
> Why it's surfacing now: first CI appearance was on the #3178
"Responsive grid layout" PR (2026-04-21), which landed on trunk
2026-04-22; every workflow run after that hits it. #3178 moved
TopBar/Sidebar from CSS-grid cells to fixed-position elements, switched
to document-level scroll, removed `overflow-y-hidden` on body, and set
`height: 100%` on html/body/#root. None of that touches the NIC flow,
but it changed paint/layout timing around modal open/close and table
reflow. That shifted the window such that `expect(my-nic
cell).toBeHidden()` now reliably resolves while the page is briefly
inert during the modal's close transition — before the refetch has
actually landed — so the test races into opening nic-3's menu in the
stale state. The layout PR didn't introduce the bug; it just removed the
timing cushion that had been hiding it.1 parent 4a9be31 commit a2773c4
1 file changed
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
104 | 110 | | |
105 | 111 | | |
106 | 112 | | |
| |||
0 commit comments