Skip to content

Conversation

@Latropos
Copy link
Contributor

@Latropos Latropos commented Jun 6, 2024

Summary

This PR was extracted from #6047, it contains adjustments in individual test files that make them work on Android.

Test plan

Tested on Paper, Android. Works after applying changes from #6047

github-merge-queue bot pushed a commit that referenced this pull request Jun 17, 2024
## Summary
Previously recording snapshots of component containing multiple views
were generating array of all the updates in random order.

The new API is as follows:
```
const component = getTestComponent('ComponentRed');
expect(updatesContainer.getUpdates(component)).toMatchSnapshots(Snapshots.component);
```
If you don't specify any component, but snapshot recorded more than one
an error is thrown. Same if you specify a component, but there is only
one recording.

Other changes in this PR include:
* Organise logic of matcher functions:
  * Move rawMatchers into separate file
  * Move snapshot matchers into separate file
* Clean up error log of snapshot mismatch and format as an array:
<img width="625" alt="Screenshot 2024-06-06 at 16 23 20"
src="https://github.com/software-mansion/react-native-reanimated/assets/56199675/c239e65c-d71a-44af-83cd-c3256da1d51f">

 
## Test plan
File `Animations.test.tsx` was renamed into
`TestsOfTestingFramework.test.tsx`, include some tests of snapshot
mismatch (and mismatch of callback functions)
Tested on Paper, on IOS and Android. Some of the fixes, created to make
tests work well on Android, were extracted into separate PR
#6084
@Latropos Latropos closed this Jul 2, 2024
r0h0gg6 pushed a commit to r0h0gg6/react-native-reanimated that referenced this pull request Jul 28, 2025
## Summary
Previously recording snapshots of component containing multiple views
were generating array of all the updates in random order.

The new API is as follows:
```
const component = getTestComponent('ComponentRed');
expect(updatesContainer.getUpdates(component)).toMatchSnapshots(Snapshots.component);
```
If you don't specify any component, but snapshot recorded more than one
an error is thrown. Same if you specify a component, but there is only
one recording.

Other changes in this PR include:
* Organise logic of matcher functions:
  * Move rawMatchers into separate file
  * Move snapshot matchers into separate file
* Clean up error log of snapshot mismatch and format as an array:
<img width="625" alt="Screenshot 2024-06-06 at 16 23 20"
src="https://github.com/software-mansion/react-native-reanimated/assets/56199675/c239e65c-d71a-44af-83cd-c3256da1d51f">

 
## Test plan
File `Animations.test.tsx` was renamed into
`TestsOfTestingFramework.test.tsx`, include some tests of snapshot
mismatch (and mismatch of callback functions)
Tested on Paper, on IOS and Android. Some of the fixes, created to make
tests work well on Android, were extracted into separate PR
software-mansion#6084
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant