Repository navigation
[Significant events] Cut the event flyout Actions-menu test cost - #301793
kibanamachine wants to merge 1 commit into
Conversation
The five EventFlyout cases that open the footer Actions menu drove the entire cost of the file and timed out against Jest's 5s budget under CI load. They opened the menu with `await userEvent.click`, whose pointer sequence re-checks computed `pointer-events` styles across the whole flyout tree on every click, and probed `Mark inactive` by role + accessible name because it was the one menu item without a `data-test-subj`. Drive the menu with `fireEvent.click` instead -- `togglePopover` is a plain `setIsOpen` state update and RTL wraps `fireEvent` in `act`, so the item is queryable on the next line -- and give `Mark inactive` a `data-test-subj` so its assertions are attribute lookups like its siblings'. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
🤖 Jobs for this PR can be triggered through checkboxes. 🚧
ℹ️ To trigger the CI, please tick the checkbox below 👇
|
⏭️ Flaky-fix verification skippedThis is a Jest-only change, so the flaky test runner can add no signal and the required CI Jest run is the whole verdict. Applied Why the flaky test runner wasn't usedThe Screened the patch against the fix guidelines before skipping. How release-note and backport labels were chosenApplied
Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
To allow these domains, add them to the network:
allowed:
- defaults
- "raw.githubusercontent.com"See Network Configuration for more information.
|
|
Pinging @elastic/nightshift (Team:nightshift) |
Fixes #300968
Summary
EventFlyoutcases that open the footer Actions menu drove the entire cost of the file and ran past Jest's 5s budget under CI load —only offers Mark inactive...at 5.358s, andopens a new chat from the Actions menuat 5.233s in the latest failure. Nothing failed an assertion.await userEvent.click, whose pointer sequence re-checks computedpointer-eventsstyles across the whole flyout tree on every click. This swaps all nine clicks forfireEvent.click:togglePopoveris a plainsetIsOpenstate update (menu_button.tsx:134-137) and RTL wrapsfireEventinact, so the item is queryable on the next line — the tests need the menu open, not a full pointer sequence.Mark inactivewas the only entry inactionMenuPanelswithout adata-test-subj, so five assertions reached for role + accessible name — RTL's most expensive query. It now carries one, making those assertions plain attribute lookups like its siblings'.Relevant history
EuiPopover+EuiContextMenuActions menu and adding these five cases together with it — before it no case had to open a popover at all.Context
*ByRole(..., { name })menu assertions, butopens a new chat from the Actions menualready queries by test id with a single render and still blew the budget, so the dominant cost is the sharedawait userEvent.clickpath. Local profiling confirms this — see Verification.kibana-on-mergefor9.6, twice in three days (build 114241, build 114692); the second build timed out on two of the five cases. The shard was not degraded (2 failures out of 15,857 cases). The same unfixed test is onmain, so the fix lands here.Verification
Verified locally
✅ Passed:
node scripts/eslint x-pack/solutions/observability/plugins/nightshift/public/components/entities/significant_event/event_flyout.test.tsx x-pack/solutions/observability/plugins/nightshift/public/components/entities/significant_event/event_flyout.tsx✅ Passed:
node scripts/jest x-pack/.../significant_event/event_flyout.test.tsx— 25 runs before the fix and 25 after, 25/25 passing in both loops (the flake needs CI load and does not reproduce on an idle runner), with the five Actions-menu cases dropping from 2384ms avg / 2537ms max combined to 611ms / 767ms — 3.9x cheaper:only offers Mark inactive...(reported)opens a new chat from the Actions menumarks an active event inactive...runs an investigation from the footer...offers a new chat instead...Afterwards no Actions-menu case is among the most expensive in the file — they sit at the level of the plain-render cases (~56–143ms).
✅ Passed: no
not wrapped in actwarnings appear after theuserEvent→fireEventswap, confirming the menu item is in the DOM synchronously and no gatingfindByTestIdis needed.Not verified locally
Important
The flaky test runner may verify the PR, but the owning team is responsible the next steps:
@copilotif Copilot is enabled on your account)