Skip to content

[Lens] Use fireEvent for flyout close-button click to fix Jest timeout - #290263

Merged
kibanamachine merged 2 commits into
mainfrom
fix/flaky-290124-flyout-close-fireevent-26c8e706894555c0
Sep 11, 2026
Merged

[Lens] Use fireEvent for flyout close-button click to fix Jest timeout#290263
kibanamachine merged 2 commits into
mainfrom
fix/flaky-290124-flyout-close-fireevent-26c8e706894555c0

Conversation

@kibanamachine

Copy link
Copy Markdown
Contributor

Fixes #290124

Summary

  • The only case using await userEvent.click (flyout_wrapper.test.tsx:92) hit the 5000 ms timeout under CI parallel load, while the three synchronous cases rendering the same component passed — the async interaction machinery, not the assertion, ran out of budget.
  • The close button's handler is a plain synchronous onClick={onCancel}, so nothing needs awaiting. This swaps userEvent.click for fireEvent.click (which RTL still wraps in act), removing the pointer/actionability/tooltip-timer overhead while the expect(onCancel).toHaveBeenCalledTimes(1) still reads synchronously.
Runtime vs. 5s budget Passed Avg Max
Before fix 25/25 66ms 106ms
After fix 25/25 24ms 27ms

Context

  • Follows the failed-test investigator's proposed fix verbatim; independent code review of flyout_wrapper.tsx:112 (onClick={onCancel}) and the test file confirmed the diagnosis is still current.
  • Failures were on kibana-on-merge - main (Jest Tests), reported twice — first on 2026-09-09 and again on 2026-09-10 with the same Exceeded timeout of 5000 ms signature.
  • The close button is wrapped in an EuiToolTip that arms show/hide timers on hover, which is what tipped userEvent's overhead past the 5s budget under load; the local runtime table above shows the swap cuts the per-test cost by ~64% and removes the tail.
Verification

Verified locally

  • ✅ Passed: node scripts/eslint x-pack/platform/plugins/shared/lens/public/app_plugin/shared/edit_on_the_fly/flyout_wrapper.test.tsx
  • ✅ Passed: node scripts/jest x-pack/platform/plugins/shared/lens/public/app_plugin/shared/edit_on_the_fly/flyout_wrapper.test.tsx: 25/25 passed before the fix (avg 66ms, max 106ms), 25/25 after (avg 24ms, max 27ms)

Not verified locally

  • The 5s timeout does not reproduce locally — it only surfaces under CI parallel load — so the pass counts above cannot prove the flake is gone. What they do show is that the fix removes the async userEvent machinery and lowers the test's cost, which is the mechanism behind the timeout.

Note

Share feedback in #kibana-qa. Mention @copilot to make quick changes.

Generated by Flaky Test Fixer for #290124 · claude · opus · 270.2 AIC · ⌖ 64.9 AIC · ⊞ 14.5K ·

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
@kibanamachine kibanamachine added the flaky-test-fixer Automated PR created by the flaky test fixer workflow label Sep 10, 2026
@github-actions github-actions Bot added backport:skip This PR does not require backporting flaky-fix-check:skipped Flaky fix verifier: runner can't verify this fix (e.g. no Jest support) release_note:skip Skip the PR/issue when compiling release notes labels Sep 10, 2026
@kibanamachine

Copy link
Copy Markdown
Contributor Author

⏭️ Flaky-fix verification skipped

This is a Jest-only change, so the /flaky runner can add no signal and required CI is the whole verdict. Applied release_note:skip and backport:skip.

Why the flaky test runner wasn't used

The /flaky runner accepts only FTR and Scout configs. This PR only touches the Jest unit test flyout_wrapper.test.tsx. Swapping userEvent.click for fireEvent.click on the synchronous close-button handler is the recommended RTL fix (remove the async step), and the fixer already validated it locally at 25/25.

How release-note and backport labels were chosen

Applied release_note:skip because this is a test-only change with no user-facing effect.

  • v9.5.4 → excluded; the file exists on 9.5 but the close-button click test being fixed does not.
  • v9.4.7 → excluded; same as 9.5 — the affected test case is not present.
  • v8.19.22 → excluded; the test file does not exist on 8.19.

Generated by Flaky Fix Verifier for #290263 · claude · opus · 167.7 AIC · ⌖ 60.7 AIC · ⊞ 15.8K ·

@kibanamachine
kibanamachine marked this pull request as ready for review September 10, 2026 10:34
@kibanamachine
kibanamachine requested a review from a team as a code owner September 10, 2026 10:34
@kibanamachine
kibanamachine enabled auto-merge (squash) September 10, 2026 10:34
@kibanamachine

Copy link
Copy Markdown
Contributor Author

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

✅ unchanged

History

@kibanamachine
kibanamachine merged commit 8e8757b into main Sep 11, 2026
41 checks passed
@kibanamachine
kibanamachine deleted the fix/flaky-290124-flyout-close-fireevent-26c8e706894555c0 branch September 11, 2026 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting flaky-fix-check:skipped Flaky fix verifier: runner can't verify this fix (e.g. no Jest support) flaky-test-fixer Automated PR created by the flaky test fixer workflow release_note:skip Skip the PR/issue when compiling release notes v9.6.0

Projects

None yet

2 participants