@@ -2,12 +2,11 @@ import { element, by } from "detox";
22import { Step } from "jest-allure2-reporter/api" ;
33import { openDeeplink } from "../../helpers/commonHelpers" ;
44
5+ type Wallet40TabName = "home" | "swap" | "earn" | "card" ;
6+
57export default class MainNavigationPage {
68 // --- Wallet 4.0 bottom tabs ---
7- wallet40HomeTab = ( ) => element ( by . id ( "w40-tab-home" ) ) ;
8- wallet40SwapTab = ( ) => element ( by . id ( "w40-tab-swap" ) ) ;
9- wallet40EarnTab = ( ) => element ( by . id ( "w40-tab-earn" ) ) ;
10- wallet40CardTab = ( ) => element ( by . id ( "w40-tab-card" ) ) ;
9+ wallet40Tab = ( tabName : Wallet40TabName ) => element ( by . id ( `w40-tab-${ tabName } ` ) ) ;
1110
1211 // --- Wallet 4.0 top bar buttons ---
1312 topBarMyLedgerId = "topbar-myledger" ;
@@ -23,8 +22,7 @@ export default class MainNavigationPage {
2322 legacyMyLedgerTabId = "TabBarManager" ;
2423
2524 // --- Destination page verification IDs ---
26- portfolioAccountsListId = "PortfolioAccountsList" ;
27- portfolioEmptyListId = "PortfolioEmptyList" ;
25+ portfolioScreenId = "portfolio-screen" ;
2826 swapFormId = "swap-form-tab" ;
2927 earnScreenId = "earn-screen" ;
3028 cardScreenId = "card-landing-screen" ;
@@ -39,36 +37,21 @@ export default class MainNavigationPage {
3937
4038 @Step ( "Wait for Wallet 4.0 navigation to be ready" )
4139 async waitForWallet40Ready ( ) {
42- await waitForElementById ( this . topBarSettingsId , 120000 ) ;
40+ await waitForElementById ( this . topBarSettingsId ) ;
4341 }
4442
4543 @Step ( "Wait for Legacy navigation to be ready" )
4644 async waitForLegacyReady ( ) {
47- await waitForElementById ( this . legacyMyLedgerTabId , 120000 ) ;
45+ await waitForElementById ( this . legacyMyLedgerTabId ) ;
4846 }
4947
5048 // =====================
5149 // Wallet 4.0 Tab Actions
5250 // =====================
5351
54- @Step ( "Tap Home tab (Wallet 4.0)" )
55- async tapWallet40HomeTab ( ) {
56- await this . wallet40HomeTab ( ) . tap ( ) ;
57- }
58-
59- @Step ( "Tap Swap tab (Wallet 4.0)" )
60- async tapWallet40SwapTab ( ) {
61- await this . wallet40SwapTab ( ) . tap ( ) ;
62- }
63-
64- @Step ( "Tap Earn tab (Wallet 4.0)" )
65- async tapWallet40EarnTab ( ) {
66- await this . wallet40EarnTab ( ) . tap ( ) ;
67- }
68-
69- @Step ( "Tap Card tab (Wallet 4.0)" )
70- async tapWallet40CardTab ( ) {
71- await this . wallet40CardTab ( ) . tap ( ) ;
52+ @Step ( "Tap W40 tab" )
53+ async tapWallet40Tab ( tabName : Wallet40TabName ) {
54+ await this . wallet40Tab ( tabName ) . tap ( ) ;
7255 }
7356
7457 // =====================
@@ -125,10 +108,10 @@ export default class MainNavigationPage {
125108
126109 @Step ( "Expect Wallet 4.0 bottom tabs to be visible" )
127110 async expectWallet40BottomTabsVisible ( ) {
128- await detoxExpect ( this . wallet40HomeTab ( ) ) . toBeVisible ( ) ;
129- await detoxExpect ( this . wallet40SwapTab ( ) ) . toBeVisible ( ) ;
130- await detoxExpect ( this . wallet40EarnTab ( ) ) . toBeVisible ( ) ;
131- await detoxExpect ( this . wallet40CardTab ( ) ) . toBeVisible ( ) ;
111+ await detoxExpect ( this . wallet40Tab ( "home" ) ) . toBeVisible ( ) ;
112+ await detoxExpect ( this . wallet40Tab ( "swap" ) ) . toBeVisible ( ) ;
113+ await detoxExpect ( this . wallet40Tab ( "earn" ) ) . toBeVisible ( ) ;
114+ await detoxExpect ( this . wallet40Tab ( "card" ) ) . toBeVisible ( ) ;
132115 }
133116
134117 @Step ( "Expect Wallet 4.0 top bar to be visible" )
@@ -175,11 +158,7 @@ export default class MainNavigationPage {
175158
176159 @Step ( "Expect Portfolio page visible" )
177160 async expectPortfolioPageVisible ( ) {
178- try {
179- await waitForElementById ( this . portfolioAccountsListId , 5000 ) ;
180- } catch {
181- await waitForElementById ( this . portfolioEmptyListId , 5000 ) ;
182- }
161+ await waitForElementById ( this . portfolioScreenId ) ;
183162 }
184163
185164 @Step ( "Expect Swap page visible" )
0 commit comments