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

[EDR Workflows] Unskip and fix flaky endpoint exceptions FTR #197457

Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -30,30 +31,17 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
const toasts = getService('toasts');
const MINUTES = 60 * 1000 * 10;

// FLAKY: https://github.com/elastic/kibana/issues/173441
// Failing: See https://github.com/elastic/kibana/issues/173441
describe.skip('Endpoint Exceptions', function () {
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');

Expand Down Expand Up @@ -166,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();
Expand Down Expand Up @@ -215,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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down