Skip to content

test: add back Trending CV test#27129

Merged
Prithpal-Sooriya merged 7 commits into
mainfrom
ASSETS-2733-component-view-tests-decouple-explore-search-screen-from-perps-connection-provider
Mar 10, 2026
Merged

test: add back Trending CV test#27129
Prithpal-Sooriya merged 7 commits into
mainfrom
ASSETS-2733-component-view-tests-decouple-explore-search-screen-from-perps-connection-provider

Conversation

@Prithpal-Sooriya
Copy link
Copy Markdown
Contributor

@Prithpal-Sooriya Prithpal-Sooriya commented Mar 6, 2026

Description

  • Introduced a new helper function assertTrendingTokenRowsVisibility to streamline visibility checks for trending tokens in the TrendingView tests.
  • Updated existing tests to utilize this helper, improving readability and maintainability.
  • Ensured that the tests now assert the presence and content of trending tokens more effectively, enhancing overall test coverage.

Changelog

CHANGELOG entry: test: add back Trending CV test

Related issues

Fixes: #26269 https://consensyssoftware.atlassian.net/browse/ASSETS-2733

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

After

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.

Note

Low Risk
Test-only changes that mainly refactor assertions and input simulation; the only broader impact is an added Perps controller mock method that could subtly affect other component-view tests.

Overview
TrendingView component tests were refactored and stabilized. Adds assertTrendingTokenRowsVisibility and shared test IDs to reduce duplicated row assertions, and introduces actButtonPress to prefer userEvent.press with a fireEvent.press fallback for platform/device reliability.

Re-enables the previously skipped Explore search test and updates trending/full-view tests to use the new helpers, including network-filter and search visibility checks. Updates the shared component-view Engine mock to include PerpsController.isCurrentlyReinitializing returning false to unblock rendering in these tests.

Written by Cursor Bugbot for commit 19be038. This will update automatically on new commits. Configure here.

…ing tokens

- Introduced a new helper function `assertTrendingTokenRowsVisibility` to streamline visibility checks for trending tokens in the TrendingView tests.
- Updated existing tests to utilize this helper, improving readability and maintainability.
- Ensured that the tests now assert the presence and content of trending tokens more effectively, enhancing overall test coverage.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 6, 2026

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.

// results list never mounts.
// https://github.com/MetaMask/metamask-mobile/issues/26269
// eslint-disable-next-line jest/no-disabled-tests
it.skip('user can search for a trending token from the explore feed', async () => {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

added back this test 🎉

};
});

const assertTrendingTokenRowsVisibility = async (opts: {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Some local test utils for asserting trending token row items.

Comment thread app/components/Views/TrendingView/TrendingView.view.test.tsx Outdated
Comment thread app/components/Views/TrendingView/TrendingView.view.test.tsx
- Updated the `assertTrendingTokenRowsVisibility` function to use a single query for each token, enhancing clarity in visibility checks.
- Simplified the test structure by removing redundant calls to `queryByTestId`, making the assertions more concise and maintainable.
- Adjusted the test for the search results list to streamline the visibility assertions for trending tokens, ensuring consistent behavior across tests.
sahar-fehri
sahar-fehri previously approved these changes Mar 6, 2026
- Introduced `actButtonPress` helper function to standardize button press actions in tests, improving event simulation consistency across device platforms.
- Updated existing tests to utilize the new helper, enhancing readability and maintainability.
- Ensured that all button interactions in the TrendingView tests now leverage the improved event handling for better test reliability.
…S-2733-component-view-tests-decouple-explore-search-screen-from-perps-connection-provider
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Comment thread app/components/Views/TrendingView/TrendingView.view.test.tsx
Comment thread tests/component-view/mocks.ts Outdated
- Changed the mock implementation of `isCurrentlyReinitializing` in the component view tests from `mockResolvedValue(false)` to `mockReturnValue(false)` for improved consistency in test behavior.
- This change ensures that the mock returns a static value rather than a promise, aligning with the expected usage in the tests.
* but fallback if fails on device platforms
* @param elem - element to press
*/
const actButtonPress = async (elem: ReactTestInstance) => {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Another local test util.

We should strive to use userEvents instead of fireEvents since they offer better user interaction simulations.

But offer fallbacks to fireEvent if things go wrong (ios/android test specific failures)

…S-2733-component-view-tests-decouple-explore-search-screen-from-perps-connection-provider
constants for cv test ids used across test suite
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 9, 2026

🔍 Smart E2E Test Selection

  • Selected E2E tags: None (no tests recommended)
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 91%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes are limited to test files: a shared test mock file (tests/component-view/mocks.ts) and a unit test for TrendingView (TrendingView.view.test.tsx). There are no modifications to production application code, controllers, Engine, navigation, or UI components used in E2E flows. Since only Jest/component test files were updated, there is no impact on runtime behavior or user-facing flows covered by Detox E2E tests. Therefore, no E2E tags need to be executed.

Performance Test Selection:
No production code affecting rendering, state management, controllers, or critical flows was modified. Changes are isolated to test files, so there is no potential impact on runtime performance.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Mar 9, 2026

@Prithpal-Sooriya Prithpal-Sooriya added this pull request to the merge queue Mar 10, 2026
Merged via the queue into main with commit 9be521c Mar 10, 2026
61 checks passed
@Prithpal-Sooriya Prithpal-Sooriya deleted the ASSETS-2733-component-view-tests-decouple-explore-search-screen-from-perps-connection-provider branch March 10, 2026 09:36
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 10, 2026
@metamaskbot metamaskbot added the release-7.70.0 Issue or pull request that will be included in release 7.70.0 label Mar 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.70.0 Issue or pull request that will be included in release 7.70.0 size-M team-assets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Component View Tests] Decouple ExploreSearchScreen from PerpsConnectionProvider

3 participants