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] JSON diffs test plan #175958

Merged
merged 2 commits into from
Feb 2, 2024

Conversation

nikitaindik
Copy link
Contributor

@nikitaindik nikitaindik commented Jan 31, 2024

Resolves: #166162

This PR introduces a test plan for the JSON diff preview. This preview is displayed in the upgrade prebuilt rule flyout.

Scherm­afbeelding 2024-01-31 om 10 38 51

@nikitaindik nikitaindik marked this pull request as ready for review January 31, 2024 09:28
@nikitaindik nikitaindik requested a review from a team as a code owner January 31, 2024 09:28
@nikitaindik nikitaindik requested review from jpdjere and maximpn and removed request for jpdjere January 31, 2024 09:28
@nikitaindik nikitaindik self-assigned this Jan 31, 2024
@nikitaindik nikitaindik added release_note:skip Skip the PR/issue when compiling release notes test-plan Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Detection Rule Management Security Detection Rule Management Team Feature:Prebuilt Detection Rules Security Solution Prebuilt Detection Rules area v8.13.0 labels Jan 31, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-detections-response (Team:Detections and Resp)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-detection-rule-management (Team:Detection Rule Management)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@banderror
Copy link
Contributor

@nikitaindik Let's please request review from someone who's working on the epic.

Copy link
Contributor

@maximpn maximpn left a comment

Choose a reason for hiding this comment

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

@nikitaindik An updated test plan looks good to me 👍


#### **Scenario: User can see precisely how property values would change after upgrade**

**Automation**: 1 UI component-level test
Copy link
Contributor

Choose a reason for hiding this comment

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

Does UI component-level test represent a unit test or it's something different?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I envisioned it to be a react-testing-library test where I would render the flyout passing it the current rule and the updated rule as props. Not sure if this can be considered a "unit test", probably more like "integration test". Would "UI integration test" work better?

@jpdjere
Copy link
Contributor

jpdjere commented Feb 1, 2024

@nikitaindik Can you add a Table of Contents at the beggining? The file has become large enough already that is hard to navigate or have an overview in mind of the sections:

-   [Useful information](#useful-information)
    -   [Tickets](#tickets)
    -   [Terminology](#terminology)
    -   [Assumptions](#assumptions)
    -   [Non-functional requirements](#non-functional-requirements)
    -   [Functional requirements](#functional-requirements)
-   [Scenarios](#scenarios)
    -   [Package installation](#package-installation)
        -   [**Scenario: Package is installed via Fleet**](#scenario-package-is-installed-via-fleet)
        -   [**Scenario: Package is installed via bundled Fleet package in Kibana**](#scenario-package-is-installed-via-bundled-fleet-package-in-kibana)
        -   [**Scenario: Large package can be installed on a small Kibana instance**](#scenario-large-package-can-be-installed-on-a-small-kibana-instance)
    -   [Rule installation and upgrade via the Prebuilt rules API](#rule-installation-and-upgrade-via-the-prebuilt-rules-api)
        -   [**Scenario: API can install all prebuilt rules**](#scenario-api-can-install-all-prebuilt-rules)
        -   [**Scenario: API can install prebuilt rules that are not yet installed**](#scenario-api-can-install-prebuilt-rules-that-are-not-yet-installed)
        -   [**Scenario: API can upgrade prebuilt rules that are outdated**](#scenario-api-can-upgrade-prebuilt-rules-that-are-outdated)
        -   [**Scenario: API does not install or upgrade prebuilt rules if they are up to date**](#scenario-api-does-not-install-or-upgrade-prebuilt-rules-if-they-are-up-to-date)
    -   [Scenarios for the real package](#scenarios-for-the-real-package)
        -   [**Scenario: User can install prebuilt rules from scratch, then install new rules and upgrade existing rules from the new package**](#scenario-user-can-install-prebuilt-rules-from-scratch-then-install-new-rules-and-upgrade-existing-rules-from-the-new-package)
    -   [Rule installation and upgrade notifications on the Rule Management page](#rule-installation-and-upgrade-notifications-on-the-rule-management-page)
        -   [**Scenario: User is NOT notified when no prebuilt rules are installed and there are no prebuilt rules assets**](#scenario-user-is-not-notified-when-no-prebuilt-rules-are-installed-and-there-are-no-prebuilt-rules-assets)
        -   [**Scenario: User is NOT notified when all prebuilt rules are installed and up to date**](#scenario-user-is-not-notified-when-all-prebuilt-rules-are-installed-and-up-to-date)
        -   [**Scenario: User is notified when no prebuilt rules are installed and there are rules available to install**](#scenario-user-is-notified-when-no-prebuilt-rules-are-installed-and-there-are-rules-available-to-install)
        -   [**Scenario: User is notified when some prebuilt rules can be installed**](#scenario-user-is-notified-when-some-prebuilt-rules-can-be-installed)
        -   [**Scenario: User is notified when some prebuilt rules can be upgraded**](#scenario-user-is-notified-when-some-prebuilt-rules-can-be-upgraded)
        -   [**Scenario: User is notified when both rules to install and upgrade are available**](#scenario-user-is-notified-when-both-rules-to-install-and-upgrade-are-available)
        -   [**Scenario: User is notified after a prebuilt rule gets deleted**](#scenario-user-is-notified-after-a-prebuilt-rule-gets-deleted)
    -   [Rule installation workflow: base cases](#rule-installation-workflow-base-cases)
        -   [**Scenario: User can install prebuilt rules one by one**](#scenario-user-can-install-prebuilt-rules-one-by-one)
        -   [**Scenario: User can install multiple prebuilt rules selected on the page**](#scenario-user-can-install-multiple-prebuilt-rules-selected-on-the-page)
        -   [**Scenario: User can install all available prebuilt rules at once**](#scenario-user-can-install-all-available-prebuilt-rules-at-once)
        -   [**Scenario: Empty screen is shown when all prebuilt rules are installed**](#scenario-empty-screen-is-shown-when-all-prebuilt-rules-are-installed)
        -   [**Scenario: User can preview rules available for installation**](#scenario-user-can-preview-rules-available-for-installation)
        -   [**Scenario: User can install a rule using the rule preview**](#scenario-user-can-install-a-rule-using-the-rule-preview)
        -   [**Scenario: User can see correct rule information in preview before installing**](#scenario-user-can-see-correct-rule-information-in-preview-before-installing)
        -   [**Scenario: Tabs and sections without content should be hidden in preview before installing**](#scenario-tabs-and-sections-without-content-should-be-hidden-in-preview-before-installing)
    -   [Rule installation workflow: filtering, sorting, pagination](#rule-installation-workflow-filtering-sorting-pagination)
    -   [Rule installation workflow: misc cases](#rule-installation-workflow-misc-cases)
        -   [**Scenario: User opening the Add Rules page sees a loading skeleton until the package installation is completed**](#scenario-user-opening-the-add-rules-page-sees-a-loading-skeleton-until-the-package-installation-is-completed)
        -   [**Scenario: User can navigate from the Add Rules page to the Rule Management page via breadcrumbs**](#scenario-user-can-navigate-from-the-add-rules-page-to-the-rule-management-page-via-breadcrumbs)
    -   [Rule upgrade workflow: base cases](#rule-upgrade-workflow-base-cases)
        -   [**Scenario: User can upgrade prebuilt rules one by one**](#scenario-user-can-upgrade-prebuilt-rules-one-by-one)
        -   [**Scenario: User can upgrade multiple prebuilt rules selected on the page**](#scenario-user-can-upgrade-multiple-prebuilt-rules-selected-on-the-page)
        -   [**Scenario: User can upgrade all available prebuilt rules at once**](#scenario-user-can-upgrade-all-available-prebuilt-rules-at-once)
        -   [**Scenario: User can preview rules available for upgrade**](#scenario-user-can-preview-rules-available-for-upgrade)
        -   [**Scenario: User can upgrade a rule using the rule preview**](#scenario-user-can-upgrade-a-rule-using-the-rule-preview)
        -   [**Scenario: User can see correct rule information in preview before upgrading**](#scenario-user-can-see-correct-rule-information-in-preview-before-upgrading)
        -   [**Scenario: Tabs and sections without content should be hidden in preview before upgrading**](#scenario-tabs-and-sections-without-content-should-be-hidden-in-preview-before-upgrading)
    -   [Rule upgrade workflow: filtering, sorting, pagination](#rule-upgrade-workflow-filtering-sorting-pagination)
    -   [Rule upgrade workflow: viewing rule changes before upgrading](#rule-upgrade-workflow-viewing-rule-changes-before-upgrading)
        -   [**Scenario: User can see changes in a side-by-side view**](#scenario-user-can-see-changes-in-a-side-by-side-view)
        -   [**Scenario: User can see precisely how property values would change after upgrade**](#scenario-user-can-see-precisely-how-property-values-would-change-after-upgrade)
        -   [**Scenario: Rule actions and exception lists should not be shown as modified**](#scenario-rule-actions-and-exception-lists-should-not-be-shown-as-modified)
        -   [**Scenario: Stateful properties should not be included in preview**](#scenario-stateful-properties-should-not-be-included-in-preview)
        -   [**Scenario: Technical properties should not be included in preview**](#scenario-technical-properties-should-not-be-included-in-preview)
        -   [**Scenario: Properties with semantically equal values should not be shown as modified**](#scenario-properties-with-semantically-equal-values-should-not-be-shown-as-modified)
        -   [**Scenario: Unchanged sections of a rule should be hidden by default**](#scenario-unchanged-sections-of-a-rule-should-be-hidden-by-default)
        -   [**Scenario: Properties should be sorted alphabetically**](#scenario-properties-should-be-sorted-alphabetically)
    -   [Rule upgrade workflow: misc cases](#rule-upgrade-workflow-misc-cases)
        -   [**Scenario: User doesn't see the Rule Updates tab until the package installation is completed**](#scenario-user-doesnt-see-the-rule-updates-tab-until-the-package-installation-is-completed)
    -   [Error handling](#error-handling)
        -   [**Scenario: Error is handled when any operation on prebuilt rules fails**](#scenario-error-is-handled-when-any-operation-on-prebuilt-rules-fails)
    -   [Authorization / RBAC](#authorization-rbac)
        -   [**Scenario: User with read privileges on Security Solution cannot install prebuilt rules**](#scenario-user-with-read-privileges-on-security-solution-cannot-install-prebuilt-rules)
        -   [**Scenario: User with read privileges on Security Solution cannot upgrade prebuilt rules**](#scenario-user-with-read-privileges-on-security-solution-cannot-upgrade-prebuilt-rules)
    -   [Kibana upgrade](#kibana-upgrade)
        -   [**Scenario: User can use prebuilt rules after upgrading Kibana from version A to B**](#scenario-user-can-use-prebuilt-rules-after-upgrading-kibana-from-version-a-to-b)

Given a rule preview with rule changes is open
Then each line of <column> that was <change_type> should have <bg_color> background
And marked with <line_badge> badge
And each changed word in <column> should be highlighted with <accent_color>
Copy link
Contributor

Choose a reason for hiding this comment

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

I cannot recall now, but we are only using only WORD diffing for the whole JSON, right? No need to test other uses cases, like character diffing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, at this stage it's by word only.

Copy link
Contributor

@jpdjere jpdjere left a comment

Choose a reason for hiding this comment

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

Some comments and nits, but overall LGTM 👍 ✅

Copy link
Contributor

@banderror banderror left a comment

Choose a reason for hiding this comment

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

Scenarios look fantastic! Thank you @nikitaindik.
Left a bunch of nits.

@nikitaindik nikitaindik merged commit 3e71c40 into elastic:main Feb 2, 2024
6 checks passed
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Feb 2, 2024
fkanout pushed a commit to fkanout/kibana that referenced this pull request Feb 7, 2024
**Resolves: elastic#166162

This PR introduces a test plan for the JSON diff preview. This preview
is displayed in the upgrade prebuilt rule flyout.

<img width="1209" alt="Scherm­afbeelding 2024-01-31 om 10 38 51"
src="https://github.com/elastic/kibana/assets/15949146/9f4ffcca-31fe-464e-9315-c90ec38696d6">
CoenWarmer pushed a commit to CoenWarmer/kibana that referenced this pull request Feb 15, 2024
**Resolves: elastic#166162

This PR introduces a test plan for the JSON diff preview. This preview
is displayed in the upgrade prebuilt rule flyout.

<img width="1209" alt="Scherm­afbeelding 2024-01-31 om 10 38 51"
src="https://github.com/elastic/kibana/assets/15949146/9f4ffcca-31fe-464e-9315-c90ec38696d6">
kibanamachine added a commit that referenced this pull request Feb 19, 2024
# Backport

This will backport the following commits from `main` to `8.13`:
- [[Security Solution] JSON diffs test coverage
(#176770)](#176770)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Nikita
Indik","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-02-19T15:12:51Z","message":"[Security
Solution] JSON diffs test coverage (#176770)\n\n**Resolves:
https://github.com/elastic/kibana/issues/166163**\r\n\r\nFlaky test
runner
runs:\r\n[1](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5189),\r\n[2](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5190),\r\n[3](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5191),\r\n[4](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5192)\r\n\r\n##
Summary\r\nThis PR adds tests in accordance with the
[test\r\nplan](#175958) that was
merged\r\nearlier.","sha":"cd374d23368de182a96df0948192a9bca7bdc4aa","branchLabelMapping":{"^v8.14.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","test-coverage","Team:Detections
and Resp","Team: SecuritySolution","Team:Detection Rule
Management","Feature:Prebuilt Detection
Rules","v8.13.0","v8.14.0"],"title":"[Security Solution] JSON diffs test
coverage","number":176770,"url":"https://github.com/elastic/kibana/pull/176770","mergeCommit":{"message":"[Security
Solution] JSON diffs test coverage (#176770)\n\n**Resolves:
https://github.com/elastic/kibana/issues/166163**\r\n\r\nFlaky test
runner
runs:\r\n[1](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5189),\r\n[2](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5190),\r\n[3](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5191),\r\n[4](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5192)\r\n\r\n##
Summary\r\nThis PR adds tests in accordance with the
[test\r\nplan](#175958) that was
merged\r\nearlier.","sha":"cd374d23368de182a96df0948192a9bca7bdc4aa"}},"sourceBranch":"main","suggestedTargetBranches":["8.13"],"targetPullRequestStates":[{"branch":"8.13","label":"v8.13.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.14.0","branchLabelMappingKey":"^v8.14.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/176770","number":176770,"mergeCommit":{"message":"[Security
Solution] JSON diffs test coverage (#176770)\n\n**Resolves:
https://github.com/elastic/kibana/issues/166163**\r\n\r\nFlaky test
runner
runs:\r\n[1](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5189),\r\n[2](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5190),\r\n[3](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5191),\r\n[4](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5192)\r\n\r\n##
Summary\r\nThis PR adds tests in accordance with the
[test\r\nplan](#175958) that was
merged\r\nearlier.","sha":"cd374d23368de182a96df0948192a9bca7bdc4aa"}}]}]
BACKPORT-->

Co-authored-by: Nikita Indik <[email protected]>
fkanout pushed a commit to fkanout/kibana that referenced this pull request Mar 4, 2024
**Resolves: elastic#166162

This PR introduces a test plan for the JSON diff preview. This preview
is displayed in the upgrade prebuilt rule flyout.

<img width="1209" alt="Scherm­afbeelding 2024-01-31 om 10 38 51"
src="https://github.com/elastic/kibana/assets/15949146/9f4ffcca-31fe-464e-9315-c90ec38696d6">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Prebuilt Detection Rules Security Solution Prebuilt Detection Rules area release_note:skip Skip the PR/issue when compiling release notes Team:Detection Rule Management Security Detection Rule Management Team Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. test-plan v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Security Solution] Write a test plan for the JSON diff tab of prebuilt rule flyout
6 participants