Skip to content

Commit

Permalink
[8.x] [Security Solution][Data Quality Dashboard] fix tests and poten…
Browse files Browse the repository at this point in the history
…tial tests timing out on ci (#196591) (#198717)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Security Solution][Data Quality Dashboard] fix tests and potential
tests timing out on ci
(#196591)](#196591)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Karen
Grigoryan","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-01T18:59:41Z","message":"[Security
Solution][Data Quality Dashboard] fix tests and potential tests timing
out on ci (#196591)\n\naddresses #196216\r\n\r\nRemoving accessibility
selectors to ensure 10x speed of tests with\r\ndata-test-subj
locators.","sha":"b5a705e54cd9c657064cc67f8cf1b72f4324d3ab","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Threat
Hunting","Team:Threat
Hunting:Explore","backport:prev-minor"],"title":"[Security
Solution][Data Quality Dashboard] fix tests and potential tests timing
out on
ci","number":196591,"url":"https://github.com/elastic/kibana/pull/196591","mergeCommit":{"message":"[Security
Solution][Data Quality Dashboard] fix tests and potential tests timing
out on ci (#196591)\n\naddresses #196216\r\n\r\nRemoving accessibility
selectors to ensure 10x speed of tests with\r\ndata-test-subj
locators.","sha":"b5a705e54cd9c657064cc67f8cf1b72f4324d3ab"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/196591","number":196591,"mergeCommit":{"message":"[Security
Solution][Data Quality Dashboard] fix tests and potential tests timing
out on ci (#196591)\n\naddresses #196216\r\n\r\nRemoving accessibility
selectors to ensure 10x speed of tests with\r\ndata-test-subj
locators.","sha":"b5a705e54cd9c657064cc67f8cf1b72f4324d3ab"}}]}]
BACKPORT-->

Co-authored-by: Karen Grigoryan <[email protected]>
  • Loading branch information
kibanamachine and kapral18 authored Nov 1, 2024
1 parent d0a6118 commit 273a1ee
Show file tree
Hide file tree
Showing 11 changed files with 185 additions and 225 deletions.
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

0 comments on commit 273a1ee

Please sign in to comment.