test(mobile): add E2E tests for main navigation (Wallet 4.0 & legacy)#14749
test(mobile): add E2E tests for main navigation (Wallet 4.0 & legacy)#14749
Conversation
f2062b2 to
7379137
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds comprehensive E2E test coverage for the main navigation in both Wallet 4.0 and legacy modes. It introduces testIDs to navigation elements, creates a page object pattern, and implements a BlurView mock to work around a DetoxSync crash on iOS. The PR acknowledges a known blocker: W40 specs crash on iOS due to BlurView/DetoxSync incompatibility, but legacy specs should pass.
Changes:
- Added E2E test infrastructure with two spec files covering W40 bottom/top navigation (7 tests) and legacy tab navigation (5 tests)
- Added testID props to MainTabBar (W40), LegacyTabNavigator, and Earn screens for test element identification
- Implemented BlurView mock via rspack alias to prevent DetoxSync crashes during E2E builds
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| e2e/mobile/specs/mainNavigationWallet40.spec.ts | New E2E tests for Wallet 4.0 navigation (bottom tabs and top bar) |
| e2e/mobile/specs/mainNavigationLegacy.spec.ts | New E2E tests for legacy navigation (bottom tabs) |
| e2e/mobile/page/wallet/mainNavigation.page.ts | New page object with selectors and methods for both W40 and legacy navigation |
| e2e/mobile/page/index.ts | Registered new MainNavigationPage in Application class |
| apps/ledger-live-mobile/src/screens/PTX/Earn/index.tsx | Added testID "earn-screen" to root View for test visibility verification |
| apps/ledger-live-mobile/src/screens/PTX/Earn/EarnV2Webview/index.tsx | Added testID "earn-screen" to root View (V2 implementation) |
| apps/ledger-live-mobile/src/mvvm/components/MainTabBar/useMainTabBarViewModel.ts | Added TAB_TEST_IDS mapping for W40 tabs (w40-tab-home, swap, earn, card) |
| apps/ledger-live-mobile/src/mvvm/components/MainTabBar/types.ts | Extended TabItemConfig type to include testID property |
| apps/ledger-live-mobile/src/mvvm/components/MainTabBar/MainTabBarView.tsx | Added testID="w40-tab-bar" to container and passed testID to TabBarItem |
| apps/ledger-live-mobile/src/components/RootNavigator/MainNavigator/LegacyTabNavigator.tsx | Added tabBarButtonTestID to Portfolio and Discover tabs |
| apps/ledger-live-mobile/rspack.config.mjs | Added Detox build detection and BlurView mock alias configuration |
| apps/ledger-live-mobile/e2e/mocks/react-native-blur.js | New BlurView mock to prevent DetoxSync animation tracking crashes |
| .changeset/add-e2e-main-navigation-tests.md | Documented test infrastructure addition as minor version change |
7379137 to
9e00e2c
Compare
|
There was a problem hiding this comment.
The task asks us to test the deactivation, so I thought we might as well include a test to check for any deviant behaviour.
There was a problem hiding this comment.
Oups my bad I haven't updated the task but no need, it was in case we provided the user to have a toggle
| [NavigatorName.CardTab]: { icon: CreditCard, activeIcon: CreditCardFill }, | ||
| }; | ||
|
|
||
| const TAB_TEST_IDS: Partial<Record<string, string>> = { |
There was a problem hiding this comment.
I think you can use it for some test id declaration accross the PR
9e00e2c to
5de6c59
Compare
5de6c59 to
41f1192
Compare
|
|
||
| @Step("Wait for Wallet 4.0 navigation to be ready") | ||
| async waitForWallet40Ready() { | ||
| await waitForElementById(this.topBarSettingsId, 120000); |
There was a problem hiding this comment.
Why 120000 here? I would keep the default one
| try { | ||
| await waitForElementById(this.portfolioAccountsListId, 5000); | ||
| } catch { | ||
| await waitForElementById(this.portfolioEmptyListId, 5000); |
There was a problem hiding this comment.
Ideally tests should not have unpredictable elements, it should be controlled in the flow if it should show assets or not.
| wallet40HomeTab = () => element(by.id("w40-tab-home")); | ||
| wallet40SwapTab = () => element(by.id("w40-tab-swap")); | ||
| wallet40EarnTab = () => element(by.id("w40-tab-earn")); | ||
| wallet40CardTab = () => element(by.id("w40-tab-card")); |
There was a problem hiding this comment.
Maybe you could simplify doing something dynamic like:
wallet40Tab = (tabName: TabName) => { return element(by.id(w40-tab-${tabName})); };
apps/ledger-live-mobile/src/components/RootNavigator/MainNavigator/LegacyTabNavigator.tsx
Show resolved
Hide resolved
Add testID props to LegacyTabNavigator tabs (portfolio, discover) and Earn screen root views to enable element identification in Detox tests. LIVE-24697
Add MainNavigationPage with selectors for both Wallet 4.0 and legacy navigation elements. Add spec files for W40 and legacy navigation flows covering tab switching and destination page verification. Note: W40 specs are blocked by a DetoxSync/BlurView crash on iOS (NSNull __detox_sync_untrackAnimation) and require a fix before running. LIVE-24697 chore(mobile): add changeset for e2e main navigation tests LIVE-24697
…o screen identification
0a69eae to
5257905
Compare
5257905 to
07c9edd
Compare
|


✅ Checklist
npx changesetwas attached.NSNull __detox_sync_untrackAnimation). A follow-up fix is needed to patch DetoxSync or disable BlurView in test builds.- Main navigation tab bar elements (Wallet 4.0)
- Earn screen root view testability
- No runtime behavior change — only
testIDprops and E2E test files added📝 Description
Problem: The main navigation (TabBar) for Wallet 4.0 modes had no E2E test coverage. Navigation elements lacked
testIDprops, making them untestable with Detox.Solution:
testIDprops toLegacyTabNavigatortabs (tab-bar-portfolio,tab-bar-discover) and Earn screen root views (earn-screen)MainNavigationPagepage object with selectors for both W40 (bottom tabs, top bar) and legacy navigation elementsmainNavigationWallet40.spec.ts— 7 tests covering W40 bottom tab navigation (Swap, Earn, Card, Home) and top bar navigation (My Ledger, Settings)mainNavigationLegacy.spec.ts— 5 tests covering legacy tab navigation (Earn, Discover, My Ledger, Portfolio)Known blocker: W40 specs crash on iOS due to Lumen's
TabBarusingBlurView, which is incompatible with DetoxSync's animation tracking (-[NSNull __detox_sync_untrackAnimation]). A runtime Objective-C patch or DetoxSync fix is needed before W40 specs can run.❓ Context
🧐 Checklist for the PR Reviewers