[8.x] [EDR Workflows] Unskip and fix flaky endpoint exceptions FTR (#197457) (#197662)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[EDR Workflows] Unskip and fix flaky endpoint exceptions FTR
(#197457)](https://github.com/elastic/kibana/pull/197457)

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

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

<!--BACKPORT [{"author":{"name":"Gergő
Ábrahám","email":"gergo.abraham@elastic.co"},"sourceCommit":{"committedDate":"2024-10-24T14:27:08Z","message":"[EDR
Workflows] Unskip and fix flaky endpoint exceptions FTR (#197457)\n\n##
Summary\r\n\r\ncloses #173184 \r\ncloses #173441\r\ncloses
#196003\r\n\r\nThis PR tries to improve on the
`StaleElementReferenceError` happening\r\nin Endpoint Exception
tests.\r\n\r\nThis error is thrown if an element has already been
removed from the DOM\r\nwhen trying to perform an action on it. For some
reference,
see\r\nhttps://github.com/elastic/kibana/pull/140427\r\n\r\nImprovements:\r\n-
the part that was failing is wrapped inside the `retryOnStale`
helper:\r\n602f2294fddb9bee8b69ebf2fd8382e9f025d59d\r\n**note:**
actually the test fails have started in December, 2023, but\r\nthe line
where the fail was in the last test runs were added in May,\r\n2024
(https://github.com/elastic/kibana/pull/183471). unfortunately,
the\r\nlog artifacts from 2023 are already removed from Buildkite, so
no\r\ncertainty on what happened back then\r\n- another suspicious part
was wrapped as well:\r\nec8c5cfd94812c8e5b357e00aac8bfae93ceecf4
and\r\ne5245ad010a02527105a56973465a25feb52ec85\r\n- and as an extra,
wait for page
load:\r\n7cd867fcb9489b24e79066dce750a2381af93d7d\r\n\r\nflaky 50/50 
but this doesn't mean much, as this issue happens quite\r\nrarely
¯\\\\(◉‿◉)/¯\r\n\r\n\r\n### Checklist\r\n\r\nDelete any items that are
not applicable to this PR.\r\n\r\n- [x] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n\r\n---------\r\n\r\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"f151e2ccaa55cc5e13740f49e88c323c0e1d8f6d","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:Defend
Workflows","backport:prev-major"],"title":"[EDR Workflows] Unskip and
fix flaky endpoint exceptions
FTR","number":197457,"url":"https://github.com/elastic/kibana/pull/197457","mergeCommit":{"message":"[EDR
Workflows] Unskip and fix flaky endpoint exceptions FTR (#197457)\n\n##
Summary\r\n\r\ncloses #173184 \r\ncloses #173441\r\ncloses
#196003\r\n\r\nThis PR tries to improve on the
`StaleElementReferenceError` happening\r\nin Endpoint Exception
tests.\r\n\r\nThis error is thrown if an element has already been
removed from the DOM\r\nwhen trying to perform an action on it. For some
reference,
see\r\nhttps://github.com/elastic/kibana/pull/140427\r\n\r\nImprovements:\r\n-
the part that was failing is wrapped inside the `retryOnStale`
helper:\r\n602f2294fddb9bee8b69ebf2fd8382e9f025d59d\r\n**note:**
actually the test fails have started in December, 2023, but\r\nthe line
where the fail was in the last test runs were added in May,\r\n2024
(https://github.com/elastic/kibana/pull/183471). unfortunately,
the\r\nlog artifacts from 2023 are already removed from Buildkite, so
no\r\ncertainty on what happened back then\r\n- another suspicious part
was wrapped as well:\r\nec8c5cfd94812c8e5b357e00aac8bfae93ceecf4
and\r\ne5245ad010a02527105a56973465a25feb52ec85\r\n- and as an extra,
wait for page
load:\r\n7cd867fcb9489b24e79066dce750a2381af93d7d\r\n\r\nflaky 50/50 
but this doesn't mean much, as this issue happens quite\r\nrarely
¯\\\\(◉‿◉)/¯\r\n\r\n\r\n### Checklist\r\n\r\nDelete any items that are
not applicable to this PR.\r\n\r\n- [x] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n\r\n---------\r\n\r\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"f151e2ccaa55cc5e13740f49e88c323c0e1d8f6d"}},"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/197457","number":197457,"mergeCommit":{"message":"[EDR
Workflows] Unskip and fix flaky endpoint exceptions FTR (#197457)\n\n##
Summary\r\n\r\ncloses #173184 \r\ncloses #173441\r\ncloses
#196003\r\n\r\nThis PR tries to improve on the
`StaleElementReferenceError` happening\r\nin Endpoint Exception
tests.\r\n\r\nThis error is thrown if an element has already been
removed from the DOM\r\nwhen trying to perform an action on it. For some
reference,
see\r\nhttps://github.com/elastic/kibana/pull/140427\r\n\r\nImprovements:\r\n-
the part that was failing is wrapped inside the `retryOnStale`
helper:\r\n602f2294fddb9bee8b69ebf2fd8382e9f025d59d\r\n**note:**
actually the test fails have started in December, 2023, but\r\nthe line
where the fail was in the last test runs were added in May,\r\n2024
(https://github.com/elastic/kibana/pull/183471). unfortunately,
the\r\nlog artifacts from 2023 are already removed from Buildkite, so
no\r\ncertainty on what happened back then\r\n- another suspicious part
was wrapped as well:\r\nec8c5cfd94812c8e5b357e00aac8bfae93ceecf4
and\r\ne5245ad010a02527105a56973465a25feb52ec85\r\n- and as an extra,
wait for page
load:\r\n7cd867fcb9489b24e79066dce750a2381af93d7d\r\n\r\nflaky 50/50 
but this doesn't mean much, as this issue happens quite\r\nrarely
¯\\\\(◉‿◉)/¯\r\n\r\n\r\n### Checklist\r\n\r\nDelete any items that are
not applicable to this PR.\r\n\r\n- [x] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n\r\n---------\r\n\r\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"f151e2ccaa55cc5e13740f49e88c323c0e1d8f6d"}}]}]
BACKPORT-->

Co-authored-by: Gergő Ábrahám <gergo.abraham@elastic.co>
This commit is contained in:
Kibana Machine 2024-10-25 03:16:23 +11:00 committed by GitHub
parent ccc7398809
commit e802a192a4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 23 additions and 17 deletions

View file

@ -22,6 +22,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
const endpointTestResources = getService('endpointTestResources');
const endpointArtifactTestResources = getService('endpointArtifactTestResources');
const retry = getService('retry');
const retryOnStale = getService('retryOnStale');
const esClient = getService('es');
const supertest = getService('supertest');
const find = getService('find');
@ -32,26 +33,15 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
describe('Endpoint Exceptions', function () {
targetTags(this, ['@ess', '@serverless']);
this.timeout(10 * MINUTES);
const clearPrefilledEntries = async () => {
const entriesContainer = await testSubjects.find('exceptionEntriesContainer');
let deleteButtons: WebElementWrapper[];
do {
deleteButtons = await testSubjects.findAllDescendant(
'builderItemEntryDeleteButton',
entriesContainer
);
await deleteButtons[0].click();
} while (deleteButtons.length > 1);
};
let clearPrefilledEntries: () => Promise<void>;
const openNewEndpointExceptionFlyout = async () => {
await testSubjects.scrollIntoView('timeline-context-menu-button');
await testSubjects.click('timeline-context-menu-button');
retryOnStale(async () => {
await testSubjects.scrollIntoView('timeline-context-menu-button');
await testSubjects.click('timeline-context-menu-button');
});
await testSubjects.click('add-endpoint-exception-menu-item');
await testSubjects.existOrFail('addExceptionFlyout');
@ -164,10 +154,25 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
};
await deleteEndpointExceptions();
clearPrefilledEntries = retryOnStale.wrap(async () => {
const entriesContainer = await testSubjects.find('exceptionEntriesContainer');
let deleteButtons: WebElementWrapper[];
do {
deleteButtons = await testSubjects.findAllDescendant(
'builderItemEntryDeleteButton',
entriesContainer
);
await deleteButtons[0].click();
} while (deleteButtons.length > 1);
});
});
it('should add `event.module=endpoint` to entry if only wildcard operator is present', async () => {
await pageObjects.common.navigateToUrlWithBrowserHistory('security', `/alerts`);
await pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.timePicker.setCommonlyUsedTime('Last_24 hours');
await openNewEndpointExceptionFlyout();
@ -213,6 +218,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
it('should NOT add `event.module=endpoint` to entry if there is another operator', async () => {
await pageObjects.common.navigateToUrlWithBrowserHistory('security', `/alerts`);
await pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.timePicker.setCommonlyUsedTime('Last_24 hours');
await openNewEndpointExceptionFlyout();

View file

@ -12,7 +12,7 @@ import { FtrProviderContext } from '../../configs/ftr_provider_context';
export default function (providerContext: FtrProviderContext) {
const { loadTestFile, getService, getPageObjects } = providerContext;
describe('endpoint', function () {
describe('integrations', function () {
const ingestManager = getService('ingestManager');
const log = getService('log');
const endpointTestResources = getService('endpointTestResources');