Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] [Security Solution][Data Quality Dashboard] fix tests and potential tests timing out on ci (#196591) #198717

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,23 +95,20 @@ describe('IndicesDetails', () => {
describe('tour', () => {
test('it renders the tour wrapping view history button of first row of first non-empty pattern', async () => {
const wrapper = await screen.findByTestId('historicalResultsTour');
const button = within(wrapper).getByRole('button', { name: 'View history' });
expect(button).toBeInTheDocument();
const button = within(wrapper).getByTestId(
'viewHistoryAction-.internal.alerts-security.alerts-default-000001'
);
expect(button).toHaveAttribute('data-tour-element', patterns[1]);

expect(
screen.getByRole('dialog', { name: 'Introducing data quality history' })
).toBeInTheDocument();
expect(screen.getByTestId('historicalResultsTourPanel')).toHaveTextContent(
'Introducing data quality history'
);
});

describe('when the tour is dismissed', () => {
test('it hides the tour and persists in localStorage', async () => {
const wrapper = await screen.findByRole('dialog', {
name: 'Introducing data quality history',
});

const button = within(wrapper).getByRole('button', { name: 'Close' });

const wrapper = screen.getByTestId('historicalResultsTourPanel');
const button = within(wrapper).getByText('Close');
await userEvent.click(button);

await waitFor(() => expect(screen.queryByTestId('historicalResultsTour')).toBeNull());
Expand All @@ -127,24 +124,22 @@ describe('IndicesDetails', () => {
const firstNonEmptyPatternAccordionWrapper = await screen.findByTestId(
`${patterns[1]}PatternPanel`
);
const accordionToggle = within(firstNonEmptyPatternAccordionWrapper).getByRole('button', {
name: /Pass/,
});
const accordionToggle = within(firstNonEmptyPatternAccordionWrapper).getByTestId(
'indexResultBadge'
);
await userEvent.click(accordionToggle);

const secondPatternAccordionWrapper = screen.getByTestId(`${patterns[2]}PatternPanel`);
const historicalResultsWrapper = await within(secondPatternAccordionWrapper).findByTestId(
'historicalResultsTour'
);
const button = within(historicalResultsWrapper).getByRole('button', {
name: 'View history',
});
const button = within(historicalResultsWrapper).getByTestId(
`viewHistoryAction-${patternIndexNames[patterns[2]][0]}`
);
expect(button).toHaveAttribute('data-tour-element', patterns[2]);

expect(
screen.getByRole('dialog', { name: 'Introducing data quality history' })
).toBeInTheDocument();
}, 10000);
expect(screen.getByTestId('historicalResultsTourPanel')).toBeInTheDocument();
});
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ export const HistoricalResultsTour: FC<Props> = ({
repositionOnScroll
anchor={anchorElement}
zIndex={zIndex}
panelProps={{
'data-test-subj': 'historicalResultsTourPanel',
}}
footerAction={[
<EuiButtonEmpty size="xs" color="text" onClick={onDismissTour}>
{CLOSE}
Expand Down
Loading