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

Update to @testing-library/react-native and add @testing-library/jest-native #1184

Merged
merged 44 commits into from
Oct 12, 2021

Conversation

MuckT
Copy link
Collaborator

@MuckT MuckT commented Sep 26, 2021

Description

Migration from react-native-testing-library to @testing-library/react-native: Migration Guide V2 & Migration Guide V7. @testing-library/jest-native was also added to cover asserts on disabled elements to replace checks on props that failed with the update to @testing-library/react-native.

Other changes

Tested

  • Tests run Locally and in CI.

How others should test

  • Run the all tests locally with yarn test
  • Run a specific test locally with yarn test <target.test.tsx>

Related issues

Backwards compatibility

This change is not backwards compatible, but all existing tests have been updated to use @testing-library/react-native and @testing-library/jest-native.

@codecov
Copy link

codecov bot commented Sep 26, 2021

Codecov Report

Merging #1184 (2b11124) into main (88f613d) will increase coverage by 0.25%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1184      +/-   ##
==========================================
+ Coverage   74.77%   75.02%   +0.25%     
==========================================
  Files         525      526       +1     
  Lines       18404    18410       +6     
  Branches     3282     3282              
==========================================
+ Hits        13762    13813      +51     
+ Misses       4595     4536      -59     
- Partials       47       61      +14     
Impacted Files Coverage Δ
packages/mobile/src/components/Dialog.tsx 94.44% <ø> (ø)
packages/mobile/src/components/Modal.tsx 100.00% <100.00%> (ø)
packages/mobile/test/utils.ts 75.00% <100.00%> (+0.92%) ⬆️
packages/react-components/test/utils.ts 100.00% <100.00%> (ø)
packages/mobile/src/config.ts 94.20% <0.00%> (ø)
packages/mobile/src/utils/Logger.ts 58.33% <0.00%> (ø)
packages/mobile/src/verify/hooks.ts 42.85% <0.00%> (ø)
packages/mobile/src/pincode/authentication.ts 48.55% <0.00%> (ø)
packages/mobile/src/account/FiatExchange.tsx 70.00% <0.00%> (+1.66%) ⬆️
... and 14 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 88f613d...2b11124. Read the comment docs.

@MuckT MuckT marked this pull request as ready for review September 26, 2021 21:00
@MuckT MuckT requested a review from jeanregisser September 26, 2021 21:00
Copy link
Member

@jeanregisser jeanregisser left a comment

Choose a reason for hiding this comment

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

Amazing!! Thanks 🚀

Let's try to fix the skipped tests before merging.
Do you see what's needed to add them back?

Comment on lines +1 to +2
// @ts-ignore
import { toBeDisabled } from '@testing-library/jest-native'
Copy link
Member

Choose a reason for hiding this comment

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

Why is @ts-ignore needed here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If I remove the // @ts-ignore I receive the warning the following warning in the IDE; however the tests run without issue.
Module '"@testing-library/jest-native"' has no exported member 'toBeDisabled'.ts(2305)

@MuckT
Copy link
Collaborator Author

MuckT commented Sep 28, 2021

@jeanregisser @lisaqyli tests have been skipped in the following specs due to issues with the upgrade to @testing-library/react-native and should be fixed prior to merging.

  • Fix skipped tests in SupportContact.test.tsx
  • Fix skipped tests in WithdrawCeloQrScannerScreen.test.tsx
  • Fix skipped tests in SendConfirmation.test.tsx
  • Fix skipped tests in SettingsItem.test.tsx
  • Fix skipped tests in TotalLineItem.test.tsx
  • Fix skipped tests in DrawerNavigator.test.tsx

@jeanregisser
Copy link
Member

Great, do you want some help to get make the skipped test pass?

@MuckT
Copy link
Collaborator Author

MuckT commented Oct 5, 2021

@jeanregisser any of the tests remaining in the above comment I could use help fixing.

@MuckT MuckT linked an issue Oct 7, 2021 that may be closed by this pull request
Copy link
Member

@jeanregisser jeanregisser left a comment

Choose a reason for hiding this comment

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

🥳

@MuckT MuckT added the automerge Have PR merge automatically when checks pass label Oct 12, 2021
@mergify mergify bot merged commit 920aa5c into main Oct 12, 2021
@mergify mergify bot deleted the tomm/tlrn-tljn branch October 12, 2021 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Have PR merge automatically when checks pass Component: Tests
Projects
None yet
3 participants