Skip to content

Commit

Permalink
[SecuritySolution][Endpoint] Re-enabled skipped tests (#197220)
Browse files Browse the repository at this point in the history
## Summary

This PR attempts to fix tests skipped in /issues/193092
and /issues/193554.
The tests seem to be flaky right after an [upgrade to
`user-event`](#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
  • Loading branch information
ashokaditya authored Oct 23, 2024
1 parent dc219f9 commit e70b533
Showing 1 changed file with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof ActionsLogUsersFilter>
) => ReturnType<AppContextTestRender['render']>;
Expand All @@ -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);
Expand Down Expand Up @@ -58,35 +56,35 @@ 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']);
});

it('should search comma separated strings as multiple users', async () => {
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']);
});

it('should ignore white spaces in a given username when updating the API params', async () => {
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']);
});

it('should ignore white spaces in comma separated usernames when updating the API params', async () => {
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']);
});
});

0 comments on commit e70b533

Please sign in to comment.