mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[Security Solution] fix change alert status flaky tests (#166538)
## Summary This PR unskips and fixes some cypress test related to changing alert status per https://github.com/elastic/kibana/issues/166415
This commit is contained in:
parent
0c680d7783
commit
ac2d3db3ff
2 changed files with 15 additions and 25 deletions
|
@ -120,13 +120,14 @@ describe('Changing alert status', { tags: ['@ess', '@brokenInServerless'] }, ()
|
|||
});
|
||||
context('Marking alerts as acknowledged', () => {
|
||||
beforeEach(() => {
|
||||
login();
|
||||
deleteAlertsAndRules();
|
||||
createRule(getNewRule());
|
||||
visit(ALERTS_URL);
|
||||
waitForAlertsToPopulate();
|
||||
selectCountTable();
|
||||
});
|
||||
it.skip('Mark one alert as acknowledged when more than one open alerts are selected', () => {
|
||||
it('Mark one alert as acknowledged when more than one open alerts are selected', () => {
|
||||
cy.get(ALERTS_COUNT)
|
||||
.invoke('text')
|
||||
.then((alertNumberString) => {
|
||||
|
@ -139,6 +140,7 @@ describe('Changing alert status', { tags: ['@ess', '@brokenInServerless'] }, ()
|
|||
cy.get(TAKE_ACTION_POPOVER_BTN).should('exist');
|
||||
|
||||
markAcknowledgedFirstAlert();
|
||||
waitForAlerts();
|
||||
const expectedNumberOfAlerts = +numberOfAlerts - numberOfAlertsToBeMarkedAcknowledged;
|
||||
cy.get(ALERTS_COUNT).should('have.text', `${expectedNumberOfAlerts} alerts`);
|
||||
sumAlertCountFromAlertCountTable((sumAlerts) => {
|
||||
|
@ -228,7 +230,7 @@ describe('Changing alert status', { tags: ['@ess', '@brokenInServerless'] }, ()
|
|||
});
|
||||
});
|
||||
|
||||
it.skip('Closes one alert when more than one opened alerts are selected', () => {
|
||||
it('Closes one alert when more than one opened alerts are selected', () => {
|
||||
cy.get(ALERTS_COUNT)
|
||||
.invoke('text')
|
||||
.then((alertNumberString) => {
|
||||
|
@ -308,8 +310,7 @@ describe('Changing alert status', { tags: ['@ess', '@brokenInServerless'] }, ()
|
|||
});
|
||||
});
|
||||
|
||||
// TODO: Are you sure that read only role should be able to close alerts?
|
||||
context.skip('Changing alert status with read only role', () => {
|
||||
context('Changing alert status with read only role', () => {
|
||||
beforeEach(() => {
|
||||
login(ROLES.t2_analyst);
|
||||
deleteAlertsAndRules();
|
||||
|
@ -319,12 +320,11 @@ describe('Changing alert status', { tags: ['@ess', '@brokenInServerless'] }, ()
|
|||
selectCountTable();
|
||||
});
|
||||
|
||||
it.skip('Mark one alert as acknowledged when more than one open alerts are selected', () => {
|
||||
it('Mark one alert as acknowledged when more than one open alerts are selected', () => {
|
||||
cy.get(ALERTS_COUNT)
|
||||
.invoke('text')
|
||||
.then((alertNumberString) => {
|
||||
const numberOfAlerts = alertNumberString.split(' ')[0];
|
||||
const numberOfAlertsToBeMarkedAcknowledged = 1;
|
||||
const numberOfAlertsToBeSelected = 3;
|
||||
|
||||
cy.get(TAKE_ACTION_POPOVER_BTN).should('not.exist');
|
||||
|
@ -332,19 +332,10 @@ describe('Changing alert status', { tags: ['@ess', '@brokenInServerless'] }, ()
|
|||
cy.get(TAKE_ACTION_POPOVER_BTN).should('exist');
|
||||
|
||||
markAcknowledgedFirstAlert();
|
||||
const expectedNumberOfAlerts = +numberOfAlerts - numberOfAlertsToBeMarkedAcknowledged;
|
||||
cy.get(ALERTS_COUNT).should('have.text', `${expectedNumberOfAlerts} alerts`);
|
||||
cy.get(ALERTS_COUNT).should('have.text', `${numberOfAlerts} alerts`); // user with read only role cannot mark alerts as acknowledged
|
||||
|
||||
sumAlertCountFromAlertCountTable((sumAlerts) => {
|
||||
expect(sumAlerts).to.eq(parseAlertsCountToInt(expectedNumberOfAlerts));
|
||||
});
|
||||
goToAcknowledgedAlerts();
|
||||
waitForAlerts();
|
||||
|
||||
cy.get(ALERTS_COUNT).should('have.text', `${numberOfAlertsToBeMarkedAcknowledged} alert`);
|
||||
|
||||
sumAlertCountFromAlertCountTable((sumAlerts) => {
|
||||
expect(sumAlerts).to.eq(parseAlertsCountToInt(numberOfAlertsToBeMarkedAcknowledged));
|
||||
expect(sumAlerts).to.eq(parseAlertsCountToInt(numberOfAlerts));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -369,16 +360,11 @@ describe('Changing alert status', { tags: ['@ess', '@brokenInServerless'] }, ()
|
|||
closeAlerts();
|
||||
waitForAlerts();
|
||||
|
||||
const expectedNumberOfAlertsAfterClosing = +numberOfAlerts - numberOfAlertsToBeClosed;
|
||||
cy.get(ALERTS_COUNT).should('have.text', `${expectedNumberOfAlertsAfterClosing} alerts`);
|
||||
cy.get(ALERTS_COUNT).should('have.text', `${numberOfAlerts} alerts`); // user with read only role cannot mark alerts as acknowledged
|
||||
|
||||
sumAlertCountFromAlertCountTable((sumAlerts) => {
|
||||
expect(sumAlerts).to.eq(parseAlertsCountToInt(expectedNumberOfAlertsAfterClosing));
|
||||
expect(sumAlerts).to.eq(parseAlertsCountToInt(numberOfAlerts));
|
||||
});
|
||||
goToClosedAlerts();
|
||||
waitForAlerts();
|
||||
|
||||
cy.get(ALERTS_COUNT).should('have.text', `${numberOfAlertsToBeClosed} alerts`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -113,6 +113,7 @@ export const openAddEndpointExceptionFromAlertActionButton = () => {
|
|||
};
|
||||
export const closeFirstAlert = () => {
|
||||
expandFirstAlertActions();
|
||||
cy.get(CLOSE_ALERT_BTN).should('be.visible');
|
||||
cy.get(CLOSE_ALERT_BTN).click();
|
||||
cy.get(CLOSE_ALERT_BTN).should('not.exist');
|
||||
};
|
||||
|
@ -128,6 +129,7 @@ export const expandFirstAlertActions = () => {
|
|||
waitForAlerts();
|
||||
|
||||
const togglePopover = () => {
|
||||
cy.get(TIMELINE_CONTEXT_MENU_BTN).first().should('be.visible');
|
||||
cy.get(TIMELINE_CONTEXT_MENU_BTN).first().click();
|
||||
cy.get(TIMELINE_CONTEXT_MENU_BTN)
|
||||
.first()
|
||||
|
@ -191,6 +193,7 @@ export const closePageFilterPopover = (filterIndex: number) => {
|
|||
};
|
||||
|
||||
export const clearAllSelections = (filterIndex: number) => {
|
||||
cy.scrollTo('top');
|
||||
recurse(
|
||||
() => {
|
||||
cy.get(CONTROL_FRAME_TITLE).eq(filterIndex).realHover();
|
||||
|
@ -264,7 +267,7 @@ export const goToOpenedAlerts = () => {
|
|||
export const openFirstAlert = () => {
|
||||
expandFirstAlertActions();
|
||||
cy.get(OPEN_ALERT_BTN).should('be.visible');
|
||||
cy.get(OPEN_ALERT_BTN).click({ force: true });
|
||||
cy.get(OPEN_ALERT_BTN).click();
|
||||
};
|
||||
|
||||
export const openAlerts = () => {
|
||||
|
@ -303,6 +306,7 @@ export const goToAcknowledgedAlerts = () => {
|
|||
|
||||
export const markAcknowledgedFirstAlert = () => {
|
||||
expandFirstAlertActions();
|
||||
cy.get(MARK_ALERT_ACKNOWLEDGED_BTN).should('be.visible');
|
||||
cy.get(MARK_ALERT_ACKNOWLEDGED_BTN).click();
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue