test: add back Trending CV test#27129
Conversation
…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.
|
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 () => { |
There was a problem hiding this comment.
added back this test 🎉
| }; | ||
| }); | ||
|
|
||
| const assertTrendingTokenRowsVisibility = async (opts: { |
There was a problem hiding this comment.
Some local test utils for asserting trending token row items.
- 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.
- 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
There was a problem hiding this comment.
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.
- 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) => { |
There was a problem hiding this comment.
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
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: Performance Test Selection: |
|



Description
assertTrendingTokenRowsVisibilityto streamline visibility checks for trending tokens in the TrendingView tests.Changelog
CHANGELOG entry: test: add back Trending CV test
Related issues
Fixes: #26269 https://consensyssoftware.atlassian.net/browse/ASSETS-2733
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
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
assertTrendingTokenRowsVisibilityand shared test IDs to reduce duplicated row assertions, and introducesactButtonPressto preferuserEvent.presswith afireEvent.pressfallback 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.isCurrentlyReinitializingreturningfalseto unblock rendering in these tests.Written by Cursor Bugbot for commit 19be038. This will update automatically on new commits. Configure here.