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

chore: Migrate second batch of. unit tests away from enzyme #8923

Merged
merged 9 commits into from
Mar 14, 2024

Conversation

kylanhurt
Copy link
Contributor

@kylanhurt kylanhurt commented Mar 13, 2024

Description

The mobile platform team is pushing to reduce the usage of enzyme within the application. This PR puts us one step closer to accomplishing this goal. This batch includes the following files:

'app/components/UI/ActionView/index.test.tsx',
'app/components/UI/ActionModal/index.test.tsx',
'app/components/Views/confirmations/components/CustomNonce/index.test.tsx',
'app/components/Views/confirmations/SendFlow/ErrorMessage/index.test.tsx',
'app/components/Views/Settings/Contacts/AmbiguousAddressSheet/AmbiguousAddressSheet.test.tsx',
'app/components/Views/confirmations/components/Approval/ApprovalFlowLoader/index.test.tsx',
'app/components/UI/ImageIcon/index.test.tsx',,
'app/components/UI/FadeOutOverlay/index.test.tsx',
'app/components/UI/AssetIcon/index.test.tsx',
'app/components/UI/TimeEstimateInfoModal/index.test.tsx',
'app/components/UI/Tabs/index.test.tsx',
'app/components/UI/ModalNavbarTitle/index.test.tsx',
'app/components/Views/WalletConnectSessions/index.test.tsx',
'app/component-library/components/Tags/Tag/Tag.test.tsx',
'app/components/UI/SwitchCustomNetwork/index.test.tsx',
'app/component-library/components/Avatars/Avatar/variants/AvatarAccount/AvatarAccount.test.tsx',
'app/components/Views/ImportPrivateKey/index.test.tsx',

Related issues

Fixes: #8806

Manual testing steps

yarn test:unit

Screenshots/Recordings

image

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've clearly explained what problem this PR is solving and how it is solved.
  • I've linked related issues
  • I've included manual testing steps
  • I've included screenshots/recordings if applicable
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
  • [X I’ve properly set the pull request status:
    • In case it's not yet "ready for review", I've set it to "draft".
    • In case it's "ready for review", I've changed it from "draft" to "non-draft".

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

OGPoyraz and others added 3 commits March 13, 2024 19:07
## **Description**

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

This PR aims to add `hideSubmitButton` property to confirmation
templates. Also hiding action buttons will be possible if `onSubmit` and
`onCancel` is not provided.

## **Related issues**

Fixes:
https://github.com/orgs/MetaMask/projects/47/views/1?pane=issue&itemId=55391209

Similar task is resolved in extension
MetaMask/metamask-extension#23085

## **Manual testing steps**

To manually test this, either you should add `hideSubmitButton` to true
in to your approval request (via code)
Or temporarily set `hideSubmitButton` to true in your local at
`app/components/Views/confirmations/components/Approval/TemplateConfirmation/Templates/index.ts`
`values` constant. (See the recorded video by doing this)

## **Screenshots/Recordings**

### **After**



https://github.com/MetaMask/metamask-mobile/assets/7644512/ddad90e6-1e15-40a0-9e1c-887bbdc10ebc



## **Pre-merge author checklist**

- [x] I’ve followed [MetaMask Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've clearly explained what problem this PR is solving and how it
is solved.
- [x] I've linked related issues
- [x] I've included manual testing steps
- [x] I've included screenshots/recordings if applicable
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
- [ ] I’ve properly set the pull request status:
  - [ ] In case it's not yet "ready for review", I've set it to "draft".
- [ ] In case it's "ready for review", I've changed it from "draft" to
"non-draft".

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
@kylanhurt kylanhurt added Spot Check on the Release Build If a ticket doesn't require feature QA, but does require some form of manual spot checking team-mobile-platform Run Smoke E2E Triggers smoke e2e on Bitrise labels Mar 13, 2024
@kylanhurt kylanhurt requested a review from Cal-L March 13, 2024 22:32
Copy link
Contributor

github-actions bot commented Mar 13, 2024

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: fdab671
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/a359f883-51e1-41c2-a983-f4ab5bef1129

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@kylanhurt kylanhurt marked this pull request as ready for review March 14, 2024 15:15
@kylanhurt kylanhurt requested review from a team as code owners March 14, 2024 15:15
@codecov-commenter
Copy link

codecov-commenter commented Mar 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 43.50%. Comparing base (2c0d6ce) to head (77bb592).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8923      +/-   ##
==========================================
+ Coverage   43.26%   43.50%   +0.23%     
==========================================
  Files        1271     1271              
  Lines       30921    30921              
  Branches     3092     3092              
==========================================
+ Hits        13379    13452      +73     
+ Misses      16769    16688      -81     
- Partials      773      781       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kylanhurt kylanhurt added the needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) label Mar 14, 2024
Copy link
Contributor

@Cal-L Cal-L left a comment

Choose a reason for hiding this comment

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

left a comment

Copy link

sonarcloud bot commented Mar 14, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@kylanhurt kylanhurt merged commit 2c29c7f into main Mar 14, 2024
25 of 30 checks passed
@kylanhurt kylanhurt deleted the kylan/unit-tests-batch-2 branch March 14, 2024 19:53
@github-actions github-actions bot removed the needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) label Mar 14, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Mar 14, 2024
@metamaskbot metamaskbot added the release-7.19.0 Issue or pull request that will be included in release 7.19.0 label Mar 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-7.19.0 Issue or pull request that will be included in release 7.19.0 Run Smoke E2E Triggers smoke e2e on Bitrise Spot Check on the Release Build If a ticket doesn't require feature QA, but does require some form of manual spot checking team-mobile-platform
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Reduce enzyme usage in unit test down to 50% - [2 of 3]
7 participants