Skip to content

Commit

Permalink
[Security Solution] Prebuilt rule installation / upgrade flyout test …
Browse files Browse the repository at this point in the history
…coverage (#169537)

**Resolves: #166161

**Flaky test runner pipelne:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3868**

## Summary
Adds test coverage based on the test plan:
https://github.com/elastic/kibana/pull/167727/files

<img width="1301" alt="272390474-1aa7aa8b-3746-4767-82ad-f4910034d5eb"
src="https://github.com/elastic/kibana/assets/15949146/4ad6a27a-eeef-467b-bb72-1caf48bfb7e5">

---------

Co-authored-by: kibanamachine <[email protected]>
  • Loading branch information
nikitaindik and kibanamachine authored Nov 5, 2023
1 parent 5406e2c commit e389991
Show file tree
Hide file tree
Showing 26 changed files with 2,155 additions and 267 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ There's a legacy prebuilt rules API and a new one. Both should be tested against

#### **Scenario: API can install all prebuilt rules**

**Automation**: 8 integration tests with mock rules: 4 examples below * 2 (we split checking API response and installed rules into two different tests).
**Automation**: 8 integration tests with mock rules: 4 examples below \* 2 (we split checking API response and installed rules into two different tests).

```Gherkin
Given the package <package_type> is installed
Expand Down Expand Up @@ -436,7 +436,7 @@ And user should see the number of rules available to install (Y)

#### **Scenario: User can install prebuilt rules one by one**

**Automation**: 1 e2e test with mock rules + integration tests with mock rules that would test /status and /installation/* endpoints in integration.
**Automation**: 1 e2e test with mock rules + integration tests with mock rules that would test /status and /installation/\* endpoints in integration.

```Gherkin
Given no prebuilt rules are installed in Kibana
Expand All @@ -453,7 +453,7 @@ And user should see the number of rules available to install decreased by 1

#### **Scenario: User can install multiple prebuilt rules selected on the page**

**Automation**: 1 e2e test with mock rules + integration tests with mock rules that would test /status and /installation/* endpoints in integration.
**Automation**: 1 e2e test with mock rules + integration tests with mock rules that would test /status and /installation/\* endpoints in integration.

```Gherkin
Given no prebuilt rules are installed in Kibana
Expand All @@ -477,7 +477,7 @@ Examples:

#### **Scenario: User can install all available prebuilt rules at once**

**Automation**: 1 e2e test with mock rules + integration tests with mock rules that would test /status and /installation/* endpoints in integration.
**Automation**: 1 e2e test with mock rules + integration tests with mock rules that would test /status and /installation/\* endpoints in integration.

```Gherkin
Given no prebuilt rules are installed in Kibana
Expand Down Expand Up @@ -506,7 +506,7 @@ Then user should see a message indicating that all available rules have been ins
And user should see a CTA that leads to the Rule Management page
```

#### **Scenario: User can preview a rule before installing**
#### **Scenario: User can preview rules available for installation**

**Automation**: 1 e2e test

Expand All @@ -519,15 +519,26 @@ When user opens the rule preview for the 1st rule
Then the preview should open
When user closes the preview
Then it should disappear
When user opens the rule preview for the 2nd rule
```

#### **Scenario: User can install a rule using the rule preview**

**Automation**: 1 e2e test

```Gherkin
Given no prebuilt rules are installed in Kibana
And there are 2 rules available to install
When user opens the Add Rules page
Then all rules available for installation should be displayed in the table
When user opens the rule preview for the rule
Then the preview should open
When user installs the rule using a CTA in the rule preview
Then the 2nd rule should be installed
Then the rule should be installed
And a success message should be displayed after installation
And the 2nd rule should be removed from the Add Rules table
And the rule should be removed from the Add Rules table
When user navigates back to the Rule Management page
Then user should see a CTA to install prebuilt rules
And user should see the number of rules available to install as 1
And user should see the number of rules available to install as initial number minus 1
```

#### **Scenario: User can see correct rule information in preview before installing**
Expand Down Expand Up @@ -594,7 +605,7 @@ Then the Rule Management page should be displayed

#### **Scenario: User can upgrade prebuilt rules one by one**

**Automation**: 1 e2e test with mock rules + integration tests with mock rules that would test /status and /upgrade/* endpoints in integration.
**Automation**: 1 e2e test with mock rules + integration tests with mock rules that would test /status and /upgrade/\* endpoints in integration.

```Gherkin
Given X prebuilt rules are installed in Kibana
Expand All @@ -610,7 +621,7 @@ And user should see the number of rules available to upgrade decreased by 1

#### **Scenario: User can upgrade multiple prebuilt rules selected on the page**

**Automation**: 1 e2e test with mock rules + integration tests with mock rules that would test /status and /upgrade/* endpoints in integration.
**Automation**: 1 e2e test with mock rules + integration tests with mock rules that would test /status and /upgrade/\* endpoints in integration.

```Gherkin
Given X prebuilt rules are installed in Kibana
Expand All @@ -633,7 +644,7 @@ Examples:

#### **Scenario: User can upgrade all available prebuilt rules at once**

**Automation**: 1 e2e test with mock rules + integration tests with mock rules that would test /status and /upgrade/* endpoints in integration.
**Automation**: 1 e2e test with mock rules + integration tests with mock rules that would test /status and /upgrade/\* endpoints in integration.

```Gherkin
Given X prebuilt rules are installed in Kibana
Expand All @@ -648,27 +659,37 @@ And user should NOT see a number of rules available to upgrade
And user should NOT see the Rule Updates table
```

#### **Scenario: User can preview a rule before upgrading**

**Automation**: 1 e2e test
#### **Scenario: User can preview rules available for upgrade**

```Gherkin
Given 2 prebuilt rules are installed in Kibana
And for these 2 installed rules there are new versions available
Given there is at least one prebuilt rule installed in Kibana
And for this rule there is a new version available
And user is on the Rule Management page
When user opens the Rule Updates table
Then all rules available for upgrade should be displayed in the table
When user opens the rule preview for the 1st rule
Then this rule should be displayed in the table
When user opens the rule preview for this rule
Then the preview should open
When user closes the preview
Then it should disappear
When user opens the rule preview for the 2nd rule
```

#### **Scenario: User can upgrade a rule using the rule preview**

**Automation**: 1 e2e test

```Gherkin
Given there is at least one prebuilt rule installed in Kibana
And for this rule there is a new version available
And user is on the Rule Management page
When user opens the Rule Updates table
Then this rule should be displayed in the table
When user opens the rule preview for this rule
Then the preview should open
When user upgrades the rule using a CTA in the rule preview
Then the 2nd rule should be upgraded to the latest version
Then the rule should be upgraded to the latest version
And a success message should be displayed after upgrade
And the 2nd rule should be removed from the Rule Updates table
And user should see the number of rules available to upgrade as 1
And the rule should be removed from the Rule Updates table
And user should see the number of rules available to upgrade as initial number minus 1
```

#### **Scenario: User can see correct rule information in preview before upgrading**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ const StyledEuiBadge = styled(EuiBadge)`

interface BadgeListProps {
badges: string[];
'data-test-subj'?: string;
}

export const BadgeList = ({ badges }: BadgeListProps) => (
<EuiFlexGroup responsive={false} gutterSize="xs" wrap>
export const BadgeList = ({ badges, 'data-test-subj': dataTestSubj }: BadgeListProps) => (
<EuiFlexGroup responsive={false} gutterSize="xs" wrap data-test-subj={dataTestSubj}>
{badges.map((badge: string) => (
<EuiFlexItem grow={false} key={`badge-${badge}`}>
<EuiFlexItem grow={false} key={`badge-${badge}`} data-test-subj={`${dataTestSubj}Item`}>
<StyledEuiBadge color="hollow">{badge}</StyledEuiBadge>
</EuiFlexItem>
))}
Expand Down
Loading

0 comments on commit e389991

Please sign in to comment.