Skip to content

[Chore] Remove third-party testing internals from test snapshots#192747

Merged
rylnd merged 2 commits intoelastic:mainfrom
rylnd:remove_internals_from_snapshots
Sep 13, 2024
Merged

[Chore] Remove third-party testing internals from test snapshots#192747
rylnd merged 2 commits intoelastic:mainfrom
rylnd:remove_internals_from_snapshots

Conversation

@rylnd
Copy link
Contributor

@rylnd rylnd commented Sep 12, 2024

Summary

This removes some indavertent testing of third-party APIs/implementations caused by 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 (#192368 being the reason for this commit) and testing-library from the snapshots.

Checklist

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.
@rylnd rylnd added chore testing Issues related to tests. labels Sep 12, 2024
@rylnd rylnd marked this pull request as ready for review September 12, 2024 16:52
@rylnd rylnd requested review from a team as code owners September 12, 2024 16:52
@rylnd rylnd requested a review from nkhristinin September 12, 2024 16:52
@rylnd rylnd added release_note:skip Skip the PR/issue when compiling release notes Team:Detection Engine Security Solution Detection Engine Area labels Sep 12, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-detection-engine (Team:Detection Engine)

Copy link
Contributor

@opauloh opauloh left a comment

Choose a reason for hiding this comment

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

LGTM - Thanks!

@kibana-ci
Copy link

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

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

@rylnd rylnd merged commit 4efcc28 into elastic:main Sep 13, 2024
@rylnd rylnd deleted the remove_internals_from_snapshots branch September 13, 2024 22:47
@kibanamachine kibanamachine added v9.0.0 backport:skip This PR does not require backporting labels Sep 13, 2024
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.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting chore release_note:skip Skip the PR/issue when compiling release notes Team:Detection Engine Security Solution Detection Engine Area testing Issues related to tests. v9.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants