Skip to content

Commit c865c67

Browse files
authored
[Cloud Security] Unskip <Findings /> SearchBar tests; fix add-filter timeout (#268196)
1 parent 0ed90b8 commit c865c67

1 file changed

Lines changed: 18 additions & 10 deletions

File tree

x-pack/solutions/security/plugins/cloud_security_posture/public/pages/configurations/configurations.test.tsx

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ const renderFindingsPage = (dependencies = getMockServerDependencies()) => {
4242
);
4343
};
4444

45-
// Failing: See https://github.com/elastic/kibana/issues/244001
46-
describe.skip('<Findings />', () => {
45+
describe('<Findings />', () => {
4746
startMockServer(server);
4847

4948
(useExpandableFlyoutCsp as jest.Mock).mockReturnValue({
@@ -204,6 +203,15 @@ describe.skip('<Findings />', () => {
204203
await waitFor(() => expect(screen.getByText(/2 findings/i)).toBeInTheDocument());
205204
});
206205
it('add filter', async () => {
206+
// Use setup({ delay: null }) to drop @testing-library/user-event v14's
207+
// default ~6ms-per-keystroke delay. The default 30s Jest timeout was
208+
// exhausted under CI load by the cumulative cost of ~10 sequential
209+
// user interactions in this test (paste, click, paste, click, ...).
210+
// pointerEventsCheck: 0 moves to setup() because the v14 instance
211+
// .click() method doesn't accept per-call options (only the legacy
212+
// static userEvent.click did).
213+
// See https://github.com/elastic/kibana/issues/244001.
214+
const user = userEvent.setup({ delay: null, pointerEventsCheck: 0 });
207215
const finding1 = generateCspFinding('0001', 'failed');
208216
const finding2 = generateCspFinding('0002', 'passed');
209217

@@ -217,7 +225,7 @@ describe.skip('<Findings />', () => {
217225

218226
await waitFor(() => expect(screen.getByText(/2 findings/i)).toBeInTheDocument());
219227

220-
await userEvent.click(screen.getByTestId('addFilter'), { pointerEventsCheck: 0 });
228+
await user.click(screen.getByTestId('addFilter'));
221229

222230
await waitFor(() =>
223231
expect(screen.getByTestId('filterFieldSuggestionList')).toBeInTheDocument()
@@ -227,25 +235,25 @@ describe.skip('<Findings />', () => {
227235
screen.getByTestId('filterFieldSuggestionList')
228236
).getByTestId('comboBoxSearchInput');
229237

230-
await userEvent.click(filterFieldSuggestionListInput);
231-
await userEvent.paste('rule.section');
232-
await userEvent.keyboard('{enter}');
238+
await user.click(filterFieldSuggestionListInput);
239+
await user.paste('rule.section');
240+
await user.keyboard('{enter}');
233241

234242
const filterOperatorListInput = within(screen.getByTestId('filterOperatorList')).getByTestId(
235243
'comboBoxSearchInput'
236244
);
237-
await userEvent.click(filterOperatorListInput, { pointerEventsCheck: 0 });
245+
await user.click(filterOperatorListInput);
238246

239247
const filterOption = within(
240248
screen.getByTestId('comboBoxOptionsList filterOperatorList-optionsList')
241249
).getByRole('option', { name: 'is' });
242250
fireEvent.click(filterOption);
243251

244252
const filterParamsInput = within(screen.getByTestId('filterParams')).getByRole('textbox');
245-
await userEvent.click(filterParamsInput);
246-
await userEvent.paste(finding1.rule.section);
253+
await user.click(filterParamsInput);
254+
await user.paste(finding1.rule.section);
247255

248-
await userEvent.click(screen.getByTestId('saveFilter'), { pointerEventsCheck: 0 });
256+
await user.click(screen.getByTestId('saveFilter'));
249257

250258
await waitFor(() => expect(screen.getByText(/1 findings/i)).toBeInTheDocument());
251259
expect(screen.getByText(finding1.resource.name)).toBeInTheDocument();

0 commit comments

Comments
 (0)