Skip to content

Commit

Permalink
[Cases] Fix columnsPopover render flaky test (elastic#175778)
Browse files Browse the repository at this point in the history
## Summary

Fixes elastic#174682


### 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
  • Loading branch information
js-jankisalvi authored Jan 30, 2024
1 parent c0077d6 commit 1001bc6
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import React from 'react';
import { screen, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { waitForEuiPopoverOpen } from '@elastic/eui/lib/test/rtl';

import type { AppMockRenderer } from '../../common/mock';
import { createAppMockRenderer } from '../../common/mock';
Expand All @@ -34,6 +35,8 @@ describe('ColumnsPopover', () => {

userEvent.click(await screen.findByTestId('column-selection-popover-button'));

await waitForEuiPopoverOpen();

expect(await screen.findByTestId('column-selection-popover')).toBeInTheDocument();

selectedColumns.forEach(({ field, name, isChecked }) => {
Expand Down Expand Up @@ -132,6 +135,7 @@ describe('ColumnsPopover', () => {
);

userEvent.click(await screen.findByTestId('column-selection-popover-button'));
await waitForEuiPopoverOpen();
userEvent.paste(await screen.findByTestId('column-selection-popover-search'), 'Title');

expect(await screen.findByTestId('column-selection-switch-title')).toBeInTheDocument();
Expand All @@ -150,9 +154,12 @@ describe('ColumnsPopover', () => {
);

userEvent.click(await screen.findByTestId('column-selection-popover-button'));
await waitForEuiPopoverOpen();
userEvent.paste(await screen.findByTestId('column-selection-popover-search'), 'Category');

expect(onSelectedColumnsChange).not.toHaveBeenCalled();
await waitFor(() => {
expect(onSelectedColumnsChange).not.toHaveBeenCalled();
});
});

it('searching for text hides the drag and drop icons', async () => {
Expand All @@ -177,6 +184,9 @@ describe('ColumnsPopover', () => {
);

userEvent.click(await screen.findByTestId('column-selection-popover-button'));

await waitForEuiPopoverOpen();

userEvent.paste(await screen.findByTestId('column-selection-popover-search'), 'Foobar');

expect(await screen.findByTestId('column-selection-popover-show-all-button')).toBeDisabled();
Expand Down

0 comments on commit 1001bc6

Please sign in to comment.