Skip to content

Commit 2f5cd13

Browse files
authored
Merge pull request #60 from synonymdev/test/lightning
Test/lightning
2 parents 7a264aa + 3de440d commit 2f5cd13

File tree

2 files changed

+39
-9
lines changed

2 files changed

+39
-9
lines changed

test/helpers/actions.ts

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -715,12 +715,25 @@ export async function acknowledgeReceivedPayment() {
715715
* await doTriggerTimedSheet();
716716
*/
717717
export async function doTriggerTimedSheet() {
718+
await sleep(700); // wait for any previous animations to finish
718719
await tap('HeaderMenu');
719720
await tap('DrawerSettings');
720721
await sleep(500); // wait for the app to settle
721722
await doNavigationClose();
722723
}
723724

725+
export async function dismissBackgroundPaymentsTimedSheet({
726+
triggerTimedSheet = false,
727+
}: { triggerTimedSheet?: boolean } = {}) {
728+
if (triggerTimedSheet) {
729+
await doTriggerTimedSheet();
730+
}
731+
await elementById('BackgroundPaymentsDescription').waitForDisplayed();
732+
await sleep(500); // wait for the app to settle
733+
await tap('BackgroundPaymentsCancel');
734+
await sleep(500);
735+
}
736+
724737
/**
725738
* Dismisses the backup reminder sheet.
726739
* This sheet is triggered by first onchain balance change.
@@ -744,7 +757,7 @@ export async function dismissBackupTimedSheet({
744757
}
745758
await elementById('BackupIntroViewDescription').waitForDisplayed();
746759
await sleep(500); // wait for the app to settle
747-
await tap('BackupIntroViewCancel');
760+
await swipeFullScreen('down');
748761
await sleep(500);
749762
}
750763

@@ -766,14 +779,22 @@ export async function dismissBackupTimedSheet({
766779
export async function dismissQuickPayIntro({
767780
triggerTimedSheet = false,
768781
}: { triggerTimedSheet?: boolean } = {}) {
769-
if (driver.isIOS) return; // Not supported on iOS yet
770782
if (triggerTimedSheet) {
771783
await doTriggerTimedSheet();
772784
}
773-
await elementById('QuickpayIntro-button').waitForDisplayed();
774-
await sleep(500); // wait for the app to settle
775-
await swipeFullScreen('down');
776-
await sleep(500);
785+
786+
if (driver.isAndroid) {
787+
// TODO: it's temp, change on Android to match iOS testID
788+
await elementById('QuickpayIntro-button').waitForDisplayed();
789+
await sleep(500); // wait for the app to settle
790+
await swipeFullScreen('down');
791+
await sleep(500);
792+
} else {
793+
await elementById('QuickpayIntroDescription').waitForDisplayed();
794+
await sleep(500); // wait for the app to settle
795+
await tap('QuickpayIntroCancel');
796+
await sleep(500);
797+
}
777798
}
778799

779800
/**

test/specs/lightning.e2e.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
elementByText,
2424
dismissQuickPayIntro,
2525
doNavigationClose,
26+
dismissBackgroundPaymentsTimedSheet,
2627
acknowledgeReceivedPayment,
2728
waitForBackup,
2829
} from '../helpers/actions';
@@ -111,8 +112,13 @@ describe('@lightning - Lightning', () => {
111112
console.info({ response });
112113
await elementById('ReceivedTransaction').waitForDisplayed();
113114
await tap('ReceivedTransactionButton');
114-
await sleep(500);
115-
await dismissQuickPayIntro();
115+
await sleep(1000);
116+
if (driver.isIOS) {
117+
await dismissBackgroundPaymentsTimedSheet({ triggerTimedSheet: driver.isIOS });
118+
await dismissQuickPayIntro({ triggerTimedSheet: driver.isIOS });
119+
} else {
120+
await dismissQuickPayIntro();
121+
}
116122
const totalBalance = await elementByIdWithin('TotalBalance-primary', 'MoneyText');
117123
await expect(totalBalance).toHaveText('11 000'); // 1k onchain + 10k lightning
118124
await expectTextWithin('ActivitySpending', '10 000');
@@ -196,6 +202,7 @@ describe('@lightning - Lightning', () => {
196202
await swipeFullScreen('up');
197203
await swipeFullScreen('up');
198204
await tap('ActivityShowAll');
205+
199206
// All transactions
200207
await expectTextWithin('Activity-1', '-');
201208
await expectTextWithin('Activity-2', '-');
@@ -280,7 +287,9 @@ describe('@lightning - Lightning', () => {
280287
await mineBlocks(rpc, 6);
281288
await electrum?.waitForSync();
282289
await elementById('Channel').waitForDisplayed({ reverse: true });
283-
await tap('NavigationBack');
290+
if (driver.isAndroid) {
291+
await tap('NavigationBack');
292+
}
284293
await doNavigationClose();
285294

286295
await swipeFullScreen('up');

0 commit comments

Comments
 (0)