[Custom threshold] Freeze timers so error-callout test ignores a11y announcer duplicate - #290453
Conversation
Fixes #253621 The "should show an error message when searchSource throws an error" test reads the whole error-callout subtree via `.text()`. Because the callout uses `announceOnMount`, EuiCallOut renders an EuiLiveAnnouncer screen-reader live region that populates a title/text duplicate ~50ms after mount (a real setTimeout). Under CI parallel load the timer fires before the assertion, so the read captures the duplicate and the string doubles. Freezing timers for this test keeps that live region empty while leaving `nextTick` real so the async setup update still flushes. Co-Authored-By: Claude Opus 4 (1M context) <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 Why the flaky test runner wasn't usedThe How release-note and backport labels were chosenApplied
|
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]
Test Failures
|
Fixes #253621
Summary
custom_threshold"should show an error message when searchSource throws an error" test read the whole error-callout subtree with.text()and asserted it equals the title + text + button exactly.KbnDangerCallout→EuiCallOut) is rendered withannounceOnMount, so EuiCallOut also mounts anEuiLiveAnnouncerscreen-reader live region that populates a duplicate of the callout's title/text ~50ms after mount, via a realsetTimeout..text()read scoops up its duplicate — doubling the string and failing the exact-match assertion.nextTickreal so the asyncsetup()update still flushes. The assertion (and its coverage) is unchanged.Context
kibanamachine"New failure" notifications — so this was investigated from scratch against currentmain.main: forcing a 100ms wait after mount makes the callout's.text()include the live region'srole="status" aria-live="polite"node (Error fetching search source, Could not locate that data view (id: )), doubling the asserted string — the same failure family reported on the issue.kibana-on-mergeonmain,9.3,9.4, and9.5(and onekibana-fipsrun), from 2026-02 through 2026-09 — most recentlymain(2026-09-03) and9.5(2026-09-02).Verification
Verified locally
node scripts/eslint x-pack/solutions/observability/plugins/observability/public/components/custom_threshold/custom_threshold_rule_expression.test.tsxnode scripts/jest .../custom_threshold_rule_expression.test.tsx— 25/25 runs passed with the fix..text()read captures theEuiLiveAnnouncerrole="status"duplicate).Not verified locally
Note
Requested by @csr. Share feedback in #kibana-qa. Mention
@copilotto make quick changes.