[Trusted Apps] Fix flaky invalid-hash form test by removing async input - #290719
[Trusted Apps] Fix flaky invalid-hash form test by removing async input#290719kibanamachine wants to merge 1 commit into
Conversation
Replace the char-by-char userEvent.type in an async act with a synchronous field edit plus an explicit controlled-item update, so there is no async step to exceed the 5s Jest budget under CI parallel load. Fixes #286496 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 skippedThe Why the flaky test runner wasn't usedThe How release-note and backport labels were chosenApplied
|
💛 Build succeeded, but was flaky
Failed CI Steps
Metrics [docs]
Test Failures
|
Fixes #286496
Summary
should validate invalid Hash valuetimed out at 5000 ms (and later failed to find[1] Invalid hash value) because it drove the value through slow char-by-charuserEvent.typeinside an asyncact, unlike its sibling tests which set values synchronously.setTextFieldValueedit (which marks the field visited via blur) plus an explicit controlled-itemupdate, then asserts — so there is no async step to exceed the budget.Context
userEvent.typeas the cost, but its proposed drop-in replacement (setTextFieldValue(...); rerenderWithLatestProps();) fails 0/25 locally.rerenderWithLatestProps()readslatestUpdatedItem, and the form'suseEffect(() => processChanged(), [processChanged])re-fires the momenthasFormChangedflipsfalse→trueon the first edit — calling the test'sonChangewith the still-emptyitemprop and clobberinglatestUpdatedItemback to empty.userEvent.typemasked this only because its 2nd–8th keystrokes fire afterhasFormChangedis alreadytrue; the siblingshould validate multiple errors in formavoids it because its AND-click primeshasFormChangedfirst. This fix therefore departs from the proposed patch: it supplies the controlleditemexplicitly (as a real parent would) instead of relying on the clobbered round-trip value.validateValuesstill runs on the invalid-hash item via that sameuseEffectand produces the error; the identical assertion runs synchronously and reliably in the sibling at the bottom of the samedescribe.kibana-on-merge - main(first failure build 107204; reopened on build 109576) — a Jest timeout under CI parallel load.Verification
Verified locally
node scripts/eslint <file>node scripts/jest <file> -t "should validate invalid Hash value": 25/25 passed before the fix (avg 631ms, max 690ms) and 25/25 after (avg 438ms, max 480ms); the ~30% lower average confirms the char-by-char typing cost was removed rather than the wait merely re-tuned.Not verified locally
Note
Share feedback in #kibana-qa. Mention
@copilotto make quick changes.