@@ -6,13 +6,26 @@ import {
66 restoreWallet ,
77 tap ,
88 sleep ,
9+ expectTextWithin ,
10+ doNavigationClose ,
911} from '../../helpers/actions' ;
1012import { ciIt } from '../../helpers/suite' ;
1113
12- const PAYMENT_TIMEOUT_MS = 300_000 ;
14+ const PAYMENT_TIMEOUT_MS = 90_000 ;
1315const WALLET_SYNC_TIMEOUT_MS = 90_000 ;
14- const SCREEN_TRANSITION_TIMEOUT_MS = 60_000 ;
15- const LN_STABILIZE_DELAY_MS = 10_000 ;
16+ const APP_STATUS_ROW_TIMEOUT_MS = 90_000 ;
17+ const SCREEN_TRANSITION_TIMEOUT_MS = 30_000 ;
18+
19+ function resolveLnStabilizeDelayMs ( ) : number {
20+ const fromEnv = process . env . LN_STABILIZE_DELAY_MS ;
21+ if ( fromEnv ) {
22+ const parsed = Number . parseInt ( fromEnv , 10 ) ;
23+ if ( Number . isFinite ( parsed ) && parsed >= 0 ) {
24+ return parsed ;
25+ }
26+ }
27+ return process . env . CI ? 45_000 : 10_000 ;
28+ }
1629
1730const ERROR_TOASTS = [ 'PaymentFailedToast' , 'ExpiredLightningToast' , 'InsufficientSpendingToast' ] ;
1831
@@ -62,8 +75,20 @@ function resolveMainnetLnReceiver(config: MainnetLnSuiteConfig): MainnetLnReceiv
6275async function waitForWalletReady ( ) : Promise < void > {
6376 console . info ( '→ [LN] Waiting for wallet home screen...' ) ;
6477 await elementById ( 'TotalBalance-primary' ) . waitForDisplayed ( { timeout : WALLET_SYNC_TIMEOUT_MS } ) ;
65- console . info ( '→ [LN] Home screen ready, letting LN node stabilize...' ) ;
66- await sleep ( LN_STABILIZE_DELAY_MS ) ;
78+ const stabilizeMs = resolveLnStabilizeDelayMs ( ) ;
79+ console . info ( `→ [LN] Home screen ready, letting LN node stabilize (${ stabilizeMs / 1000 } s)...` ) ;
80+ await sleep ( stabilizeMs ) ;
81+ console . info ( '→ [LN] Verify app status is ready' ) ;
82+ await tap ( 'HeaderMenu' ) ;
83+ await tap ( 'DrawerAppStatus' ) ;
84+
85+ await expectTextWithin ( 'Status-internet' , 'Connected' , { timeout : APP_STATUS_ROW_TIMEOUT_MS } ) ;
86+ await expectTextWithin ( 'Status-electrum' , 'Connected' , { timeout : APP_STATUS_ROW_TIMEOUT_MS } ) ;
87+ await expectTextWithin ( 'Status-lightning_node' , 'Running' , { timeout : APP_STATUS_ROW_TIMEOUT_MS } ) ;
88+ await expectTextWithin ( 'Status-lightning_connection' , 'Open' , { timeout : APP_STATUS_ROW_TIMEOUT_MS } ) ;
89+
90+ await doNavigationClose ( ) ;
91+ console . info ( '→ [LN] App status verified' ) ;
6792}
6893
6994async function waitForAmountScreen ( ) : Promise < void > {
0 commit comments