-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Cases] Do not show status dropdown on modal cases selector #111101
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
Conversation
|
Pinging @elastic/security-threat-hunting (Team:Threat Hunting) |
| await waitFor(() => { | ||
| expect(wrapper.find('[data-test-subj="case-view-status-dropdown"]').exists()).toBeFalsy(); | ||
| }); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
semd
left a comment
There was a problem hiding this 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 🚀
💚 Build SucceededMetrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: cc @cnasikas |
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