1+ import jestExpect from 'expect' ;
12import createLnRpc from '@radar/lnrpc' ;
23import BitcoinJsonRpc from 'bitcoin-json-rpc' ;
3- import jestExpect from 'expect' ;
44
55import initWaitForElectrumToSync from '../__tests__/utils/wait-for-electrum' ;
66import {
@@ -10,7 +10,6 @@ import {
1010 completeOnboarding ,
1111 electrumHost ,
1212 electrumPort ,
13- isButtonEnabled ,
1413 launchAndWait ,
1514 markComplete ,
1615 sleep ,
@@ -85,22 +84,42 @@ d('Transfer', () => {
8584 . withTimeout ( 20000 ) ;
8685 await element ( by . id ( 'NewTxPrompt' ) ) . swipe ( 'down' ) ; // close Receive screen
8786
87+ // switch to USD
88+ await element ( by . id ( 'Settings' ) ) . tap ( ) ;
89+ await element ( by . id ( 'GeneralSettings' ) ) . tap ( ) ;
90+ await element ( by . id ( 'CurrenciesSettings' ) ) . tap ( ) ;
91+ await element ( by . text ( 'EUR (€)' ) ) . tap ( ) ;
92+ await element ( by . id ( 'NavigationClose' ) ) . tap ( ) ;
93+
8894 await element ( by . id ( 'Suggestion-lightning' ) ) . tap ( ) ;
8995 await element ( by . id ( 'TransferIntro-button' ) ) . tap ( ) ;
9096 await element ( by . id ( 'FundTransfer' ) ) . tap ( ) ;
9197 await element ( by . id ( 'SpendingIntro-button' ) ) . tap ( ) ;
9298
93- // default amount is 0
94- const button = element ( by . id ( 'SpendingAmountContinue' ) ) ;
95- const buttonEnabled = await isButtonEnabled ( button ) ;
96- jestExpect ( buttonEnabled ) . toBe ( false ) ;
99+ // can continue with default client balance (0)
100+ await element ( by . id ( 'SpendingAmountContinue' ) ) . tap ( ) ;
101+ await sleep ( 100 ) ;
102+ await element ( by . id ( 'SpendingConfirmAdvanced' ) ) . tap ( ) ;
103+ await element ( by . id ( 'SpendingAdvancedMin' ) ) . tap ( ) ;
104+ await expect ( element ( by . text ( '100 000' ) ) ) . toBeVisible ( ) ;
105+ await element ( by . id ( 'SpendingAdvancedDefault' ) ) . tap ( ) ;
106+ await element ( by . id ( 'SpendingAdvancedNumberField' ) ) . tap ( ) ;
107+ let { label } = await element (
108+ by . id ( 'SpendingAdvancedNumberField' ) ,
109+ ) . getAttributes ( ) ;
110+ const lspBalance = Number . parseInt ( label ) ;
111+ jestExpect ( lspBalance ) . toBeGreaterThan ( 440 ) ;
112+ jestExpect ( lspBalance ) . toBeLessThan ( 460 ) ;
113+ await element ( by . id ( 'SpendingAdvancedNumberField' ) ) . tap ( ) ;
114+ await element ( by . id ( 'SpendingAdvancedContinue' ) ) . tap ( ) ;
115+ await element ( by . id ( 'NavigationBack' ) ) . tap ( ) ;
97116
98- // can continue with max amount
117+ // can continue with max client balance
99118 await element ( by . id ( 'SpendingAmountMax' ) ) . tap ( ) ;
100119 await element ( by . id ( 'SpendingAmountContinue' ) ) . tap ( ) ;
101120 await element ( by . id ( 'NavigationBack' ) ) . tap ( ) ;
102121
103- // can continue with 25% amount
122+ // can continue with 25% client balance
104123 await element ( by . id ( 'SpendingAmountQuarter' ) ) . tap ( ) ;
105124 await expect ( element ( by . text ( '250 000' ) ) ) . toBeVisible ( ) ;
106125 await element ( by . id ( 'SpendingAmountContinue' ) ) . tap ( ) ;
@@ -109,7 +128,7 @@ d('Transfer', () => {
109128 await element ( by . id ( 'NavigationBack' ) ) . tap ( ) ;
110129 await element ( by . id ( 'SpendingIntro-button' ) ) . tap ( ) ;
111130
112- // can change amount
131+ // can change client balance
113132 await element ( by . id ( 'N2' ) . withAncestor ( by . id ( 'SpendingAmount' ) ) ) . tap ( ) ;
114133 await element ( by . id ( 'N0' ) . withAncestor ( by . id ( 'SpendingAmount' ) ) ) . multiTap (
115134 5 ,
@@ -141,7 +160,7 @@ d('Transfer', () => {
141160 // Receiving Capacity
142161 // can continue with min amount
143162 await element ( by . id ( 'SpendingAdvancedMin' ) ) . tap ( ) ;
144- await expect ( element ( by . text ( '105 000' ) ) ) . toBeVisible ( ) ;
163+ await expect ( element ( by . text ( '2 000' ) ) ) . toBeVisible ( ) ;
145164 await element ( by . id ( 'SpendingAdvancedContinue' ) ) . tap ( ) ;
146165 await element ( by . id ( 'SpendingConfirmDefault' ) ) . tap ( ) ;
147166 await element ( by . id ( 'SpendingConfirmAdvanced' ) ) . tap ( ) ;
0 commit comments