From 1df4b5846d03b79b2659df000b18355a714ac06a Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Sat, 12 Sep 2026 21:50:29 +0200 Subject: [PATCH 1/2] Fix flaky trusted apps invalid-hash form test 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) --- .../pages/trusted_apps/view/components/form.test.tsx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/x-pack/solutions/security/plugins/security_solution/public/management/pages/trusted_apps/view/components/form.test.tsx b/x-pack/solutions/security/plugins/security_solution/public/management/pages/trusted_apps/view/components/form.test.tsx index 09bb76146fd0a..6d69b6f5320fd 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/management/pages/trusted_apps/view/components/form.test.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/management/pages/trusted_apps/view/components/form.test.tsx @@ -718,14 +718,12 @@ describe('Trusted apps form', () => { expect(renderResult.getByText(INPUT_ERRORS.name)); }); - it('should validate invalid Hash value', async () => { - const valueField = getConditionValue(getCondition()); - await act(async () => { - await userEvent.clear(valueField); - await userEvent.type(valueField, 'someHASH'); - fireEvent.blur(valueField); + it('should validate invalid Hash value', () => { + setTextFieldValue(getConditionValue(getCondition()), 'someHASH'); + formProps.item = createItem({ + entries: [createEntry(ConditionEntryField.HASH, 'match', 'someHASH')], }); - rerenderWithLatestProps(); + rerender(); expect(renderResult.getByText(INPUT_ERRORS.invalidHash(0))); }); From 15964d550d24edd957d5b217e0153b7b0854b6fa Mon Sep 17 00:00:00 2001 From: "konrad.szwarc" Date: Mon, 14 Sep 2026 12:57:11 -0600 Subject: [PATCH 2/2] Assert the component-emitted item instead of a hand-built one Take the second-to-last onChange call (the idiom already used at lines 738/750/763 of this file) rather than injecting createItem(...), so the test still proves that typing 'someHASH' is what produces the invalid-hash item. Stays synchronous, so the flake fix is unaffected. --- .../pages/trusted_apps/view/components/form.test.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/x-pack/solutions/security/plugins/security_solution/public/management/pages/trusted_apps/view/components/form.test.tsx b/x-pack/solutions/security/plugins/security_solution/public/management/pages/trusted_apps/view/components/form.test.tsx index 6d69b6f5320fd..ffc00a381daab 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/management/pages/trusted_apps/view/components/form.test.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/management/pages/trusted_apps/view/components/form.test.tsx @@ -720,9 +720,7 @@ describe('Trusted apps form', () => { it('should validate invalid Hash value', () => { setTextFieldValue(getConditionValue(getCondition()), 'someHASH'); - formProps.item = createItem({ - entries: [createEntry(ConditionEntryField.HASH, 'match', 'someHASH')], - }); + formProps.item = (formProps.onChange as jest.Mock).mock.calls.at(-2)[0].item; rerender(); expect(renderResult.getByText(INPUT_ERRORS.invalidHash(0))); });