From 710fe62e63d205a1286977d2930d262df696cd5b Mon Sep 17 00:00:00 2001 From: Ashokaditya Date: Tue, 22 Oct 2024 11:35:10 +0200 Subject: [PATCH 1/3] re-enable skipped test closes elastic/kibana/issues/193554 closes elastic/kibana/issues/193092 --- .../components/actions_log_users_filter.test.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/components/actions_log_users_filter.test.tsx b/x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/components/actions_log_users_filter.test.tsx index 5d47cfb3b43c3..afcd051af1bd8 100644 --- a/x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/components/actions_log_users_filter.test.tsx +++ b/x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/components/actions_log_users_filter.test.tsx @@ -15,9 +15,7 @@ import { import { ActionsLogUsersFilter } from './actions_log_users_filter'; import { MANAGEMENT_PATH } from '../../../../../common/constants'; -// FLAKY: https://github.com/elastic/kibana/issues/193554 -// FLAKY: https://github.com/elastic/kibana/issues/193092 -describe.skip('Users filter', () => { +describe('Users filter', () => { let render: ( props?: React.ComponentProps ) => ReturnType; From 27ccdb07629a6c88286150aa5fee7bd29b95c7cc Mon Sep 17 00:00:00 2001 From: Ashokaditya Date: Tue, 22 Oct 2024 13:38:35 +0200 Subject: [PATCH 2/3] update tests to use .keyboard for `enter` instead closes elastic/kibana/issues/193554 closes elastic/kibana/issues/193092 --- .../components/actions_log_users_filter.test.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/components/actions_log_users_filter.test.tsx b/x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/components/actions_log_users_filter.test.tsx index afcd051af1bd8..e5fc4584f644f 100644 --- a/x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/components/actions_log_users_filter.test.tsx +++ b/x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/components/actions_log_users_filter.test.tsx @@ -27,7 +27,7 @@ describe('Users filter', () => { const filterPrefix = 'users-filter'; let onChangeUsersFilter: jest.Mock; - beforeEach(async () => { + beforeEach(() => { onChangeUsersFilter = jest.fn(); mockedContext = createAppRootMockRenderer(); ({ history } = mockedContext); @@ -57,7 +57,7 @@ describe('Users filter', () => { const searchInput = renderResult.getByTestId(`${testPrefix}-${filterPrefix}-search`); await userEvent.type(searchInput, 'usernameX'); - await userEvent.type(searchInput, '{enter}'); + await userEvent.keyboard('{enter}'); expect(onChangeUsersFilter).toHaveBeenCalledWith(['usernameX']); }); @@ -66,7 +66,7 @@ describe('Users filter', () => { const searchInput = renderResult.getByTestId(`${testPrefix}-${filterPrefix}-search`); await userEvent.type(searchInput, 'usernameX,usernameY,usernameZ'); - await userEvent.type(searchInput, '{enter}'); + await userEvent.keyboard('{enter}'); expect(onChangeUsersFilter).toHaveBeenCalledWith(['usernameX', 'usernameY', 'usernameZ']); }); @@ -75,7 +75,7 @@ describe('Users filter', () => { const searchInput = renderResult.getByTestId(`${testPrefix}-${filterPrefix}-search`); await userEvent.type(searchInput, ' usernameX '); - await userEvent.type(searchInput, '{enter}'); + await userEvent.keyboard('{enter}'); expect(onChangeUsersFilter).toHaveBeenCalledWith(['usernameX']); }); @@ -84,7 +84,7 @@ describe('Users filter', () => { const searchInput = renderResult.getByTestId(`${testPrefix}-${filterPrefix}-search`); await userEvent.type(searchInput, ' , usernameX ,usernameY , '); - await userEvent.type(searchInput, '{enter}'); + await userEvent.keyboard('{enter}'); expect(onChangeUsersFilter).toHaveBeenCalledWith(['usernameX', 'usernameY']); }); }); From cb4dfac62acab6737611e52225e9ebaf883e994c Mon Sep 17 00:00:00 2001 From: Ashokaditya Date: Tue, 22 Oct 2024 13:38:57 +0200 Subject: [PATCH 3/3] add a small delay when typing in values --- .../components/actions_log_users_filter.test.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/components/actions_log_users_filter.test.tsx b/x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/components/actions_log_users_filter.test.tsx index e5fc4584f644f..535c0114426dd 100644 --- a/x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/components/actions_log_users_filter.test.tsx +++ b/x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/components/actions_log_users_filter.test.tsx @@ -56,7 +56,7 @@ describe('Users filter', () => { render(); const searchInput = renderResult.getByTestId(`${testPrefix}-${filterPrefix}-search`); - await userEvent.type(searchInput, 'usernameX'); + await userEvent.type(searchInput, 'usernameX', { delay: 10 }); await userEvent.keyboard('{enter}'); expect(onChangeUsersFilter).toHaveBeenCalledWith(['usernameX']); }); @@ -65,7 +65,7 @@ describe('Users filter', () => { render(); const searchInput = renderResult.getByTestId(`${testPrefix}-${filterPrefix}-search`); - await userEvent.type(searchInput, 'usernameX,usernameY,usernameZ'); + await userEvent.type(searchInput, 'usernameX,usernameY,usernameZ', { delay: 10 }); await userEvent.keyboard('{enter}'); expect(onChangeUsersFilter).toHaveBeenCalledWith(['usernameX', 'usernameY', 'usernameZ']); }); @@ -74,7 +74,7 @@ describe('Users filter', () => { render(); const searchInput = renderResult.getByTestId(`${testPrefix}-${filterPrefix}-search`); - await userEvent.type(searchInput, ' usernameX '); + await userEvent.type(searchInput, ' usernameX ', { delay: 10 }); await userEvent.keyboard('{enter}'); expect(onChangeUsersFilter).toHaveBeenCalledWith(['usernameX']); }); @@ -83,7 +83,7 @@ describe('Users filter', () => { render(); const searchInput = renderResult.getByTestId(`${testPrefix}-${filterPrefix}-search`); - await userEvent.type(searchInput, ' , usernameX ,usernameY , '); + await userEvent.type(searchInput, ' , usernameX ,usernameY , ', { delay: 10 }); await userEvent.keyboard('{enter}'); expect(onChangeUsersFilter).toHaveBeenCalledWith(['usernameX', 'usernameY']); });