[Chore] Remove third-party testing internals from test snapshots#192747
Merged
rylnd merged 2 commits intoelastic:mainfrom Sep 13, 2024
Merged
[Chore] Remove third-party testing internals from test snapshots#192747rylnd merged 2 commits intoelastic:mainfrom
rylnd merged 2 commits intoelastic:mainfrom
Conversation
This removes some indavertent testing of third-party APIs/implementations by not directly passing the result of a `render()` call to `toMatchSnapshot()`. In all cases, this was solved by passing `render().container` (the root element rendered by the testing library) instead. These changes remove implementation details of both styled-components (elastic#192368 being the reason for this commit) and testing-library from the snapshots.
Contributor
|
Pinging @elastic/security-detection-engine (Team:Detection Engine) |
nkhristinin
approved these changes
Sep 13, 2024
💚 Build Succeeded
Metrics [docs]
History
To update your PR or re-run it, just comment with: |
rylnd
added a commit
to rylnd/kibana
that referenced
this pull request
Apr 23, 2025
These tests serve one purpose: to fail when a component's markup changes. While this can be useful, in these cases the snapshots are _mostly_ EUI components, which we trust (but verify) to change over time. I had made a previous attempt to correct our testing of EUI in elastic#192747, but the recent elastic#218778 demonstrated that there are still issues. Since these tests already contain other, more directed assertions, the approach here is to simply remove the snapshot assertions.
rylnd
added a commit
to rylnd/kibana
that referenced
this pull request
Apr 24, 2025
These tests serve one purpose: to fail when a component's markup changes. While this can be useful, in these cases the snapshots are _mostly_ EUI components, which we trust (but verify) to change over time. I had made a previous attempt to correct our testing of EUI in elastic#192747, but the recent elastic#218778 demonstrated that there are still issues. Since these tests already contain other, more directed assertions, the approach here is to simply remove the snapshot assertions.
1 task
rylnd
added a commit
that referenced
this pull request
Apr 30, 2025
… components (#219026) ## Summary This removes some snapshot tests for some UI components related to Security Exceptions. These tests serve one purpose: to fail when a component's markup changes. While this can be useful, in these cases the snapshots are _mostly_ EUI components, which we trust (but verify) to change over time. I had made a previous attempt to correct our testing of EUI in #192747, but the recent #218778 demonstrated that there are still issues. Since these tests already contain other, more direct assertions, and since the components being tested are themselves mostly comprised of EUI components, the approach here is to simply remove the snapshot assertions themselves. ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
pborgonovi
pushed a commit
that referenced
this pull request
Apr 30, 2025
… components (#219026) ## Summary This removes some snapshot tests for some UI components related to Security Exceptions. These tests serve one purpose: to fail when a component's markup changes. While this can be useful, in these cases the snapshots are _mostly_ EUI components, which we trust (but verify) to change over time. I had made a previous attempt to correct our testing of EUI in #192747, but the recent #218778 demonstrated that there are still issues. Since these tests already contain other, more direct assertions, and since the components being tested are themselves mostly comprised of EUI components, the approach here is to simply remove the snapshot assertions themselves. ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
akowalska622
pushed a commit
to akowalska622/kibana
that referenced
this pull request
May 29, 2025
… components (elastic#219026) ## Summary This removes some snapshot tests for some UI components related to Security Exceptions. These tests serve one purpose: to fail when a component's markup changes. While this can be useful, in these cases the snapshots are _mostly_ EUI components, which we trust (but verify) to change over time. I had made a previous attempt to correct our testing of EUI in elastic#192747, but the recent elastic#218778 demonstrated that there are still issues. Since these tests already contain other, more direct assertions, and since the components being tested are themselves mostly comprised of EUI components, the approach here is to simply remove the snapshot assertions themselves. ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This removes some indavertent testing of third-party APIs/implementations caused by directly passing the result of a
render()call totoMatchSnapshot().In all cases, this was solved by passing
render().container(the root element rendered by the testing library) instead.These changes remove implementation details of both styled-components (#192368 being the reason for this commit) and testing-library from the snapshots.
Checklist