@@ -20,6 +20,10 @@ import {
2020 dismissQuickPayIntro ,
2121 doNavigationClose ,
2222 waitForToast ,
23+ getTextUnder ,
24+ acknowledgeExternalSuccess ,
25+ dismissBackgroundPaymentsTimedSheet ,
26+ expectNoTextWithin ,
2327} from '../helpers/actions' ;
2428import {
2529 checkChannelStatus ,
@@ -83,40 +87,36 @@ describe('@transfer - Transfer', () => {
8387 await elementByText ( 'EUR (€)' ) . click ( ) ;
8488 await doNavigationClose ( ) ;
8589
86- await launchFreshApp ( ) ;
90+ if ( driver . isAndroid ) await launchFreshApp ( ) ;
8791 await tap ( 'Suggestion-lightning' ) ;
8892 await tap ( 'TransferIntro-button' ) ;
8993 await tap ( 'FundTransfer' ) ;
9094 await tap ( 'SpendingIntro-button' ) ;
9195 await sleep ( 3000 ) ; // let the animation finish
9296
93- //--- skip due to: https://github.com/synonymdev/bitkit-android/issues/425 ---//
94- //// can continue with default client balance (0)
95- //await tap('SpendingAmountContinue');
96- //await sleep(100);
97- //await tap('SpendingConfirmAdvanced');
98- //await tap('SpendingAdvancedMin');
99- //await expectTextVisible('100 000');
100- //await tap('SpendingAdvancedDefault');
101- //await tap('SpendingAdvancedNumberField'); // change to fiat
102- //const label = await getTextUnder('SpendingAdvancedNumberField');
103- //const eurBalance = Number.parseInt(label, 10);
104- //await expect(eurBalance).toBeGreaterThan(440);
105- //await expect(eurBalance).toBeLessThan(460);
106- //await tap('SpendingAdvancedNumberField'); // change back to sats
107- //await tap('SpendingAdvancedContinue');
108- //await tap('NavigationBack');
109- //--- skip due to: https://github.com/synonymdev/bitkit-android/issues/425 ---//
110-
111- //--- skip due to: https://github.com/synonymdev/bitkit-android/issues/424 ---//
97+ // can continue with default client balance (0)
98+ await tap ( 'SpendingAmountContinue' ) ;
99+ await sleep ( 100 ) ;
100+ await tap ( 'SpendingConfirmAdvanced' ) ;
101+ await tap ( 'SpendingAdvancedMin' ) ;
102+ await expectText ( '100 000' , { strategy : 'contains' } ) ;
103+ await tap ( 'SpendingAdvancedDefault' ) ;
104+ await tap ( 'SpendingAdvancedNumberField' ) ; // change to fiat
105+ const label = await getTextUnder ( 'SpendingAdvancedNumberField' ) ;
106+ const eurBalance = Number . parseInt ( label , 10 ) ;
107+ await expect ( eurBalance ) . toBeGreaterThan ( 440 ) ;
108+ await expect ( eurBalance ) . toBeLessThan ( 460 ) ;
109+ await tap ( 'SpendingAdvancedNumberField' ) ; // change back to sats
110+ await tap ( 'SpendingAdvancedContinue' ) ;
111+ await tap ( 'NavigationBack' ) ;
112+
112113 // can continue with max client balance
113- //await tap('SpendingAmountMax');
114- //await elementById('SpendingAmountContinue').waitForEnabled();
115- //await sleep(500);
116- //await tap('SpendingAmountContinue');
117- //await elementById('SpendingConfirmAdvanced').waitForDisplayed();
118- //await tap('NavigationBack');
119- //--- skip due to: https://github.com/synonymdev/bitkit-android/issues/424 ---//
114+ await tap ( 'SpendingAmountMax' ) ;
115+ await elementById ( 'SpendingAmountContinue' ) . waitForEnabled ( ) ;
116+ await sleep ( 500 ) ;
117+ await tap ( 'SpendingAmountContinue' ) ;
118+ await elementById ( 'SpendingConfirmAdvanced' ) . waitForDisplayed ( ) ;
119+ await tap ( 'NavigationBack' ) ;
120120
121121 // can continue with 25% client balance
122122 await elementById ( 'SpendingAmountQuarter' ) . waitForEnabled ( ) ;
@@ -133,7 +133,7 @@ describe('@transfer - Transfer', () => {
133133 await tap ( 'N2' ) ;
134134 await multiTap ( 'N0' , 5 ) ;
135135 await tap ( 'SpendingAmountContinue' ) ;
136- await expectText ( '200 000' ) ;
136+ await expectText ( '200 000' , { strategy : 'contains' } ) ;
137137 await tap ( 'SpendingConfirmMore' ) ;
138138 await expectText ( '200 000' ) ;
139139 await tap ( 'LiquidityContinue' ) ;
@@ -145,6 +145,7 @@ describe('@transfer - Transfer', () => {
145145 // verify transfer activity on savings
146146 await tap ( 'ActivitySavings' ) ;
147147 await elementById ( 'Activity-1' ) . waitForDisplayed ( ) ;
148+ await elementById ( 'Activity-2' ) . waitForDisplayed ( ) ;
148149 await expectTextWithin ( 'Activity-1' , 'Transfer' , { timeout : 60_000 } ) ;
149150 await expectTextWithin ( 'Activity-1' , '-' ) ;
150151 await tap ( 'NavigationBack' ) ;
@@ -158,7 +159,7 @@ describe('@transfer - Transfer', () => {
158159 await tap ( 'N1' ) ;
159160 await multiTap ( 'N0' , 5 ) ;
160161 await tap ( 'SpendingAmountContinue' ) ;
161- await expectText ( '100 000' ) ;
162+ await expectText ( '100 000' , { strategy : 'contains' } ) ;
162163 await sleep ( 500 ) ;
163164 await tap ( 'SpendingConfirmAdvanced' ) ;
164165 await sleep ( 500 ) ;
@@ -213,6 +214,8 @@ describe('@transfer - Transfer', () => {
213214 // verify both transfers activities on savings
214215 await tap ( 'ActivitySavings' ) ;
215216 await elementById ( 'Activity-1' ) . waitForDisplayed ( ) ;
217+ await elementById ( 'Activity-2' ) . waitForDisplayed ( ) ;
218+ await elementById ( 'Activity-3' ) . waitForDisplayed ( ) ;
216219 await expectTextWithin ( 'Activity-1' , 'Transfer' ) ;
217220 await expectTextWithin ( 'Activity-1' , '-' ) ;
218221 await elementById ( 'Activity-2' ) . waitForDisplayed ( ) ;
@@ -228,7 +231,7 @@ describe('@transfer - Transfer', () => {
228231 await tap ( 'AdvancedSettings' ) ;
229232 await tap ( 'Channels' ) ;
230233 const channels = await elementsById ( 'Channel' ) ;
231- channels [ 1 ] . click ( ) ;
234+ channels [ driver . isAndroid ? 1 : 0 ] . click ( ) ;
232235 await expectTextWithin ( 'TotalSize' , '₿ 250 000' ) ;
233236 await expectText ( 'Processing payment' ) ;
234237 await doNavigationClose ( ) ;
@@ -298,23 +301,28 @@ describe('@transfer - Transfer', () => {
298301 await sleep ( 500 ) ;
299302
300303 // change fee
301- await tap ( 'SetCustomFee' ) ;
302- await sleep ( 500 ) ;
303- await tap ( 'NRemove' ) ;
304- await sleep ( 1000 ) ; // wait for input to register
305- await tap ( 'FeeCustomContinue' ) ;
306- await tap ( 'N5' ) ;
307- await sleep ( 1000 ) ; // wait for input to register
308- await tap ( 'FeeCustomContinue' ) ;
309-
310- // Swipe to confirm (set x offset to avoid navigating back)
304+ // this should be removed from Andorid:
305+ // https://github.com/synonymdev/bitkit-android/issues/548
306+ if ( driver . isAndroid ) {
307+ await tap ( 'SetCustomFee' ) ;
308+ await sleep ( 500 ) ;
309+ await tap ( 'NRemove' ) ;
310+ await sleep ( 1000 ) ; // wait for input to register
311+ await tap ( 'FeeCustomContinue' ) ;
312+ await tap ( 'N5' ) ;
313+ await sleep ( 1000 ) ; // wait for input to register
314+ await tap ( 'FeeCustomContinue' ) ;
315+ }
316+
317+ // Swipe to confirm
311318 await dragOnElement ( 'GRAB' , 'right' , 0.95 ) ;
312319 console . info ( 'channel opening...' ) ;
313320 await sleep ( 1000 ) ;
314- await elementById ( 'ExternalSuccess' ) . waitForDisplayed ( ) ;
315- await tap ( 'ExternalSuccess-button' ) ;
316- await tap ( 'NavigationBack' ) ;
317- await doNavigationClose ( ) ;
321+ await acknowledgeExternalSuccess ( ) ;
322+ if ( driver . isAndroid ) {
323+ await tap ( 'NavigationBack' ) ;
324+ await doNavigationClose ( ) ;
325+ }
318326
319327 // check transfer card
320328 // await elementById('Suggestion-lightning_setting_up').waitForDisplayed();
@@ -334,7 +342,14 @@ describe('@transfer - Transfer', () => {
334342 await mineBlocks ( rpc , 6 ) ;
335343 await electrum ?. waitForSync ( ) ;
336344 await waitForToast ( 'SpendingBalanceReadyToast' ) ;
337- await dismissQuickPayIntro ( ) ;
345+ await sleep ( 1000 ) ;
346+ if ( driver . isIOS ) {
347+ await dismissBackgroundPaymentsTimedSheet ( { triggerTimedSheet : driver . isIOS } ) ;
348+ await dismissQuickPayIntro ( { triggerTimedSheet : driver . isIOS } ) ;
349+ } else {
350+ await dismissQuickPayIntro ( ) ;
351+ }
352+ await expectNoTextWithin ( 'ActivitySpending' , '0' ) ;
338353 await waitForActiveChannel ( lnd , ldkNodeId ) ;
339354
340355 // check transfer card
@@ -364,7 +379,7 @@ describe('@transfer - Transfer', () => {
364379 await dragOnElement ( 'GRAB' , 'right' , 0.95 ) ;
365380 await elementById ( 'TransferSuccess' ) . waitForDisplayed ( ) ;
366381 await tap ( 'TransferSuccess-button' ) ;
367- await tap ( 'NavigationBack' ) ;
382+ if ( driver . isAndroid ) await tap ( 'NavigationBack' ) ;
368383
369384 // check channel is closed
370385 await tap ( 'HeaderMenu' ) ;
0 commit comments