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

[Security Solution] [Trigger Actions] Alert Table Refactoring #149128

Merged
merged 92 commits into from
Feb 22, 2023
Merged
Show file tree
Hide file tree
Changes from 70 commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
bb961b6
wip to get all teh features equally
XavierM Nov 28, 2022
382d5ee
incremental commit
logeekal Dec 10, 2022
fb9087c
Merging main ➡️ current branch
logeekal Dec 12, 2022
aaa754d
Table basics working
logeekal Dec 14, 2022
153846f
Added debug messages
logeekal Dec 16, 2022
43a41d9
Incremental dev commit
logeekal Dec 20, 2022
a6d15e6
Alert actions working
logeekal Dec 21, 2022
95a2f2d
Incremental commit
logeekal Jan 10, 2023
1839a09
Incremental commit
logeekal Jan 11, 2023
6f82983
Merged main -> current branch
logeekal Jan 13, 2023
fa23252
fix: event rendered view + some issues
logeekal Jan 16, 2023
8fc7e87
Merging main -> current branch
logeekal Jan 17, 2023
0d844dd
feat: field browser + right controls
logeekal Jan 17, 2023
c961b44
Merge main --> current branch
logeekal Jan 24, 2023
cedaae1
loading states + reorg
logeekal Jan 19, 2023
ade6969
Added time-range filter
logeekal Jan 23, 2023
740cc18
Replace alert Table with triggers action
logeekal Jan 23, 2023
a6ef9e5
fixing tests incremental
logeekal Jan 24, 2023
f0bb8e6
Added new state values to data table
logeekal Jan 25, 2023
b8306f8
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Jan 25, 2023
7ed773b
Tests incremental commit
logeekal Jan 27, 2023
6897b7d
Merge main -> current branch
logeekal Jan 27, 2023
620ab08
Fixed trigger action typings
logeekal Jan 27, 2023
56b5c6b
Fixed types
logeekal Jan 27, 2023
2e70a69
fix: observability types
logeekal Jan 27, 2023
5bc78ea
Fixes localstorage tests
logeekal Jan 27, 2023
546758f
fixed types + alert bulk actions
logeekal Jan 27, 2023
084f4cc
fix: observaibility re-rendering
logeekal Jan 27, 2023
fd31e1f
Fixed tests + typing issues
logeekal Jan 28, 2023
ece32e6
Fixed jest tests + other linting issues
logeekal Jan 28, 2023
887a23b
fixed column issue
logeekal Jan 29, 2023
8368ee5
fixed exception flaky tests
logeekal Jan 29, 2023
576a743
fixes exception items
logeekal Jan 29, 2023
20fbbf0
fixed some cypress tests
logeekal Jan 29, 2023
6391d9f
removing un-necessary changes in o11y
logeekal Jan 29, 2023
64a59a1
cosmetic changes
logeekal Jan 29, 2023
5ee22c5
fixed flaky timeline tests
logeekal Jan 29, 2023
e8dc9e0
Merge branch 'main' into alert-table-columns-actions
logeekal Jan 29, 2023
124feae
refactor storage ref + styles
logeekal Jan 30, 2023
575c881
remove debug code
logeekal Jan 30, 2023
486f7f1
optimizations
logeekal Jan 30, 2023
2eabbf3
reverted unnecessary changes in rule strategy
logeekal Jan 31, 2023
c39a547
Merge main --> current branch
logeekal Jan 31, 2023
d4808ae
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Jan 31, 2023
433887b
moved hook to the right place
logeekal Jan 31, 2023
6ab9716
Fetching correct fields
logeekal Feb 1, 2023
c958246
fixed types and timeline tests
logeekal Feb 1, 2023
8ba59d6
create type-safe hook mock
logeekal Feb 1, 2023
77a7ea1
refactor: tests
logeekal Feb 1, 2023
0d24cf7
refactor: corrected hook mock
logeekal Feb 1, 2023
9e80d5d
o11y fields issue + moved fields to useColumns
logeekal Feb 1, 2023
519640c
Merge branch 'main' into alert-table-columns-actions
logeekal Feb 1, 2023
aaa6cb6
added test cellActions + clearSelection
logeekal Feb 1, 2023
6820db2
Corrected issues with event rendered-view
logeekal Feb 2, 2023
b12f6d9
fixed types + cypress tests
logeekal Feb 2, 2023
439075c
fixes enrichment issues
logeekal Feb 2, 2023
c2058ed
added test refresh in toolbar bulk action
logeekal Feb 2, 2023
164cc56
refactor: prop browserFields prevent API
logeekal Feb 2, 2023
aab1859
Add Field browser create button
logeekal Feb 2, 2023
3bbff70
Review comments + test fixes
logeekal Feb 2, 2023
51dc5c9
Merged main -->current branch
logeekal Feb 6, 2023
078c254
fix: remove unncessary changes
logeekal Feb 6, 2023
f77914f
Removed unnecessary commands
logeekal Feb 6, 2023
355002b
peer review comments
logeekal Feb 6, 2023
20c28b2
Merged main --> current branch
logeekal Feb 6, 2023
6c44bad
Cases Owner issue
logeekal Feb 6, 2023
ea1a0a1
enabled inspect button
logeekal Feb 6, 2023
c26c3c6
Refresh retry in cypress tests
logeekal Feb 6, 2023
344e913
reverting cypress retry alerts_populate
logeekal Feb 6, 2023
78c7d8b
remove o11y casting
logeekal Feb 7, 2023
80b6d1f
Merged main -> current branch + Grouping
logeekal Feb 8, 2023
6197ba3
Added toolbar visibility options
logeekal Feb 9, 2023
09bf193
Merging main --> current branch
logeekal Feb 9, 2023
2a1f1af
Fixes stateful event renderer error
logeekal Feb 9, 2023
ff82a8d
skipped invalid tests
logeekal Feb 9, 2023
143976b
refactor: waitForAlertsToPopulate based on new alert table
logeekal Feb 14, 2023
bc98174
fix: register alert table only once
logeekal Feb 15, 2023
7e75b58
Merging main --> current branch
logeekal Feb 15, 2023
b6e3922
refactor: add to timeline data provider
logeekal Feb 15, 2023
5977f12
migrate triggers action state
logeekal Feb 16, 2023
58390ad
fix: localstorage migration
logeekal Feb 16, 2023
a91d5a2
fix: enclose triggers actions query in filter
logeekal Feb 16, 2023
39ed2cc
Merging main --> current branch
logeekal Feb 20, 2023
fd288eb
Fix tests
logeekal Feb 20, 2023
ad000e9
cypress review feedback
logeekal Feb 21, 2023
3e13779
fix: onboarding tours test
logeekal Feb 21, 2023
1352dfe
alert suppression
logeekal Feb 21, 2023
27a15bb
Merging main --> current branch
logeekal Feb 21, 2023
ef74cb2
fix: types
logeekal Feb 21, 2023
f79e02e
fix: onRuleChange
logeekal Feb 22, 2023
f6c8506
Skip triggers actions failing tests
logeekal Feb 22, 2023
7c70b73
fix: types
logeekal Feb 22, 2023
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 @@ -45,7 +45,7 @@ describe('Case View Page activity tab', () => {
await waitFor(async () => {
expect(getAlertsStateTableMock).toHaveBeenCalledWith({
alertsTableConfigurationRegistry: expect.anything(),
configurationId: 'securitySolution',
configurationId: 'securitySolution-case',
featureIds: ['siem', 'observability'],
id: 'case-details-alerts-securitySolution',
query: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,12 @@ export const CaseViewAlerts = ({ caseData }: CaseViewAlertsProps) => {
const { isLoading: isLoadingAlertFeatureIds, data: alertFeatureIds } =
useGetFeatureIds(alertRegistrationContexts);

const configId =
caseData.owner === SECURITY_SOLUTION_OWNER ? `${caseData.owner}-case` : caseData.owner;

const alertStateProps = {
alertsTableConfigurationRegistry: triggersActionsUi.alertsTableConfigurationRegistry,
configurationId: caseData.owner,
configurationId: configId,
id: `case-details-alerts-${caseData.owner}`,
flyoutSize: (alertFeatureIds?.includes('siem') ? 'm' : 's') as EuiFlyoutSize,
featureIds: alertFeatureIds ?? [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
import type { GetRenderCellValue } from '@kbn/triggers-actions-ui-plugin/public';
import { TIMESTAMP } from '@kbn/rule-data-utils';
import { SortOrder } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import { AlertsTableConfigurationRegistry } from '@kbn/triggers-actions-ui-plugin/public/types';
import { casesFeatureId, observabilityFeatureId } from '../../common';
import { useBulkAddToCaseActions } from '../hooks/use_alert_bulk_case_actions';
import { useBulkAddToCaseTriggerActions } from '../hooks/use_alert_bulk_case_actions';
import { TopAlert, useToGetInternalFlyout } from '../pages/alerts';
import { getRenderCellValue } from '../pages/alerts/components/render_cell_value';
import { addDisplayNames } from '../pages/alerts/containers/alerts_table/add_display_names';
Expand All @@ -21,7 +22,7 @@ import type { ConfigSchema } from '../plugin';
const getO11yAlertsTableConfiguration = (
observabilityRuleTypeRegistry: ObservabilityRuleTypeRegistry,
config: ConfigSchema
) => ({
): AlertsTableConfigurationRegistry => ({
id: observabilityFeatureId,
casesFeatureId,
columns: alertO11yColumns.map(addDisplayNames),
Expand All @@ -36,7 +37,7 @@ const getO11yAlertsTableConfiguration = (
},
],
useActionsColumn: getRowActions(observabilityRuleTypeRegistry, config),
useBulkActions: useBulkAddToCaseActions,
useBulkActions: useBulkAddToCaseTriggerActions,
useInternalFlyout: () => {
const { header, body, footer } = useToGetInternalFlyout(observabilityRuleTypeRegistry);
return { header, body, footer };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,12 @@ export const useBulkAddToCaseActions = ({ onClose, onSuccess }: UseAddToCaseActi
selectCaseModal,
]);
};

/*
* Wrapper hook to support trigger actions
* registry props for the alert table
*
* */
export const useBulkAddToCaseTriggerActions = () => {
return useBulkAddToCaseActions({});
};
15 changes: 14 additions & 1 deletion x-pack/plugins/security_solution/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
* https://mariusschulz.com/blog/literal-type-widening-in-typescript
* Please follow this convention when adding to this file
*/

export const APP_ID = 'securitySolution' as const;
export const APP_UI_ID = 'securitySolutionUI' as const;
export const CASES_FEATURE_ID = 'securitySolutionCases' as const;
Expand Down Expand Up @@ -497,3 +496,17 @@ export const DEFAULT_DETECTION_PAGE_FILTERS = [

export const CELL_ACTIONS_DEFAULT_TRIGGER = 'security-solution-default-cellActions';
export const CELL_ACTIONS_TIMELINE_TRIGGER = 'security-solution-timeline-cellActions';

/** This local storage key stores the `Grid / Event rendered view` selection */
export const ALERTS_TABLE_VIEW_SELECTION_KEY = 'securitySolution.alerts.table.view-selection';

export const VIEW_SELECTION = {
gridView: 'gridView',
eventRenderedView: 'eventRenderedView',
} as const;

export const ALERTS_TABLE_REGISTRY_CONFIG_IDS = {
ALERTS_PAGE: `${APP_ID}-alerts-page`,
RULE_DETAILS: `${APP_ID}-rule-details`,
CASE: `${APP_ID}-case`,
} as const;
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

import * as runtimeTypes from 'io-ts';
import type { VIEW_SELECTION } from '../../constants';

export enum Direction {
asc = 'asc',
Expand Down Expand Up @@ -33,6 +34,7 @@ export enum TableId {
alternateTest = 'alternateTest',
rulePreview = 'rule-preview',
kubernetesPageSessions = 'kubernetes-page-sessions',
alertsOnCasePage = 'alerts-case-page',
}

const TableIdLiteralRt = runtimeTypes.union([
Expand All @@ -46,4 +48,9 @@ const TableIdLiteralRt = runtimeTypes.union([
runtimeTypes.literal(TableId.rulePreview),
runtimeTypes.literal(TableId.kubernetesPageSessions),
]);

export type TableIdLiteral = runtimeTypes.TypeOf<typeof TableIdLiteralRt>;

export type ViewSelectionTypes = keyof typeof VIEW_SELECTION;

export type ViewSelection = typeof VIEW_SELECTION[ViewSelectionTypes];
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { JSON_TEXT } from '../../screens/alerts_details';

import { expandFirstAlert, waitForAlertsPanelToBeLoaded } from '../../tasks/alerts';
import { expandFirstAlert, waitForAlerts } from '../../tasks/alerts';
import { openJsonView } from '../../tasks/alerts_details';
import { createCustomRuleEnabled } from '../../tasks/api_calls/rules';
import { cleanKibana } from '../../tasks/common';
Expand All @@ -25,7 +25,7 @@ describe('Alert details with unmapped fields', () => {
esArchiverCCSLoad('unmapped_fields');
createCustomRuleEnabled(getUnmappedCCSRule());
visitWithoutDateRange(ALERTS_URL);
waitForAlertsPanelToBeLoaded();
waitForAlerts();
expandFirstAlert();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ import { createCustomRuleEnabled } from '../../tasks/api_calls/rules';
import { getNewRule } from '../../objects/rule';
import { refreshPage } from '../../tasks/security_header';
import { waitForAlertsToPopulate } from '../../tasks/create_new_rule';
import { openEventsViewerFieldsBrowser } from '../../tasks/hosts/events';
import { assertFieldDisplayed, createField } from '../../tasks/create_runtime_field';
import { openAlertsFieldBrowser } from '../../tasks/alerts';
import { deleteAlertsIndex } from '../../tasks/sourcerer';

describe('Create DataView runtime field', () => {
before(() => {
deleteAlertsIndex();
Copy link
Member

Choose a reason for hiding this comment

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

Why is this used instead of cleanKibana() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, in this particular tests, once a runtime fields is created, you cannot run that test again without starting the cypress instance again because that runtime field always exists. I added this so that we can run that test again.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@MadameSheema , have improved it now. Please check if it makes sense.

login();
});

Expand All @@ -30,7 +32,7 @@ describe('Create DataView runtime field', () => {
createCustomRuleEnabled(getNewRule());
refreshPage();
waitForAlertsToPopulate();
openEventsViewerFieldsBrowser();
openAlertsFieldBrowser();

createField(fieldName);
assertFieldDisplayed(fieldName, 'alerts');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { expandFirstAlert, waitForAlertsPanelToBeLoaded } from '../../tasks/alerts';
import { expandFirstAlert, waitForAlerts } from '../../tasks/alerts';
import { createCustomRuleEnabled } from '../../tasks/api_calls/rules';
import { cleanKibana } from '../../tasks/common';
import { login, visit } from '../../tasks/login';
Expand Down Expand Up @@ -35,7 +35,7 @@ describe('Alert Details Page Navigation', () => {
describe('context menu', () => {
beforeEach(() => {
visit(ALERTS_URL);
waitForAlertsPanelToBeLoaded();
waitForAlerts();
});

it('should navigate to the details page from the alert context menu', () => {
Expand All @@ -55,7 +55,7 @@ describe('Alert Details Page Navigation', () => {
describe('flyout', () => {
beforeEach(() => {
visit(ALERTS_URL);
waitForAlertsPanelToBeLoaded();
waitForAlerts();
});

it('should navigate to the details page from the alert flyout', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { APP_ID, DEFAULT_DETECTION_PAGE_FILTERS } from '../../../common/constant
import { formatPageFilterSearchParam } from '../../../common/utils/format_page_filter_search_param';
import {
markAcknowledgedFirstAlert,
refreshAlertPageFilter,
resetFilters,
selectCountTable,
waitForAlerts,
Expand Down Expand Up @@ -152,7 +151,7 @@ describe.skip('Detections : Page Filters', () => {
.then((noOfAlerts) => {
const originalAlertCount = noOfAlerts.split(' ')[0];
markAcknowledgedFirstAlert();
refreshAlertPageFilter();
waitForAlerts();
cy.get(OPTION_LIST_VALUES).eq(0).click();
cy.get(OPTION_SELECTABLE(0, 'acknowledged')).should('be.visible');
cy.get(ALERTS_COUNT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import {
CONFIRM_BTN,
VALUES_INPUT,
EXCEPTION_FLYOUT_TITLE,
FIELD_INPUT_PARENT,
} from '../../../screens/exceptions';

import { DETECTIONS_RULE_MANAGEMENT_URL } from '../../../urls/navigation';
Expand Down Expand Up @@ -157,8 +158,9 @@ describe('Exceptions flyout', () => {

// delete second item, invalid values 'a' and 'c' should remain
cy.get(ENTRY_DELETE_BTN).eq(1).click();
cy.get(FIELD_INPUT).eq(0).should('have.text', 'agent.name');
cy.get(FIELD_INPUT).eq(1).should('have.text', 'c');
cy.get(LOADING_SPINNER).should('not.exist');
cy.get(FIELD_INPUT_PARENT).eq(0).should('have.text', 'agent.name');
cy.get(FIELD_INPUT_PARENT).eq(1).should('have.text', 'c');

closeExceptionBuilderFlyout();
});
Expand Down Expand Up @@ -187,32 +189,32 @@ describe('Exceptions flyout', () => {
cy.get(ENTRY_DELETE_BTN).eq(3).click();
cy.get(EXCEPTION_ITEM_CONTAINER)
.eq(0)
.find(FIELD_INPUT)
.find(FIELD_INPUT_PARENT)
.eq(0)
.should('have.text', 'agent.name');
cy.get(EXCEPTION_ITEM_CONTAINER)
.eq(0)
.find(FIELD_INPUT)
.find(FIELD_INPUT_PARENT)
.eq(1)
.should('have.text', 'user.id.keyword');
cy.get(EXCEPTION_ITEM_CONTAINER)
.eq(1)
.find(FIELD_INPUT)
.find(FIELD_INPUT_PARENT)
.eq(0)
.should('have.text', 'user.first');
cy.get(EXCEPTION_ITEM_CONTAINER).eq(1).find(FIELD_INPUT).eq(1).should('have.text', 'e');
cy.get(EXCEPTION_ITEM_CONTAINER).eq(1).find(FIELD_INPUT_PARENT).eq(1).should('have.text', 'e');

// delete remaining entries in exception item 2
cy.get(ENTRY_DELETE_BTN).eq(2).click();
cy.get(ENTRY_DELETE_BTN).eq(2).click();
cy.get(EXCEPTION_ITEM_CONTAINER)
.eq(0)
.find(FIELD_INPUT)
.find(FIELD_INPUT_PARENT)
.eq(0)
.should('have.text', 'agent.name');
cy.get(EXCEPTION_ITEM_CONTAINER)
.eq(0)
.find(FIELD_INPUT)
.find(FIELD_INPUT_PARENT)
.eq(1)
.should('have.text', 'user.id.keyword');
cy.get(EXCEPTION_ITEM_CONTAINER).eq(1).should('not.exist');
Expand Down Expand Up @@ -245,39 +247,47 @@ describe('Exceptions flyout', () => {
cy.get(ENTRY_DELETE_BTN).eq(4).click();
cy.get(EXCEPTION_ITEM_CONTAINER)
.eq(0)
.find(FIELD_INPUT)
.find(FIELD_INPUT_PARENT)
.eq(0)
.should('have.text', 'agent.name');
cy.get(EXCEPTION_ITEM_CONTAINER).eq(0).find(FIELD_INPUT).eq(1).should('have.text', 'b');
cy.get(EXCEPTION_ITEM_CONTAINER).eq(0).find(FIELD_INPUT_PARENT).eq(1).should('have.text', 'b');
cy.get(EXCEPTION_ITEM_CONTAINER)
.eq(1)
.find(FIELD_INPUT)
.find(FIELD_INPUT_PARENT)
.eq(0)
.should('have.text', 'agent.name');
cy.get(EXCEPTION_ITEM_CONTAINER).eq(1).find(FIELD_INPUT).eq(1).should('have.text', 'user');
cy.get(EXCEPTION_ITEM_CONTAINER).eq(1).find(FIELD_INPUT).eq(2).should('have.text', 'last');
cy.get(EXCEPTION_ITEM_CONTAINER)
.eq(1)
.find(FIELD_INPUT)
.find(FIELD_INPUT_PARENT)
.eq(1)
.should('have.text', 'user');
cy.get(EXCEPTION_ITEM_CONTAINER)
.eq(1)
.find(FIELD_INPUT_PARENT)
.eq(2)
.should('have.text', 'last');
cy.get(EXCEPTION_ITEM_CONTAINER)
.eq(1)
.find(FIELD_INPUT_PARENT)
.eq(3)
.should('have.text', '@timestamp');

// deleting the last value of a nested entry, should delete the child and parent
cy.get(ENTRY_DELETE_BTN).eq(4).click();
cy.get(EXCEPTION_ITEM_CONTAINER)
.eq(0)
.find(FIELD_INPUT)
.find(FIELD_INPUT_PARENT)
.eq(0)
.should('have.text', 'agent.name');
cy.get(EXCEPTION_ITEM_CONTAINER).eq(0).find(FIELD_INPUT).eq(1).should('have.text', 'b');
cy.get(EXCEPTION_ITEM_CONTAINER).eq(0).find(FIELD_INPUT_PARENT).eq(1).should('have.text', 'b');
cy.get(EXCEPTION_ITEM_CONTAINER)
.eq(1)
.find(FIELD_INPUT)
.find(FIELD_INPUT_PARENT)
.eq(0)
.should('have.text', 'agent.name');
cy.get(EXCEPTION_ITEM_CONTAINER)
.eq(1)
.find(FIELD_INPUT)
.find(FIELD_INPUT_PARENT)
.eq(1)
.should('have.text', '@timestamp');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ import {
CLOSE_SINGLE_ALERT_CHECKBOX,
EXCEPTION_ITEM_CONTAINER,
VALUES_INPUT,
FIELD_INPUT,
EXCEPTION_CARD_ITEM_NAME,
EXCEPTION_CARD_ITEM_CONDITIONS,
FIELD_INPUT_PARENT,
} from '../../../screens/exceptions';
import { createEndpointExceptionList } from '../../../tasks/api_calls/exceptions';

Expand Down Expand Up @@ -143,7 +143,11 @@ describe('Add endpoint exception from rule details', () => {
editExceptionFlyoutItemName(NEW_ITEM_NAME);

// check that the existing item's field is being populated
cy.get(EXCEPTION_ITEM_CONTAINER).eq(0).find(FIELD_INPUT).eq(0).should('have.text', ITEM_FIELD);
cy.get(EXCEPTION_ITEM_CONTAINER)
.eq(0)
.find(FIELD_INPUT_PARENT)
.eq(0)
.should('have.text', ITEM_FIELD);
cy.get(VALUES_INPUT).should('have.text', 'foo');

// edit conditions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { getException, getExceptionList } from '../../../objects/exception';
import { getNewRule } from '../../../objects/rule';

import { ALERTS_COUNT, EMPTY_ALERT_TABLE, NUMBER_OF_ALERTS } from '../../../screens/alerts';
import { ALERTS_COUNT, EMPTY_ALERT_TABLE } from '../../../screens/alerts';
import { createCustomRule, createCustomRuleEnabled } from '../../../tasks/api_calls/rules';
import { goToRuleDetails } from '../../../tasks/alerts_detection_rules';
import {
Expand Down Expand Up @@ -52,10 +52,10 @@ import {
CONFIRM_BTN,
ADD_TO_SHARED_LIST_RADIO_INPUT,
EXCEPTION_ITEM_CONTAINER,
FIELD_INPUT,
VALUES_MATCH_ANY_INPUT,
EXCEPTION_CARD_ITEM_NAME,
EXCEPTION_CARD_ITEM_CONDITIONS,
FIELD_INPUT_PARENT,
} from '../../../screens/exceptions';
import {
createExceptionList,
Expand Down Expand Up @@ -145,7 +145,7 @@ describe('Add/edit exception from rule details', () => {
// check that the existing item's field is being populated
cy.get(EXCEPTION_ITEM_CONTAINER)
.eq(0)
.find(FIELD_INPUT)
.find(FIELD_INPUT_PARENT)
.eq(0)
.should('have.text', ITEM_FIELD);
cy.get(VALUES_MATCH_ANY_INPUT).should('have.text', 'foo');
Expand Down Expand Up @@ -317,7 +317,7 @@ describe('Add/edit exception from rule details', () => {
// Closed alert should appear in table
goToClosedAlertsOnRuleDetailsPage();
cy.get(ALERTS_COUNT).should('exist');
cy.get(NUMBER_OF_ALERTS).should('have.text', `${NUMBER_OF_AUDITBEAT_EXCEPTIONS_ALERTS}`);
cy.get(ALERTS_COUNT).should('have.text', `${NUMBER_OF_AUDITBEAT_EXCEPTIONS_ALERTS}`);

// Remove the exception and load an event that would have matched that exception
// to show that said exception now starts to show up again
Expand All @@ -332,12 +332,13 @@ describe('Add/edit exception from rule details', () => {

// now that there are no more exceptions, the docs should match and populate alerts
goToAlertsTab();
waitForAlertsToPopulate();
goToOpenedAlertsOnRuleDetailsPage();
waitForTheRuleToBeExecuted();
waitForAlertsToPopulate();

cy.get(ALERTS_COUNT).should('exist');
cy.get(NUMBER_OF_ALERTS).should('have.text', '2 alerts');
cy.get(ALERTS_COUNT).should('have.text', '2 alerts');
});
});
});
Loading