Skip to content

Commit

Permalink
[Cases] Severity flaky test (elastic#176589)
Browse files Browse the repository at this point in the history
Fixes elastic#176337
Fixes elastic#176336

## Summary

The usual fix. Running 200 times now to see if it works.
  • Loading branch information
adcoelho authored and CoenWarmer committed Feb 15, 2024
1 parent 5459714 commit faccdf8
Showing 1 changed file with 15 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ import { screen, waitFor } from '@testing-library/react';
import { waitForEuiPopoverOpen } from '@elastic/eui/lib/test/rtl';
import { SeverityFilter } from './severity_filter';

// FLAKY: https://github.com/elastic/kibana/issues/176336
// FLAKY: https://github.com/elastic/kibana/issues/176337
describe.skip('Severity form field', () => {
describe('Severity form field', () => {
const onChange = jest.fn();
let appMockRender: AppMockRenderer;
const props = {
Expand All @@ -30,28 +28,31 @@ describe.skip('Severity form field', () => {

it('renders', async () => {
appMockRender.render(<SeverityFilter {...props} />);
expect(screen.getByTestId('options-filter-popover-button-severity')).toBeInTheDocument();
expect(screen.getByTestId('options-filter-popover-button-severity')).not.toBeDisabled();
expect(await screen.findByTestId('options-filter-popover-button-severity')).toBeInTheDocument();
expect(await screen.findByTestId('options-filter-popover-button-severity')).not.toBeDisabled();

userEvent.click(screen.getByRole('button', { name: 'Severity' }));
userEvent.click(await screen.findByRole('button', { name: 'Severity' }));
await waitForEuiPopoverOpen();

expect(screen.getByRole('option', { name: CaseSeverity.LOW })).toBeInTheDocument();
expect(screen.getByRole('option', { name: CaseSeverity.MEDIUM })).toBeInTheDocument();
expect(screen.getByRole('option', { name: CaseSeverity.HIGH })).toBeInTheDocument();
expect(screen.getByRole('option', { name: CaseSeverity.CRITICAL })).toBeInTheDocument();
expect(screen.getAllByRole('option').length).toBe(4);
expect(await screen.findByRole('option', { name: CaseSeverity.LOW })).toBeInTheDocument();
expect(await screen.findByRole('option', { name: CaseSeverity.MEDIUM })).toBeInTheDocument();
expect(await screen.findByRole('option', { name: CaseSeverity.HIGH })).toBeInTheDocument();
expect(await screen.findByRole('option', { name: CaseSeverity.CRITICAL })).toBeInTheDocument();
expect((await screen.findAllByRole('option')).length).toBe(4);
});

it('selects the correct value when changed', async () => {
appMockRender.render(<SeverityFilter {...props} />);

userEvent.click(screen.getByRole('button', { name: 'Severity' }));
userEvent.click(await screen.findByRole('button', { name: 'Severity' }));
await waitForEuiPopoverOpen();
userEvent.click(screen.getByRole('option', { name: 'high' }));
userEvent.click(await screen.findByRole('option', { name: 'high' }));

await waitFor(() => {
expect(onChange).toHaveBeenCalledWith({ filterId: 'severity', selectedOptionKeys: ['high'] });
expect(onChange).toHaveBeenCalledWith({
filterId: 'severity',
selectedOptionKeys: ['high'],
});
});
});
});

0 comments on commit faccdf8

Please sign in to comment.