Skip to content

Commit

Permalink
[EDR Workflows] Unskip tests failing due to new alerts popover (elast…
Browse files Browse the repository at this point in the history
  • Loading branch information
tomsonpl authored Apr 17, 2024
1 parent 29fb11b commit 1d88277
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 13 deletions.
12 changes: 8 additions & 4 deletions x-pack/plugins/osquery/cypress/e2e/all/alerts_cases.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ import {
submitQuery,
viewRecentCaseAndCheckResults,
} from '../../tasks/live_query';
import { generateRandomStringName, interceptCaseId } from '../../tasks/integrations';
import {
closeAlertsStepTourIfVisible,
generateRandomStringName,
interceptCaseId,
} from '../../tasks/integrations';

// FLAKY: https://github.com/elastic/kibana/issues/170960
// Failing: See https://github.com/elastic/kibana/issues/170960
describe.skip('Alert Event Details - Cases', { tags: ['@ess', '@serverless'] }, () => {
describe('Alert Event Details - Cases', { tags: ['@ess', '@serverless'] }, () => {
let ruleId: string;
let packId: string;
let packName: string;
Expand Down Expand Up @@ -68,6 +70,7 @@ describe.skip('Alert Event Details - Cases', { tags: ['@ess', '@serverless'] },
it('runs osquery against alert and creates a new case', () => {
const [caseName, caseDescription] = generateRandomStringName(2);
cy.getBySel('expand-event').first().click();
closeAlertsStepTourIfVisible();
cy.getBySel('take-action-dropdown-btn').click();
cy.getBySel('osquery-action-item').click();
cy.contains(/^\d+ agen(t|ts) selected/);
Expand Down Expand Up @@ -103,6 +106,7 @@ describe.skip('Alert Event Details - Cases', { tags: ['@ess', '@serverless'] },

it('sees osquery results from last action and add to a case', () => {
cy.getBySel('expand-event').first().click();
closeAlertsStepTourIfVisible();
cy.getBySel('securitySolutionFlyoutResponseSectionHeader').click();
cy.getBySel('securitySolutionFlyoutResponseButton').click();
cy.getBySel('responseActionsViewWrapper').should('exist');
Expand Down
11 changes: 7 additions & 4 deletions x-pack/plugins/osquery/cypress/e2e/all/alerts_linked_apps.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ import {
selectAllAgents,
submitQuery,
} from '../../tasks/live_query';
import { closeModalIfVisible, closeToastIfVisible } from '../../tasks/integrations';
import {
closeAlertsStepTourIfVisible,
closeModalIfVisible,
closeToastIfVisible,
} from '../../tasks/integrations';
import { RESULTS_TABLE, RESULTS_TABLE_BUTTON } from '../../screens/live_query';

// FLAKY: https://github.com/elastic/kibana/issues/180852
// Failing: See https://github.com/elastic/kibana/issues/180852
describe.skip(
describe(
'Alert Event Details',
{
tags: ['@ess', '@serverless'],
Expand Down Expand Up @@ -71,6 +73,7 @@ describe.skip(
it('should be able to run live query and add to timeline', () => {
const TIMELINE_NAME = 'Untitled timeline';
cy.getBySel('expand-event').first().click();
closeAlertsStepTourIfVisible();
cy.getBySel('take-action-dropdown-btn').click();
cy.getBySel('osquery-action-item').click();
cy.contains('1 agent selected.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import {
takeOsqueryActionWithParams,
} from '../../tasks/live_query';
import { OSQUERY_FLYOUT_BODY_EDITOR } from '../../screens/live_query';
import { closeAlertsStepTourIfVisible } from '../../tasks/integrations';

// Failing: See https://github.com/elastic/kibana/issues/180851
describe.skip(
describe(
'Alert Event Details - dynamic params',
{
tags: ['@ess', '@serverless'],
Expand All @@ -43,6 +43,7 @@ describe.skip(

it('should substitute parameters in investigation guide', () => {
cy.getBySel('expand-event').first().click();
closeAlertsStepTourIfVisible();
cy.getBySel('securitySolutionFlyoutInvestigationGuideButton').click();
// Flakes at times if the button is only clicked once
cy.contains('Get processes').should('be.visible').dblclick({ force: true });
Expand Down
6 changes: 3 additions & 3 deletions x-pack/plugins/osquery/cypress/e2e/roles/alert_test.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ import { initializeDataViews } from '../../tasks/login';
import { checkResults, clickRuleName, submitQuery } from '../../tasks/live_query';
import { loadRule, cleanupRule } from '../../tasks/api_fixtures';
import { ServerlessRoleName } from '../../support/roles';
import { closeAlertsStepTourIfVisible } from '../../tasks/integrations';

// FLAKY: https://github.com/elastic/kibana/issues/180853
// Failing: See https://github.com/elastic/kibana/issues/180853
describe.skip('Alert Test', { tags: ['@ess'] }, () => {
describe('Alert Test', { tags: ['@ess'] }, () => {
let ruleName: string;
let ruleId: string;

Expand All @@ -31,6 +30,7 @@ describe.skip('Alert Test', { tags: ['@ess'] }, () => {
cy.visit('/app/security/rules');
clickRuleName(ruleName);
cy.getBySel('expand-event').first().click({ force: true });
closeAlertsStepTourIfVisible();

cy.wait(500);
cy.getBySel('securitySolutionFlyoutInvestigationGuideButton').click();
Expand Down
4 changes: 4 additions & 0 deletions x-pack/plugins/osquery/cypress/screens/integrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ export const CONFIRM_MODAL_BTN_SEL = `[data-test-subj=${CONFIRM_MODAL_BTN}]`;
export const TOAST_CLOSE_BTN = 'toastCloseButton';
export const TOAST_CLOSE_BTN_SEL = `[data-test-subj=${TOAST_CLOSE_BTN}]`;

export const SECURITY_SOLUTION_FLYOUT_TOUR = 'securitySolutionFlyoutTour-1';

export const SECURITY_SOLUTION_FLYOUT_TOUR_SEL = `[data-test-subj=${SECURITY_SOLUTION_FLYOUT_TOUR}]`;

export const SETTINGS_TAB = 'tab-settings';
export const POLICIES_TAB = 'tab-policies';

Expand Down
11 changes: 11 additions & 0 deletions x-pack/plugins/osquery/cypress/tasks/integrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
DATA_COLLECTION_SETUP_STEP,
DATE_PICKER_ABSOLUTE_TAB,
DATE_PICKER_ABSOLUTE_TAB_SEL,
SECURITY_SOLUTION_FLYOUT_TOUR_SEL,
TOAST_CLOSE_BTN,
TOAST_CLOSE_BTN_SEL,
} from '../screens/integrations';
Expand Down Expand Up @@ -135,6 +136,16 @@ export function closeToastIfVisible() {
});
}

export function closeAlertsStepTourIfVisible() {
cy.get(SECURITY_SOLUTION_FLYOUT_TOUR_SEL).then(($el) => {
if ($el.length > 0) {
cy.wrap($el).within(() => {
cy.contains('Exit').click();
});
}
});
}

export const deleteIntegrations = async (integrationName: string) => {
const ids: string[] = [];
cy.contains(integrationName)
Expand Down

0 comments on commit 1d88277

Please sign in to comment.