From e70b533bdb443a4ebc8229237583160eeeaad412 Mon Sep 17 00:00:00 2001 From: Ash <1849116+ashokaditya@users.noreply.github.com> Date: Wed, 23 Oct 2024 10:33:37 +0200 Subject: [PATCH] [SecuritySolution][Endpoint] Re-enabled skipped tests (#197220) ## Summary This PR attempts to fix tests skipped in elastic/kibana/issues/193092 and elastic/kibana/issues/193554. The tests seem to be flaky right after an [upgrade to `user-event`](https://github.com/elastic/kibana/pull/189949) dependency on Sep 10th. ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed --- .../actions_log_users_filter.test.tsx | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 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..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 @@ -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; @@ -29,7 +27,7 @@ describe.skip('Users filter', () => { const filterPrefix = 'users-filter'; let onChangeUsersFilter: jest.Mock; - beforeEach(async () => { + beforeEach(() => { onChangeUsersFilter = jest.fn(); mockedContext = createAppRootMockRenderer(); ({ history } = mockedContext); @@ -58,8 +56,8 @@ describe.skip('Users filter', () => { render(); const searchInput = renderResult.getByTestId(`${testPrefix}-${filterPrefix}-search`); - await userEvent.type(searchInput, 'usernameX'); - await userEvent.type(searchInput, '{enter}'); + await userEvent.type(searchInput, 'usernameX', { delay: 10 }); + await userEvent.keyboard('{enter}'); expect(onChangeUsersFilter).toHaveBeenCalledWith(['usernameX']); }); @@ -67,8 +65,8 @@ describe.skip('Users filter', () => { render(); const searchInput = renderResult.getByTestId(`${testPrefix}-${filterPrefix}-search`); - await userEvent.type(searchInput, 'usernameX,usernameY,usernameZ'); - await userEvent.type(searchInput, '{enter}'); + await userEvent.type(searchInput, 'usernameX,usernameY,usernameZ', { delay: 10 }); + await userEvent.keyboard('{enter}'); expect(onChangeUsersFilter).toHaveBeenCalledWith(['usernameX', 'usernameY', 'usernameZ']); }); @@ -76,8 +74,8 @@ describe.skip('Users filter', () => { render(); const searchInput = renderResult.getByTestId(`${testPrefix}-${filterPrefix}-search`); - await userEvent.type(searchInput, ' usernameX '); - await userEvent.type(searchInput, '{enter}'); + await userEvent.type(searchInput, ' usernameX ', { delay: 10 }); + await userEvent.keyboard('{enter}'); expect(onChangeUsersFilter).toHaveBeenCalledWith(['usernameX']); }); @@ -85,8 +83,8 @@ describe.skip('Users filter', () => { render(); const searchInput = renderResult.getByTestId(`${testPrefix}-${filterPrefix}-search`); - await userEvent.type(searchInput, ' , usernameX ,usernameY , '); - await userEvent.type(searchInput, '{enter}'); + await userEvent.type(searchInput, ' , usernameX ,usernameY , ', { delay: 10 }); + await userEvent.keyboard('{enter}'); expect(onChangeUsersFilter).toHaveBeenCalledWith(['usernameX', 'usernameY']); }); });