Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const useOsqueryTab = ({
: undefined;

const responseActions =
expandedEventFieldsObject?.kibana?.alert?.rule?.parameters?.[0].response_actions;
expandedEventFieldsObject?.kibana?.alert?.rule?.parameters?.[0]?.response_actions;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found this error when fixing Cypress tests for guided onboarding tour
Screenshot 2024-04-22 at 12 48 12


const shouldEarlyReturn =
!rawEventData ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export const useResponseActionsView = <T extends object = JSX.Element>({
: undefined;

const responseActions =
expandedEventFieldsObject?.kibana?.alert?.rule?.parameters?.[0].response_actions;
expandedEventFieldsObject?.kibana?.alert?.rule?.parameters?.[0]?.response_actions;
const shouldEarlyReturn = !rawEventData || !responseActionsEnabled;

const alertId = rawEventData?._id ?? '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,43 @@
*/
import { ROLES, SecurityRoleName } from '@kbn/security-solution-plugin/common/test';

import { getNewRule } from '../../../objects/rule';

import { expandFirstAlertActions } from '../../../tasks/alerts';
import { createRule } from '../../../tasks/api_calls/rules';
import { waitForAlertsToPopulate } from '../../../tasks/create_new_rule';
import { login } from '../../../tasks/login';
import { visit } from '../../../tasks/navigation';
import { visitWithTimeRange } from '../../../tasks/navigation';

import { ALERTS_URL } from '../../../urls/navigation';
import { ATTACH_ALERT_TO_CASE_BUTTON, TIMELINE_CONTEXT_MENU_BTN } from '../../../screens/alerts';
import { LOADING_INDICATOR } from '../../../screens/security_header';
import { deleteAlertsAndRules } from '../../../tasks/api_calls/common';

const loadDetectionsPage = (role: SecurityRoleName) => {
const loadDetectionsPage = (role?: SecurityRoleName) => {
login(role);
visit(ALERTS_URL);
visitWithTimeRange(ALERTS_URL);
waitForAlertsToPopulate();
};

const cleanKibana = () => {
cy.task('esArchiverUnload', { archiveName: 'query_alert' });
deleteAlertsAndRules();
};

describe('Alerts timeline', { tags: ['@ess'] }, () => {
beforeEach(() => {
// First we login as a privileged user to create alerts.
deleteAlertsAndRules();
createRule(getNewRule());
login();
visit(ALERTS_URL);
waitForAlertsToPopulate();
cleanKibana();

cy.task('esArchiverLoad', { archiveName: 'query_alert', useCreate: true, docsOnly: true });
// First we login as a privileged user so data view can be created.
loadDetectionsPage();
});

afterEach(() => {
cleanKibana();
});

context('Privileges: read only', () => {
context('Privileges: read only', { tags: ['@ess'] }, () => {
beforeEach(() => {
// ess only role
loadDetectionsPage(ROLES.reader);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,33 @@ import {
goToStep,
startTour,
} from '../../../tasks/guided_onboarding';
import { createRule } from '../../../tasks/api_calls/rules';
import { getNewRule } from '../../../objects/rule';
import { ALERTS_URL, DASHBOARDS_URL } from '../../../urls/navigation';
import { waitForAlertsToPopulate } from '../../../tasks/create_new_rule';
import { login } from '../../../tasks/login';
import { visit } from '../../../tasks/navigation';
import { visitWithTimeRange } from '../../../tasks/navigation';
import { startAlertsCasesTour } from '../../../tasks/api_calls/tour';
import { deleteAlertsAndRules } from '../../../tasks/api_calls/common';

const cleanUpKibana = () => {
cy.task('esArchiverUnload', { archiveName: 'query_alert' });
deleteAlertsAndRules();
};

describe('Guided onboarding tour', { tags: ['@ess'] }, () => {
beforeEach(() => {
deleteAlertsAndRules();
createRule(getNewRule({ query: 'user.name:*' }));
cleanUpKibana();
cy.task('esArchiverLoad', { archiveName: 'query_alert', useCreate: true, docsOnly: true });
login();
disableExpandableFlyout();
startAlertsCasesTour();
visit(ALERTS_URL);
visitWithTimeRange(ALERTS_URL);
waitForAlertsToPopulate();
});

afterEach(() => {
cleanUpKibana();
});

it('Completes the tour with next button clicks', () => {
startTour();
completeTourWithNextButton();
Expand Down