Skip to content

Conversation

@cnasikas
Copy link
Member

@cnasikas cnasikas commented Sep 3, 2021

Summary

When a user tries to attach an alert to a case the cases modal selector appears. In the modal, the user can see the status dropdown and try to change the status instead of selecting the case. This PR fixes this issue by hiding the status dropdown from the modal.

Ref: #110931

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@cnasikas cnasikas added bug Fixes for quality problems that affect the customer experience v8.0.0 release_note:skip Skip the PR/issue when compiling release notes Team:Threat Hunting Security Solution Threat Hunting Team v7.15.0 v7.16.0 labels Sep 3, 2021
@cnasikas cnasikas self-assigned this Sep 3, 2021
@cnasikas cnasikas requested a review from a team as a code owner September 3, 2021 09:49
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-threat-hunting (Team:Threat Hunting)

Comment on lines 946 to 948
await waitFor(() => {
expect(wrapper.find('[data-test-subj="case-view-status-dropdown"]').exists()).toBeFalsy();
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: Is this waitFor waiting for the dropdown not to be there? If the modal is not open yet when it is tested, won't it pass the test anyway? I am not sure, but if it's the case, maybe we could "waitFor" the modal to exist, and then test that the dropdown is not there.

Copy link
Member Author

@cnasikas cnasikas Sep 3, 2021

Choose a reason for hiding this comment

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

@semd The waitFor is to wait for the hooks of the component. If I do not put it within the waitFor then I get the following warning:

 Warning: An update to CasesTableFiltersComponent inside a test was not wrapped in act(...).

    When testing, code that causes React state updates should be wrapped into act(...):

    act(() => {
      /* fire events that update state */
    });
    /* assert on the output */

    This ensures that you're testing the behavior the user would see in the browser. Learn more at https://fb.me/react-wrap-tests-with-act
        in CasesTableFiltersComponent
        in span
        in Unknown
        in OwnerProvider (created by TestProvidersComponent)
        in ThemeProvider (created by TestProvidersComponent)
        in Provider
        in Unknown (created by TestProvidersComponent)
        in PseudoLocaleWrapper (created by I18nProvider)
        in IntlProvider (created by I18nProvider)
        in I18nProvider (created by TestProvidersComponent)
        in TestProvidersComponent (created by WrapperComponent)
        in WrapperComponent

If the modal is not open yet when it is tested, won't it pass the test anyway? I am not sure, but if it's the case, maybe we could "waitFor" the modal to exist, and then test that the dropdown is not there.

The component that we test is not modal. It is put into a body of a modal by another component. In this component, if you pass the isSelectorView prop you tell the component that it will be used to select cases not to show them. You are right that we should wait for the component to be ready and then check the existence of the dropdown. I changed it accordingly. Thanks!

Copy link
Contributor

@semd semd left a comment

Choose a reason for hiding this comment

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

Tested locally, the status dropdown does not appear anymore in the "Add to existing case" alert action modal.
LGTM 🚀

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
cases 711.3KB 711.4KB +54.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @cnasikas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Fixes for quality problems that affect the customer experience release_note:skip Skip the PR/issue when compiling release notes Team:Threat Hunting Security Solution Threat Hunting Team v7.15.0 v7.16.0 v8.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants