Skip to content

Commit

Permalink
[8.16] [Security Solution][Data Quality Dashboard] fix tests and pote…
Browse files Browse the repository at this point in the history
…ntial tests timing out on ci (#196591) (#200549)

# Backport

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

<!--- Backport version: 8.9.8 -->

### 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","v8.17.0"],"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","labelRegex":"^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"}},{"branch":"8.x","label":"v8.17.0","labelRegex":"^v8.17.0$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/198717","number":198717,"state":"MERGED","mergeCommit":{"sha":"273a1eef0fb2f3c717f9fff8be2097892b8b8b90","message":"[8.x]
[Security Solution][Data Quality Dashboard] fix tests and potential
tests timing out on ci (#196591) (#198717)\n\n# Backport\n\nThis will
backport the following commits from `main` to `8.x`:\n- [[Security
Solution][Data Quality Dashboard] fix tests and potential\ntests timing
out on
ci\n(#196591)](https://github.com/elastic/kibana/pull/196591)\n\n<!---
Backport version: 9.4.3 -->\n\n### Questions ?\nPlease refer to the
[Backport
tool\ndocumentation](https://github.com/sqren/backport)\n\n<!--BACKPORT
[{\"author\":{\"name\":\"Karen\nGrigoryan\",\"email\":\"[email protected]\"},\"sourceCommit\":{\"committedDate\":\"2024-11-01T18:59:41Z\",\"message\":\"[Security\nSolution][Data
Quality Dashboard] fix tests and potential tests timing\nout on ci
(#196591)\\n\\naddresses #196216\\r\\n\\r\\nRemoving
accessibility\nselectors to ensure 10x speed of tests
with\\r\\ndata-test-subj\nlocators.\",\"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\nHunting\",\"Team:Threat\nHunting:Explore\",\"backport:prev-minor\"],\"title\":\"[Security\nSolution][Data
Quality Dashboard] fix tests and potential tests timing\nout
on\nci\",\"number\":196591,\"url\":\"https://github.com/elastic/kibana/pull/196591\",\"mergeCommit\":{\"message\":\"[Security\nSolution][Data
Quality Dashboard] fix tests and potential tests timing\nout on ci
(#196591)\\n\\naddresses #196216\\r\\n\\r\\nRemoving
accessibility\nselectors to ensure 10x speed of tests
with\\r\\ndata-test-subj\nlocators.\",\"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\nSolution][Data
Quality Dashboard] fix tests and potential tests timing\nout on ci
(#196591)\\n\\naddresses #196216\\r\\n\\r\\nRemoving
accessibility\nselectors to ensure 10x speed of tests
with\\r\\ndata-test-subj\nlocators.\",\"sha\":\"b5a705e54cd9c657064cc67f8cf1b72f4324d3ab\"}}]}]\nBACKPORT-->\n\nCo-authored-by:
Karen Grigoryan <[email protected]>"}}]}] BACKPORT-->
  • Loading branch information
kapral18 authored Nov 18, 2024
1 parent d91cdcb commit d23bd99
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 d23bd99

Please sign in to comment.