Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] - Unskip threat hunting tests (elastic#195662)
Browse files Browse the repository at this point in the history
1. Added `cypress-network-idle` to better wait for a full page load as a
loading indicator flicker could cause flakiness.

2. List of addressed open issues:

Resolves elastic#191819
Resolves elastic#178367
Resolves elastic#176757
Resolves elastic#176759
Resolves elastic#176758
Resolves elastic#193840
Resolves elastic#182206
Resolves elastic#181977
Resolves elastic#168768
Resolves elastic#168769
Resolves elastic#168770
Resolves elastic#168771
Resolves elastic#168772
Resolves elastic#183104
Resolves elastic#173854

Successful Flaky Test Runner:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7267

---------

Co-authored-by: kibanamachine <[email protected]>
2 people authored and CAWilson94 committed Nov 8, 2024
1 parent a55a409 commit d5ff5a5
Showing 26 changed files with 391 additions and 377 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1690,6 +1690,7 @@
"cypress-axe": "^1.5.0",
"cypress-file-upload": "^5.0.8",
"cypress-multi-reporters": "^1.6.4",
"cypress-network-idle": "^1.14.2",
"cypress-real-events": "^1.11.0",
"cypress-recurse": "^1.35.2",
"date-fns": "^2.29.3",
Original file line number Diff line number Diff line change
@@ -25,8 +25,7 @@ const loadDetectionsPage = (role: SecurityRoleName) => {
waitForAlertsToPopulate();
};

// Failing: See https://github.com/elastic/kibana/issues/191819
describe.skip('Alerts timeline', { tags: ['@ess'] }, () => {
describe('Alerts timeline', () => {
beforeEach(() => {
// First we login as a privileged user to create alerts.
deleteAlertsAndRules();
@@ -36,7 +35,7 @@ describe.skip('Alerts timeline', { tags: ['@ess'] }, () => {
waitForAlertsToPopulate();
});

context('Privileges: read only', () => {
context('Privileges: read only', { tags: ['@ess'] }, () => {
beforeEach(() => {
loadDetectionsPage(ROLES.reader);
});
@@ -52,7 +51,7 @@ describe.skip('Alerts timeline', { tags: ['@ess'] }, () => {
});
});

context('Privileges: can crud', () => {
context('Privileges: can crud', { tags: ['@ess', '@serverless'] }, () => {
beforeEach(() => {
loadDetectionsPage(ROLES.platform_engineer);
cy.get(LOADING_INDICATOR).should('not.exist');
Original file line number Diff line number Diff line change
@@ -21,72 +21,66 @@ import { visitWithTimeRange } from '../../../tasks/navigation';
import { waitForWelcomePanelToBeLoaded } from '../../../tasks/common';
import { selectDataView } from '../../../tasks/sourcerer';
import { postDataView } from '../../../tasks/api_calls/common';
import { mockRiskEngineEnabled } from '../../../tasks/entity_analytics';

const DATA_VIEW = 'auditbeat-*';

// FLAKY: https://github.com/elastic/kibana/issues/178367
describe.skip(
'Inspect Explore pages',
{ tags: ['@ess', '@serverless', '@skipInServerlessMKI'] },
() => {
before(() => {
// illegal_argument_exception: unknown setting [index.lifecycle.name]
cy.task('esArchiverLoad', { archiveName: 'risk_users' });
cy.task('esArchiverLoad', { archiveName: 'risk_hosts' });
describe('Inspect Explore pages', { tags: ['@ess', '@serverless'] }, () => {
beforeEach(() => {
// illegal_argument_exception: unknown setting [index.lifecycle.name]
cy.task('esArchiverLoad', { archiveName: 'risk_scores_new' });
login();
mockRiskEngineEnabled();
// Create and select data view
postDataView(DATA_VIEW);
});

login();
// Create and select data view
postDataView(DATA_VIEW);
});

after(() => {
cy.task('esArchiverUnload', { archiveName: 'risk_users' });
cy.task('esArchiverUnload', { archiveName: 'risk_hosts' });
});
afterEach(() => {
cy.task('esArchiverUnload', { archiveName: 'risk_scores_new' });
});

INSPECT_BUTTONS_IN_SECURITY.forEach(({ pageName, url, lensVisualizations, tables }) => {
/**
* Group all tests of a page into one "it" call to improve speed
*/
it(`inspect ${pageName} page`, () => {
login();
INSPECT_BUTTONS_IN_SECURITY.forEach(({ pageName, url, lensVisualizations, tables }) => {
/**
* Group all tests of a page into one "it" call to improve speed
*/
it(`inspect ${pageName} page`, () => {
login();

visitWithTimeRange(url, {
visitOptions: {
onLoad: () => {
waitForWelcomePanelToBeLoaded();
selectDataView(DATA_VIEW);
},
visitWithTimeRange(url, {
visitOptions: {
onLoad: () => {
waitForWelcomePanelToBeLoaded();
selectDataView(DATA_VIEW);
},
});

lensVisualizations.forEach((lens) => {
cy.log(`inspects the ${lens.title} visualization`);
openTab(lens.tab);

openLensVisualizationsInspectModal(lens, () => {
cy.get(INSPECT_MODAL).should('be.visible');
cy.get(INSPECT_MODAL_INDEX_PATTERN).should(
'contain.text',
lens.customIndexPattern ? lens.customIndexPattern : DATA_VIEW
);
});
});
},
});

tables.forEach((table) => {
cy.log(`inspects the ${table.title}`);
openTab(table.tab);
lensVisualizations.forEach((lens) => {
cy.log(`inspects the ${lens.title} visualization`);
openTab(lens.tab);

openTableInspectModal(table);
openLensVisualizationsInspectModal(lens, () => {
cy.get(INSPECT_MODAL).should('be.visible');
cy.get(INSPECT_MODAL_INDEX_PATTERN).should(
'contain.text',
table.customIndexPattern ? table.customIndexPattern : DATA_VIEW
lens.customIndexPattern ? lens.customIndexPattern : DATA_VIEW
);

closesModal();
});
});

tables.forEach((table) => {
cy.log(`inspects the ${table.title}`);
openTab(table.tab);

openTableInspectModal(table);
cy.get(INSPECT_MODAL).should('be.visible');
cy.get(INSPECT_MODAL_INDEX_PATTERN).should(
'contain.text',
table.customIndexPattern ? table.customIndexPattern : DATA_VIEW
);

closesModal();
});
});
}
);
});
});
Loading

0 comments on commit d5ff5a5

Please sign in to comment.