Skip to content

test(mobile): add E2E tests for main navigation (Wallet 4.0 & legacy)#14749

Open
deepyjr wants to merge 4 commits intodevelopfrom
feat/e2e-nav-bar
Open

test(mobile): add E2E tests for main navigation (Wallet 4.0 & legacy)#14749
deepyjr wants to merge 4 commits intodevelopfrom
feat/e2e-nav-bar

Conversation

@deepyjr
Copy link
Contributor

@deepyjr deepyjr commented Feb 24, 2026

✅ Checklist

  • npx changeset was attached.
  • Covered by automatic tests. E2E tests are included but W40 specs are currently blocked by a DetoxSync/BlurView native crash on iOS (NSNull __detox_sync_untrackAnimation). A follow-up fix is needed to patch DetoxSync or disable BlurView in test builds.
  • Impact of the changes:
    - Main navigation tab bar elements (Wallet 4.0)
    - Earn screen root view testability
    - No runtime behavior change — only testID props and E2E test files added

📝 Description

Problem: The main navigation (TabBar) for Wallet 4.0 modes had no E2E test coverage. Navigation elements lacked testID props, making them untestable with Detox.

Solution:

  • Added testID props to LegacyTabNavigator tabs (tab-bar-portfolio, tab-bar-discover) and Earn screen root views (earn-screen)
  • Created MainNavigationPage page object with selectors for both W40 (bottom tabs, top bar) and legacy navigation elements
  • Added two spec files:
    • mainNavigationWallet40.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)
  • Each test verifies both navigation to the correct destination page and visibility of navigation elements

Known blocker: W40 specs crash on iOS due to Lumen's TabBar using BlurView, 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

  • The code aligns with the requirements described in the linked JIRA or GitHub issue.
  • The PR description clearly documents the changes made and explains any technical trade-offs or design decisions.
  • There are no undocumented trade-offs, technical debt, or maintainability issues.
  • The PR has been tested thoroughly, and any potential edge cases have been considered and handled.
  • Any new dependencies have been justified and documented.
  • Performance considerations have been taken into account. (changes have been profiled or benchmarked if necessary)

@live-github-bot live-github-bot bot added the mobile Has changes in LLM label Feb 24, 2026
@deepyjr deepyjr force-pushed the feat/e2e-nav-bar branch 7 times, most recently from f2062b2 to 7379137 Compare February 27, 2026 08:04
@deepyjr deepyjr marked this pull request as ready for review February 27, 2026 08:04
@deepyjr deepyjr requested a review from a team as a code owner February 27, 2026 08:04
Copilot AI review requested due to automatic review settings February 27, 2026 08:04
@deepyjr deepyjr requested review from a team as code owners February 27, 2026 08:04
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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

@deepyjr deepyjr requested a review from a team as a code owner February 27, 2026 08:45
gre-ledger
gre-ledger previously approved these changes Feb 27, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 27, 2026

⚠️ E2E tests are required

Changes detected require e2e testing before merge (even before asking for any review).

📱 Mobile

-> Run Mobile E2E

  • Select "Run workflow"
  • Branch: feat/e2e-nav-bar
  • Device: nanoX

Copy link
Member

Choose a reason for hiding this comment

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

Do we need to test it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The task asks us to test the deactivation, so I thought we might as well include a test to check for any deviant behaviour.

Copy link
Member

Choose a reason for hiding this comment

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

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>> = {
Copy link
Member

Choose a reason for hiding this comment

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

I think you can use it for some test id declaration accross the PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok i will update

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.


@Step("Wait for Wallet 4.0 navigation to be ready")
async waitForWallet40Ready() {
await waitForElementById(this.topBarSettingsId, 120000);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why 120000 here? I would keep the default one

try {
await waitForElementById(this.portfolioAccountsListId, 5000);
} catch {
await waitForElementById(this.portfolioEmptyListId, 5000);
Copy link
Contributor

Choose a reason for hiding this comment

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

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"));
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe you could simplify doing something dynamic like:
wallet40Tab = (tabName: TabName) => { return element(by.id(w40-tab-${tabName})); };

Copilot AI review requested due to automatic review settings February 27, 2026 14:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.

deepyjr added 3 commits March 2, 2026 11:14
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
@deepyjr deepyjr force-pushed the feat/e2e-nav-bar branch from 0a69eae to 5257905 Compare March 2, 2026 11:24
Copilot AI review requested due to automatic review settings March 2, 2026 14:36
@deepyjr deepyjr force-pushed the feat/e2e-nav-bar branch from 5257905 to 07c9edd Compare March 2, 2026 14:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 2, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
33.3% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mobile Has changes in LLM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants