Skip to content
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

Support snapshots of many views #6047

Merged
merged 35 commits into from
Jun 17, 2024
Merged

Support snapshots of many views #6047

merged 35 commits into from
Jun 17, 2024

Conversation

Latropos
Copy link
Contributor

@Latropos Latropos commented May 27, 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:
Screenshot 2024-06-06 at 16 23 20

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 mentioned this pull request Jun 6, 2024
@Latropos Latropos requested a review from piaskowyk June 6, 2024 14:24
@Latropos Latropos marked this pull request as ready for review June 6, 2024 14:24
@Latropos Latropos changed the base branch from main to acynk/fix-runtime-tests-for-monorepo June 13, 2024 11:42
Base automatically changed from acynk/fix-runtime-tests-for-monorepo to main June 14, 2024 10:46
@Latropos Latropos requested a review from piaskowyk June 17, 2024 14:10
@Latropos Latropos added this pull request to the merge queue Jun 17, 2024
Merged via the queue into main with commit c41eee5 Jun 17, 2024
8 checks passed
@Latropos Latropos deleted the acynk/test-sequence branch June 17, 2024 14:56
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.

2 participants