-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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][Detections] Adds exception modal tests #74596
Conversation
7ebdf20
to
4b54bdb
Compare
Pinging @elastic/siem (Team:SIEM) |
9c1524b
to
2346c39
Compare
@@ -259,7 +259,8 @@ export const EditExceptionModal = memo(function EditExceptionModal({ | |||
<ModalBodySection> | |||
<EuiFormRow fullWidth> | |||
<EuiCheckbox | |||
id="close-alert-on-add-add-exception-checkbox" | |||
data-test-subj="close-alert-on-add-edit-exception-checkbox" | |||
id="close-alert-on-add-edit-exception-checkbox" |
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.
I don't think you need this id here do you? Looks like above you're using data-test-subj successfully?
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.
i believe the id
is a required field for the EuiCheckbox
, would spit out a console warning and potentially cause usage problems if 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.
Yeah looking at the docs and searching around this looks like it is required.
ruleIndices={['filebeat-*']} | ||
ruleName={ruleName} | ||
exceptionListType={'endpoint'} | ||
onCancel={() => {}} |
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.
nit: If you search through the code base most of the time people across the plugins and code base do this when stubbing out no operations:
jest.fn()
Makes it easier as a stub that it won't blow up later on as it's more accepting of what can call it, etc...
For example:
onCancel={jest.fn()}
wrapper.find('button[data-test-subj="add-exception-confirm-button"]').getDOMNode() | ||
).not.toBeDisabled(); | ||
}); | ||
|
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.
nit: Seems weird to have a new line break here but not between the describe blocks or other it blocks?
I would change the newlines you have to be consistent. The new lines between test/it/describe blocks seem to be what most people do everywhere across plugins. Some people don't though (which is not a biggie to me which way to choose as long as consistency within a single file is maintained.
For a "science based reason" if I was going to make the argument of using new line blocks between it blocks and it/describe blocks is that spacing is a "pre-attentive attribute" meaning that when reading blocks of code we will naturally group things based on spacial distance between things before having to think consciously so it makes it easier to read them. Several posts about this and the other preattentive attributes is out there and good reads IMHO.
http://daydreamingnumbers.com/blog/preattentive-attributes-example/
makes kind of sense when you think about how the IDE adds color in some aspects to make things stand out.
@@ -112,7 +112,7 @@ export const AddExceptionComments = memo(function AddExceptionComments({ | |||
<EuiFlexItem grow={1}> | |||
<EuiTextArea | |||
placeholder={i18n.ADD_COMMENT_PLACEHOLDER} | |||
aria-label="Use aria labels when no actual label is in use" | |||
aria-label="Comment Input" |
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.
Nice catch! 👍
94f0ca3
to
4cf0023
Compare
💚 Build SucceededBuild metricsasync chunks size
History
To update your PR or re-run it, just comment with: |
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.
LGTM, thanks for the good catches on aria-label, explanations on the id, and the unit tests
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.
Thanks for adding this coverage!
* master: Skip failing test in CI (elastic#75266) [Task Manager] time out work when it overruns in poller (elastic#74980) [Drilldowns] misc improvements & fixes (elastic#75276) Small README note on bumping memory for builds (elastic#75247) [Security Solution][Detections] Adds exception modal tests (elastic#74596) [Dashboard] Sample data link does not work (elastic#75262) [Dashboard First] Unlink from Library Action With ReferenceOrValueEmbeddable (elastic#74905) [Form lib] Fix issue where serializer on fields are called on every change (elastic#75166) convert processor labels to sentence case (elastic#75278) [Monaco] Refactor the way XJSON grammar checker gets registered (elastic#75160) Clarify no documents error message when filtering by is_training (elastic#75227) [Lens] Fix crash when two layers xychart switches to pie (elastic#75267) [Observability Homepage] Fix console error because of side effect (elastic#75258) [Usage Collection] Add `legacy=true` option to the /api/stats request in the docs (elastic#75146) [ML] Functional tests - re-activate DFA test suites (elastic#75257) GS providers improvements (elastic#75174) [Visualize] First version of by-value visualize editor (elastic#72256)
…emove-header * saved-objects/version-on-create: (59 commits) remove version when loading sample data omit version from SO import/export Skip failing test in CI (elastic#75266) [Task Manager] time out work when it overruns in poller (elastic#74980) [Drilldowns] misc improvements & fixes (elastic#75276) Small README note on bumping memory for builds (elastic#75247) [Security Solution][Detections] Adds exception modal tests (elastic#74596) Revert "Revert "added missing core docs"" Revert "Revert "added version to saved object bulk creation"" [Dashboard] Sample data link does not work (elastic#75262) [Dashboard First] Unlink from Library Action With ReferenceOrValueEmbeddable (elastic#74905) [Form lib] Fix issue where serializer on fields are called on every change (elastic#75166) convert processor labels to sentence case (elastic#75278) [Monaco] Refactor the way XJSON grammar checker gets registered (elastic#75160) Clarify no documents error message when filtering by is_training (elastic#75227) [Lens] Fix crash when two layers xychart switches to pie (elastic#75267) [Observability Homepage] Fix console error because of side effect (elastic#75258) [Usage Collection] Add `legacy=true` option to the /api/stats request in the docs (elastic#75146) [ML] Functional tests - re-activate DFA test suites (elastic#75257) GS providers improvements (elastic#75174) ...
Pinging @elastic/security-solution (Team: SecuritySolution) |
Summary
Adds jest tests for the add and edit exception modals to cover all current state variations based on props
Checklist
Delete any items that are not applicable to this PR.
For maintainers