Skip to content

Commit d28a6dd

Browse files
committed
[Security Solution] Implement prebuilt rules upgrade test plan (#228620)
**Addresses: #202078 ## Summary This PR implements Prebuilt Rules Upgrade [with (via Prebuilt Rule Upgrade Flyout)](https://github.com/elastic/kibana/blob/main/x-pack/solutions/security/plugins/security_solution/docs/testing/test_plans/detection_response/prebuilt_rules/prebuilt_rule_upgrade_with_preview.md) and [without (via Prebuilt Rules Upgrade table)](https://github.com/elastic/kibana/blob/main/x-pack/solutions/security/plugins/security_solution/docs/testing/test_plans/detection_response/prebuilt_rules/prebuilt_rule_upgrade_without_preview.md) preview test plans. ## Details Since some of the test scenarios had been implemented earlier this PR involves refactoring as well and tests reorganization. The following has been done in the scope - Prebuilt Rules Installation and Prebuilt Rules Upgrade workflows in Cypress have been split - Existing tests were renamed to better match to the test plans - Prebuilt Rules Upgrade Cypress tests were reorganized to - `upgrade_with_preview.cy.ts` - Upgrade via Prebuilt Rule Upgrade Flyout - `upgrade_without_preview.cy.ts` - Upgrade via via Prebuilt Rules Upgrade table - Missing tests have been added to the corresponding files for Jest Integration and Cypress tests ## Not implemented test scenarios The following test scenarios weren't implemented due to time constraints - [Prebuilt rules upgrade with preview test plan](https://github.com/elastic/kibana/blob/main/x-pack/solutions/security/plugins/security_solution/docs/testing/test_plans/detection_response/prebuilt_rules/prebuilt_rule_upgrade_with_preview.md#concurrency-control) (Upgrade via Prebuilt Rule Upgrade Flyout) - **Concurrency control** e2e tests The tests verify that a toast message appears after either prebuilt rule has been edited (revision bump) or a new prebuilt rule version is available (version bump, a new prebuilt rules package version has been installed). Since UI refetches data every 5 minutes e2e tests either has to wait for ~5 minutes for toasts to appear or use `cy.clock()` to mock timers. The latter doesn't work in a simple way and requires time for deeper investigation. But there are [unit tests](https://github.com/elastic/kibana/blob/main/x-pack/solutions/security/plugins/security_solution/public/detection_engine/rule_management_ui/components/rules_table/upgrade_prebuilt_rules_table/use_prebuilt_rules_upgrade_state.test.ts) for concurrency control. - [Prebuilt rules upgrade without preview test plan](https://github.com/elastic/kibana/blob/main/x-pack/solutions/security/plugins/security_solution/docs/testing/test_plans/detection_response/prebuilt_rules/prebuilt_rule_upgrade_without_preview.md) (Prebuilt Rules Bulk upgrade) - **Rule upgrade workflow: filtering, sorting, pagination** There are two existing table filtering tests but besides that no new tests has been added. These tests should be covered in the scope of #166215. - **Rule upgrade workflow: Edge cases**/**Scenario: Rule bound data is preserved after upgrading a rule to a newer version** - **Error handling**/**Scenario: Error is handled when any upgrade operation on prebuilt rules fails** - **Licensing: API endpoints** ## Flaky test runner - ✅ [e2e Cypress tests Rule Management group](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/8812) (100 runs) (cherry picked from commit 67006ad)
1 parent ac4942c commit d28a6dd

67 files changed

Lines changed: 4590 additions & 2051 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

x-pack/solutions/security/plugins/security_solution/docs/testing/test_plans/detection_response/prebuilt_rules/prebuilt_rule_upgrade_with_preview.md

Lines changed: 63 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one
3030
- [Scenarios](#scenarios)
3131
- [Rule upgrade workflow: rule previews](#rule-upgrade-workflow-rule-previews)
3232
- [**Scenario: User can preview prebuilt rules having upgrades**](#scenario-user-can-preview-prebuilt-rules-having-upgrades)
33-
- [**Scenario: User can upgrade a prebuilt rule using the rule preview**](#scenario-user-can-upgrade-a-prebuilt-rule-using-the-rule-preview)
3433
- [**Scenario: User can see correct rule information in the preview before upgrading**](#scenario-user-can-see-correct-rule-information-in-the-preview-before-upgrading)
3534
- [**Scenario: Tabs and sections without content should be hidden in the preview before upgrading**](#scenario-tabs-and-sections-without-content-should-be-hidden-in-the-preview-before-upgrading)
3635
- [Rule upgrade field preview](#rule-upgrade-field-preview)
@@ -51,7 +50,7 @@ https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one
5150
- [Rule upgrade button](#rule-upgrade-button)
5251
- [**Scenario: Rule upgrade button is disabled when num of conflicts \>= 1**](#scenario-rule-upgrade-button-is-disabled-when-num-of-conflicts--1)
5352
- [**Scenario: Rule upgrade button is disabled when num fields in edit mode \>= 1**](#scenario-rule-upgrade-button-is-disabled-when-num-fields-in-edit-mode--1)
54-
- [**Scenario: Rule upgrade button is disabled when num of conflicts \>= 1 or num fields in edit mode \>= 1**](#scenario-rule-upgrade-button-is-disabled-when-num-of-conflicts--1-or-num-fields-in-edit-mode--1)
53+
- [**Scenario: Rule upgrade button is disabled when num of conflicts \>= 1 and num fields in edit mode \>= 1**](#scenario-rule-upgrade-button-is-disabled-when-num-of-conflicts--1-and-num-fields-in-edit-mode--1)
5554
- [Rule upgrade after field preview](#rule-upgrade-after-field-preview)
5655
- [**Scenario: Non-customized rule upgrade after preview (AAB diff case)**](#scenario-non-customized-rule-upgrade-after-preview-aab-diff-case)
5756
- [**Scenario: Non-customized rule upgrade after preview and customizing field values (AAB diff case)**](#scenario-non-customized-rule-upgrade-after-preview-and-customizing-field-values-aab-diff-case)
@@ -61,12 +60,14 @@ https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one
6160
- [**Scenario: Customized rule upgrade after preview and accepting edited solvable conflicts (ABC diff case, conflict solvable by diff algo)**](#scenario-customized-rule-upgrade-after-preview-and-accepting-edited-solvable-conflicts-abc-diff-case-conflict-solvable-by-diff-algo)
6261
- [**Scenario: Customized rule upgrade after preview non-solvable conflicts and accepting suggested field value (ABC diff case, non-solvable by diff algo)**](#scenario-customized-rule-upgrade-after-preview-non-solvable-conflicts-and-accepting-suggested-field-value-abc-diff-case-non-solvable-by-diff-algo)
6362
- [**Scenario: Customized rule upgrade after preview non-solvable conflicts and accepting edited field value (ABC diff case, non-solvable by diff algo)**](#scenario-customized-rule-upgrade-after-preview-non-solvable-conflicts-and-accepting-edited-field-value-abc-diff-case-non-solvable-by-diff-algo)
63+
- [**Scenario: Customized rule upgrade after preview solvable conflicts and accepting suggested field value (-AB diff case)**](#scenario-customized-rule-upgrade-after-preview-solvable-conflicts-and-accepting-suggested-field-value--ab-diff-case)
64+
- [**Scenario: Customized rule upgrade after preview solvable conflicts and accepting edited field value (-AB diff case)**](#scenario-customized-rule-upgrade-after-preview-solvable-conflicts-and-accepting-edited-field-value--ab-diff-case)
6465
- [Rule type upgrade](#rule-type-upgrade)
6566
- [**Scenario: Non-customized rule upgrade to a different rule type after preview**](#scenario-non-customized-rule-upgrade-to-a-different-rule-type-after-preview)
6667
- [**Scenario: Customized rule upgrade to a different rule type after preview**](#scenario-customized-rule-upgrade-to-a-different-rule-type-after-preview)
6768
- [Concurrency control](#concurrency-control)
68-
- [**Scenario: User gets notified after someone edited a rule being previewed**](#scenario-user-gets-notified-after-someone-edited-a-rule-being-previewed)
69-
- [**Scenario: User gets notified after a new rule versions is released**](#scenario-user-gets-notified-after-a-new-rule-versions-is-released)
69+
- [**Scenario: User gets notified after someone edited the prebuilt rule being previewed**](#scenario-user-gets-notified-after-someone-edited-the-prebuilt-rule-being-previewed)
70+
- [**Scenario: User gets notified after a prebuilt new rule version is released**](#scenario-user-gets-notified-after-a-prebuilt-new-rule-version-is-released)
7071
- [Licensing](#licensing)
7172
- [**Scenario: User can NOT modify field values in upgrade preview when license is insufficient**](#scenario-user-can-not-modify-field-values-in-upgrade-preview-when-license-is-insufficient)
7273
- [**Scenario: User is warned about losing their customizations in upgrade preview when license is insufficient**](#scenario-user-is-warned-about-losing-their-customizations-in-upgrade-preview-when-license-is-insufficient)
@@ -144,6 +145,8 @@ What should be inside the Rule Upgrade flyout:
144145

145146
#### **Scenario: User can preview prebuilt rules having upgrades**
146147

148+
**Automation**: 1 e2e test.
149+
147150
```Gherkin
148151
Given a prebuilt rule with an upgrade
149152
When user opens the rule preview for the prebuilt rule
@@ -152,20 +155,6 @@ When user closes the preview
152155
Then it should disappear
153156
```
154157

155-
#### **Scenario: User can upgrade a prebuilt rule using the rule preview**
156-
157-
**Automation**: 1 e2e test
158-
159-
```Gherkin
160-
Given a prebuilt rule with an upgrade
161-
When user opens the rule preview for the prebuilt rule
162-
And upgrades the rule using a CTA in the rule preview
163-
Then the rule should be upgraded to the latest version
164-
And a success message should be displayed after upgrade
165-
And the rule should be removed from the Prebuilt Rules Upgrades page
166-
And user should see the number of rules available to upgrade as initial number minus 1
167-
```
168-
169158
#### **Scenario: User can see correct rule information in the preview before upgrading**
170159

171160
**Automation**: 1 e2e test
@@ -515,11 +504,11 @@ When user switch one or more fields to edit mode
515504
Then user should see INACTIVE CTA
516505
When user hover on the INACTIVE CTA
517506
Then explanation tooltip appears
518-
When user every field in readonly mode
507+
When user switches every field to readonly mode
519508
Then the INACTIVE CTA becomes ACTIVE
520509
```
521510

522-
#### **Scenario: Rule upgrade button is disabled when num of conflicts >= 1 or num fields in edit mode >= 1**
511+
#### **Scenario: Rule upgrade button is disabled when num of conflicts >= 1 and num fields in edit mode >= 1**
523512

524513
**Automation**: 1 Cypress test.
525514

@@ -744,6 +733,54 @@ When user opens rule details page for that prebuilt rule
744733
Then user should see <field> has an upgraded value user entered and saved in the form
745734
```
746735

736+
#### **Scenario: Customized rule upgrade after preview solvable conflicts and accepting suggested field value (-AB diff case)**
737+
738+
**Automation**: Jest integration test per \<field\> and 1 bulk Cypress test.
739+
740+
```Gherkin
741+
Given a prebuilt rule is installed
742+
And this rule's <field> is customized
743+
And the <field> has an upgrade resulting to a non-solvable conflict
744+
When user opens the Rule Update Flyout
745+
Then user should see INACTIVE CTA to upgrade the prebuilt rule
746+
And <field> has a conflict
747+
And <field> edit form is shown
748+
And <field> edit form inputs have current customized value
749+
When user saves the form without changes
750+
Then user should see an ACTIVE CTA to upgrade the prebuilt rule
751+
When user clicks on CTA
752+
Then success message should be displayed after upgrade
753+
And upgraded prebuilt rule should be removed from the table
754+
When user opens rule details page for that prebuilt rule
755+
Then user should see <field> has an upgraded value accepted by user
756+
```
757+
758+
**Examples:**
759+
760+
`<field>` = all customizable fields
761+
762+
#### **Scenario: Customized rule upgrade after preview solvable conflicts and accepting edited field value (-AB diff case)**
763+
764+
**Automation**: Jest integration test per `<field>` and 1 bulk Cypress test.
765+
766+
```Gherkin
767+
Given a prebuilt rule is installed
768+
And this prebuilt rule's <field> is customized
769+
And it has an upgrade resulting to a non-solvable conflict
770+
When user opens the Rule Update Flyout
771+
Then user should see INACTIVE CTA to upgrade the prebuilt rule
772+
And <field> has a conflict
773+
And <field> edit form is shown
774+
And <field> edit form inputs have current customized value
775+
When user edits <field> form and saves it
776+
Then user should see an ACTIVE CTA to upgrade the prebuilt rule
777+
When user clicks on CTA
778+
Then success message should be displayed after upgrade
779+
And upgraded prebuilt rule should be removed from the table
780+
When user opens rule details page for that prebuilt rule
781+
Then user should see <field> has an upgraded value user entered and saved in the form
782+
```
783+
747784
**Examples:**
748785

749786
`<field>` = all customizable fields besides always mergeable fields (`tags`, `references`, `threat_index`, `new_terms_fields`)
@@ -787,7 +824,11 @@ And has upgraded field values
787824

788825
### Concurrency control
789826

790-
#### **Scenario: User gets notified after someone edited a rule being previewed**
827+
> It wasn't possible to test the Concurrency control with Cypress clock mocking. Testing without mocks would require
828+
> waiting for 5 minutes significantly increasing tests duration. We should revisit this after we obtain better e2e
829+
> testing tooling.
830+
831+
#### **Scenario: User gets notified after someone edited the prebuilt rule being previewed**
791832

792833
**Automation**: 1 Cypress test.
793834

@@ -800,7 +841,7 @@ Then <userA> should see a notification that rule has been edited
800841
And saved custom field values got discarded
801842
```
802843

803-
#### **Scenario: User gets notified after a new rule versions is released**
844+
#### **Scenario: User gets notified after a prebuilt new rule version is released**
804845

805846
**Automation**: 1 Cypress test.
806847

x-pack/solutions/security/plugins/security_solution/docs/testing/test_plans/detection_response/prebuilt_rules/prebuilt_rules_common_info.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ Terminology related to the "rule source" object:
119119
Terminology related to UI and UX:
120120

121121
- **CTA**: "call to action", usually a button, a link, or a callout message with a button, etc, that invites the user to do some action.
122+
- **INACTIVE CTA** - "Call to action" is visible but disabled like a disabled button
123+
- **ACTIVE CTA** - "Call to action" is visible and enabled. And this is the same as just using **CTA** acronym. **ACTIVE**/**INACTIVE** is used to highlight the state in test scenarios asserting **CTA** state based on the system's state.
122124

123125
## Common assumptions
124126

x-pack/solutions/security/plugins/security_solution/public/common/test/eui/combobox.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88
import { act, fireEvent, waitFor, within } from '@testing-library/react';
99

1010
export async function showEuiComboBoxOptions(comboBoxToggleButton: HTMLElement): Promise<void> {
11+
// Skip actions if the combobox has been opened already
12+
if (
13+
document.querySelector('[role="listbox"]') ||
14+
document.querySelector('.euiComboBoxOptionsList__empty')
15+
) {
16+
return;
17+
}
18+
1119
await act(() => {
1220
fireEvent.click(comboBoxToggleButton);
1321
});
@@ -39,7 +47,7 @@ export async function selectEuiComboBoxOption({
3947
}: SelectEuiComboBoxOptionParameters): Promise<void> {
4048
await showEuiComboBoxOptions(comboBoxToggleButton);
4149

42-
return act(async () => {
50+
await act(async () => {
4351
const options = Array.from(
4452
document.querySelectorAll('[data-test-subj*="comboBoxOptionsList"] [role="option"]')
4553
);
@@ -60,6 +68,17 @@ export async function selectEuiComboBoxOption({
6068
fireEvent.click(options[optionIndex]);
6169
}
6270
});
71+
72+
if (document.querySelector('[role="listbox"]')) {
73+
await act(() => {
74+
fireEvent.click(comboBoxToggleButton);
75+
});
76+
}
77+
78+
// wait for the combobox options popover to disappear
79+
return waitFor(() => {
80+
expect(document.querySelector('[role="listbox"]')).not.toBeInTheDocument();
81+
});
6382
}
6483

6584
interface AddEuiComboBoxOptionParameters {

x-pack/solutions/security/plugins/security_solution/public/detection_engine/rule_creation_ui/components/step_define_rule/index.test.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ jest.mock('../../../../common/components/query_bar', () => {
7272
<div data-test-subj={MOCKED_QUERY_BAR_TEST_ID}>
7373
<textarea value={filterQuery.query} onChange={handleQueryChange} />
7474
<input
75-
role="listbox"
75+
// Language selector is an expandable menu in the real component.
76+
// Here we set some role distinguished from `textbox` to match the real
77+
// behavior when there is a single role="textbox" input in the QueryBar
78+
role="searchbox"
7679
type="text"
7780
value={filterQuery.language}
7881
onChange={handleLanguageChange}

x-pack/solutions/security/plugins/security_solution/public/detection_engine/rule_management/components/rule_details/json_diff/diff_view.tsx

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ export interface DiffViewProps extends Partial<DiffProps> {
265265
https://github.com/otakustay/react-diff-view/blob/8a2dbdf97af0890aff6e563ed435e7da13c5e7b1/README.md#parse-diff-text
266266
*/
267267
zip?: boolean;
268+
'data-test-subj'?: string;
268269
}
269270

270271
export const DiffView = ({
@@ -273,6 +274,7 @@ export const DiffView = ({
273274
diffMethod = DiffMethod.WORDS_WITH_SPACE,
274275
viewType = 'split',
275276
zip = false,
277+
'data-test-subj': dataTestSubj,
276278
}: DiffViewProps) => {
277279
/*
278280
"react-diff-view" components consume diffs not as a strings, but as something they call "hunks".
@@ -308,23 +310,25 @@ export const DiffView = ({
308310

309311
return (
310312
<CustomStyles>
311-
<Diff
312-
/*
313+
<div data-test-subj={dataTestSubj}>
314+
<Diff
315+
/*
313316
"diffType": can be either 'add', 'delete', 'modify', 'rename' or 'copy'.
314317
Passing 'add' or 'delete' would skip rendering one of the sides in split view.
315318
*/
316-
diffType={diffFile.type}
317-
viewType={viewType}
318-
hunks={hunks}
319-
renderGutter={renderGutter}
320-
tokens={tokens}
321-
className={tableClassName}
322-
gutterClassName={GUTTER_CLASS_NAME}
323-
codeClassName={CODE_CLASS_NAME}
324-
>
325-
{/* eslint-disable-next-line @typescript-eslint/no-shadow */}
326-
{(hunks) => <Hunks hunks={hunks} oldSource={oldSource} expandRange={expandRange} />}
327-
</Diff>
319+
diffType={diffFile.type}
320+
viewType={viewType}
321+
hunks={hunks}
322+
renderGutter={renderGutter}
323+
tokens={tokens}
324+
className={tableClassName}
325+
gutterClassName={GUTTER_CLASS_NAME}
326+
codeClassName={CODE_CLASS_NAME}
327+
>
328+
{/* eslint-disable-next-line @typescript-eslint/no-shadow */}
329+
{(hunks) => <Hunks hunks={hunks} oldSource={oldSource} expandRange={expandRange} />}
330+
</Diff>
331+
</div>
328332
</CustomStyles>
329333
);
330334
};

x-pack/solutions/security/plugins/security_solution/public/detection_engine/rule_management/components/rule_details/three_way_diff/comparison_side/subfield.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ export const Subfield = ({
3232
{shouldDisplaySubfieldLabelForField(fieldName) && (
3333
<SubfieldHeader subfieldName={subfieldName} />
3434
)}
35-
<DiffView oldSource={oldSubfieldValue} newSource={newSubfieldValue} viewType="unified" />
35+
<DiffView
36+
oldSource={oldSubfieldValue}
37+
newSource={newSubfieldValue}
38+
viewType="unified"
39+
data-test-subj="prebuilt-rule-upgrade-diff-view"
40+
/>
3641
</>
3742
);

x-pack/solutions/security/plugins/security_solution/public/detection_engine/rule_management/components/rule_details/three_way_diff/field_final_side/components/field_final_side_content.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ export function FieldFinalSideContent(): JSX.Element {
2525
return (
2626
<>
2727
<EuiFlexGroup justifyContent="flexEnd">
28-
<EuiButtonEmpty iconType="pencil" onClick={setEditMode}>
28+
<EuiButtonEmpty
29+
iconType="pencil"
30+
onClick={setEditMode}
31+
data-test-subj="prebuilt-rule-upgrade-flyout-field-edit"
32+
>
2933
{i18n.EDIT}
3034
</EuiButtonEmpty>
3135
</EuiFlexGroup>
@@ -41,7 +45,11 @@ export function FieldFinalSideContent(): JSX.Element {
4145
return (
4246
<>
4347
<EuiFlexGroup justifyContent="flexEnd">
44-
<EuiButtonEmpty iconType="cross" onClick={setReadOnlyMode}>
48+
<EuiButtonEmpty
49+
iconType="cross"
50+
onClick={setReadOnlyMode}
51+
data-test-subj="prebuilt-rule-upgrade-flyout-field-cancel"
52+
>
4553
{i18n.CANCEL}
4654
</EuiButtonEmpty>
4755
</EuiFlexGroup>

x-pack/solutions/security/plugins/security_solution/public/detection_engine/rule_management/components/rule_details/three_way_diff/field_final_side/components/field_final_side_header.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,12 @@ export function FieldFinalSideHeader(): JSX.Element {
4141
<FieldUpgradeSideHeader>
4242
<StaticHeaderContent>
4343
{hasConflict && (
44-
<EuiButton iconType="checkInCircleFilled" size="s" onClick={handleAccept}>
44+
<EuiButton
45+
iconType="checkInCircleFilled"
46+
size="s"
47+
onClick={handleAccept}
48+
data-test-subj="prebuilt-rule-upgrade-flyout-field-accept"
49+
>
4550
{i18n.ACCEPT}
4651
</EuiButton>
4752
)}
@@ -57,6 +62,7 @@ export function FieldFinalSideHeader(): JSX.Element {
5762
size="s"
5863
disabled={!form?.isValid}
5964
onClick={handleSave}
65+
data-test-subj="prebuilt-rule-upgrade-flyout-field-save"
6066
>
6167
{hasConflict ? i18n.SAVE_AND_ACCEPT : i18n.SAVE}
6268
</EuiButton>

x-pack/solutions/security/plugins/security_solution/public/detection_engine/rule_management/components/rule_details/three_way_diff/final_edit/fields/alert_suppression/form_schema.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@
55
* 2.0.
66
*/
77

8+
import { alertSuppressionFieldsValidatorFactory } from '../../../../../../../rule_creation_ui/validators/alert_suppression_fields_validator_factory';
89
import type {
910
ALERT_SUPPRESSION_DURATION_UNIT_FIELD_NAME,
1011
ALERT_SUPPRESSION_DURATION_VALUE_FIELD_NAME,
1112
ALERT_SUPPRESSION_DURATION_FIELD_NAME,
1213
ALERT_SUPPRESSION_DURATION_TYPE_FIELD_NAME,
14+
} from '../../../../../../../rule_creation/components/alert_suppression_edit';
15+
import {
1316
ALERT_SUPPRESSION_FIELDS_FIELD_NAME,
17+
ALERT_SUPPRESSION_MISSING_FIELDS_FIELD_NAME,
1418
} from '../../../../../../../rule_creation/components/alert_suppression_edit';
15-
import { ALERT_SUPPRESSION_MISSING_FIELDS_FIELD_NAME } from '../../../../../../../rule_creation/components/alert_suppression_edit';
1619
import type {
1720
AlertSuppressionDurationUnit,
1821
AlertSuppressionMissingFieldsStrategy,
@@ -31,6 +34,13 @@ export interface AlertSuppressionFormData {
3134
}
3235

3336
export const alertSuppressionFormSchema = {
37+
[ALERT_SUPPRESSION_FIELDS_FIELD_NAME]: {
38+
validations: [
39+
{
40+
validator: alertSuppressionFieldsValidatorFactory(),
41+
},
42+
],
43+
},
3444
[ALERT_SUPPRESSION_MISSING_FIELDS_FIELD_NAME]: {
3545
defaultValue: DEFAULT_SUPPRESSION_MISSING_FIELDS_STRATEGY,
3646
},

x-pack/solutions/security/plugins/security_solution/public/detection_engine/rule_management_ui/components/rules_table/upgrade_prebuilt_rules_table/use_upgrade_with_conflicts_modal/upgrade_modal.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,27 @@ export const UpgradeWithConflictsModal = memo(function ConfirmUpgradeWithConflic
6565

6666
<EuiModalFooter>
6767
{numOfRulesWithoutConflicts > 0 && (
68-
<EuiButton onClick={confirmUpgradingRulesWithoutConflicts}>
68+
<EuiButton
69+
onClick={confirmUpgradingRulesWithoutConflicts}
70+
data-test-subj="conflicts-modal-upgrade-conflict-free-rules"
71+
>
6972
{i18n.UPGRADE_RULES_WITHOUT_CONFLICTS(numOfRulesWithoutConflicts)}
7073
</EuiButton>
7174
)}
7275
{numOfRulesWithSolvableConflicts > 0 && (
73-
<EuiButton onClick={confirmUpgradingRulesWithSolvableConflicts} color="warning">
76+
<EuiButton
77+
onClick={confirmUpgradingRulesWithSolvableConflicts}
78+
color="warning"
79+
data-test-subj="conflicts-modal-upgrade-rules-with-solvable-conflicts"
80+
>
7481
{i18n.UPGRADE_RULES_WITH_CONFLICTS(
7582
numOfRulesWithoutConflicts + numOfRulesWithSolvableConflicts
7683
)}
7784
</EuiButton>
7885
)}
79-
<EuiButtonEmpty onClick={onCancel}>{i18n.UPGRADE_CONFLICTS_MODAL_CANCEL}</EuiButtonEmpty>
86+
<EuiButtonEmpty onClick={onCancel} data-test-subj="conflicts-modal-cancel">
87+
{i18n.UPGRADE_CONFLICTS_MODAL_CANCEL}
88+
</EuiButtonEmpty>
8089
</EuiModalFooter>
8190
</EuiModal>
8291
);

0 commit comments

Comments
 (0)