Skip to content

refactor: snaps UI tests #14705

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

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open

refactor: snaps UI tests #14705

wants to merge 24 commits into from

Conversation

hmalik88
Copy link
Contributor

@hmalik88 hmalik88 commented Apr 16, 2025

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? Currently, the snaps UI components tests are following varying patterns: tests in the component's folders (e.g. SnapUIInput), tests using renderInterface in SnapUIRenderer.test.tsx and then individual tests within the components subfolder that test the respective template mapper.
  2. What is the improvement/solution? Make renderInterface re-usable and follow the testing pattern being used in the extension with tests using renderInterface e.g. input.test.ts. Using renderInterface we essentially test the component from mapping to rendering. This PR moves existing tests in "SnapUI" prefixed folders that do not have a corresponding test in the components subfolder. It also moves out some tests from SnapUIRenderer.test.tsx into their own files, similar to how we did in the extension.

Note: A subsequent PR will be opened to convert existing tests within the components subfolder to the renderInterface format and migrate any remaining "SnapUI" prefixed tests.

Related issues

Fixes: #14531

Pre-merge author checklist

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.

@metamaskbot metamaskbot added team-snaps-platform Snaps Platform team INVALID-PR-TEMPLATE PR's body doesn't match template labels Apr 16, 2025
@hmalik88 hmalik88 added No QA Needed Apply this label when your PR does not need any QA effort. No E2E Smoke Needed If the PR does not need E2E smoke test run no-changelog Indicates no external facing user changes, therefore no changelog documentation needed and removed INVALID-PR-TEMPLATE PR's body doesn't match template labels Apr 16, 2025
@hmalik88 hmalik88 marked this pull request as ready for review April 16, 2025 18:51
@hmalik88 hmalik88 requested a review from a team as a code owner April 16, 2025 18:51
Daniel-Cross
Daniel-Cross previously approved these changes Apr 25, 2025
Copy link
Contributor

@Daniel-Cross Daniel-Cross left a comment

Choose a reason for hiding this comment

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

Looks good to me!

Daniel-Cross
Daniel-Cross previously approved these changes Apr 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
No E2E Smoke Needed If the PR does not need E2E smoke test run No QA Needed Apply this label when your PR does not need any QA effort. no-changelog Indicates no external facing user changes, therefore no changelog documentation needed team-snaps-platform Snaps Platform team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor Snaps UI component tests
3 participants