mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[ResponseOps][Cases] Fix StatusFilter
flaky test (#189982)
fixes #177334 ## Summary The failing test `should render` had waaay too many unnecessary tree traversals. I reduced the `find`s from 7 to 3 hopefully making the test significantly faster. (I did the same on other tests but they weren't failing. Doesn't hurt though.)
This commit is contained in:
parent
c2f7330625
commit
1cb191fb69
1 changed files with 14 additions and 10 deletions
|
@ -19,8 +19,7 @@ const LABELS = {
|
|||
inProgress: i18n.STATUS_IN_PROGRESS,
|
||||
};
|
||||
|
||||
// FLAKY: https://github.com/elastic/kibana/issues/177334
|
||||
describe.skip('StatusFilter', () => {
|
||||
describe('StatusFilter', () => {
|
||||
const onChange = jest.fn();
|
||||
const defaultProps = {
|
||||
selectedOptionKeys: [],
|
||||
|
@ -37,16 +36,18 @@ describe.skip('StatusFilter', () => {
|
|||
it('should render', async () => {
|
||||
render(<StatusFilter {...defaultProps} />);
|
||||
|
||||
expect(await screen.findByTestId('options-filter-popover-button-status')).toBeInTheDocument();
|
||||
expect(await screen.findByTestId('options-filter-popover-button-status')).not.toBeDisabled();
|
||||
|
||||
userEvent.click(await screen.findByRole('button', { name: 'Status' }));
|
||||
|
||||
await waitForEuiPopoverOpen();
|
||||
|
||||
expect(await screen.findByRole('option', { name: LABELS.open })).toBeInTheDocument();
|
||||
expect(await screen.findByRole('option', { name: LABELS.inProgress })).toBeInTheDocument();
|
||||
expect(await screen.findByRole('option', { name: LABELS.closed })).toBeInTheDocument();
|
||||
expect((await screen.findAllByRole('option')).length).toBe(3);
|
||||
const options = await screen.findAllByRole('option');
|
||||
|
||||
expect(options.length).toBe(3);
|
||||
expect(options[0]).toHaveTextContent(LABELS.open);
|
||||
expect(options[1]).toHaveTextContent(LABELS.inProgress);
|
||||
expect(options[2]).toHaveTextContent(LABELS.closed);
|
||||
});
|
||||
|
||||
it('should call onStatusChanged when changing status to open', async () => {
|
||||
|
@ -68,10 +69,13 @@ describe.skip('StatusFilter', () => {
|
|||
render(<StatusFilter {...defaultProps} hiddenStatuses={[CaseStatuses.closed]} />);
|
||||
|
||||
userEvent.click(await screen.findByRole('button', { name: 'Status' }));
|
||||
|
||||
await waitForEuiPopoverOpen();
|
||||
|
||||
expect(await screen.findAllByRole('option')).toHaveLength(2);
|
||||
expect(await screen.findByRole('option', { name: LABELS.open })).toBeInTheDocument();
|
||||
expect(await screen.findByRole('option', { name: LABELS.inProgress })).toBeInTheDocument();
|
||||
const options = await screen.findAllByRole('option');
|
||||
|
||||
expect(options.length).toBe(2);
|
||||
expect(options[0]).toHaveTextContent(LABELS.open);
|
||||
expect(options[1]).toHaveTextContent(LABELS.inProgress);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue