Skip to content

Commit cccafc5

Browse files
authored
Merge pull request #44 from synonymdev/test/boost
Test/boost
2 parents bb9954a + a9d96c3 commit cccafc5

File tree

2 files changed

+63
-31
lines changed

2 files changed

+63
-31
lines changed

test/helpers/actions.ts

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,7 @@ export async function restoreWallet(
541541
type addressType = 'bitcoin' | 'lightning';
542542
export async function getReceiveAddress(which: addressType = 'bitcoin'): Promise<string> {
543543
await tap('Receive');
544+
await sleep(500);
544545
return getAddressFromQRCode(which);
545546
}
546547

@@ -635,12 +636,22 @@ export async function receiveOnchainFunds(
635636
// send - onchain - receiver sees no confetti — missing-in-ldk-node missing onchain payment event
636637
// await elementById('ReceivedTransaction').waitForDisplayed();
637638

638-
await dismissBackupTimedSheet();
639-
if (expectHighBalanceWarning) {
640-
await acknowledgeHighBalanceWarning();
639+
if (driver.isAndroid) {
640+
await dismissBackupTimedSheet();
641+
if (expectHighBalanceWarning) {
642+
await acknowledgeHighBalanceWarning();
643+
}
641644
}
645+
642646
const moneyText = await elementByIdWithin('TotalBalance-primary', 'MoneyText');
643647
await expect(moneyText).toHaveText(formattedSats);
648+
649+
if (driver.isIOS) {
650+
await dismissBackupTimedSheet({ triggerTimedSheet: true });
651+
if (expectHighBalanceWarning) {
652+
await acknowledgeHighBalanceWarning({ triggerTimedSheet: true });
653+
}
654+
}
644655
}
645656

646657
/**
@@ -677,13 +688,12 @@ export async function doTriggerTimedSheet() {
677688
export async function dismissBackupTimedSheet({
678689
triggerTimedSheet = false,
679690
}: { triggerTimedSheet?: boolean } = {}) {
680-
if (driver.isIOS) return; // Not supported on iOS yet
681691
if (triggerTimedSheet) {
682692
await doTriggerTimedSheet();
683693
}
684-
await elementById('backup_description').waitForDisplayed();
694+
await elementById('BackupIntroViewDescription').waitForDisplayed();
685695
await sleep(500); // wait for the app to settle
686-
await tap('later_button');
696+
await tap('BackupIntroViewCancel');
687697
await sleep(500);
688698
}
689699

@@ -733,13 +743,12 @@ export async function dismissQuickPayIntro({
733743
export async function acknowledgeHighBalanceWarning({
734744
triggerTimedSheet = false,
735745
}: { triggerTimedSheet?: boolean } = {}) {
736-
if (driver.isIOS) return; // Not supported on iOS yet
737746
if (triggerTimedSheet) {
738747
await doTriggerTimedSheet();
739748
}
740-
await elementById('high_balance_image').waitForDisplayed();
741-
await tap('understood_button');
742-
await elementById('high_balance_image').waitForDisplayed({ reverse: true });
749+
await elementById('HighBalanceSheetDescription').waitForDisplayed();
750+
await tap('HighBalanceSheetContinue');
751+
await elementById('HighBalanceSheetDescription').waitForDisplayed({ reverse: true });
743752
await sleep(500);
744753
}
745754

test/specs/boost.e2e.ts

Lines changed: 44 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ describe('@boost - Boost', () => {
5959

6060
// old tx
6161
await tap('ActivityShort-0');
62-
await expectText('100 000');
62+
await expectText('100 000', { strategy: 'contains' });
6363
await tap('ActivityTxDetails');
6464
const origTxId = await getTextUnder('TXID');
6565
console.info({ oldTxId: origTxId });
@@ -71,19 +71,31 @@ describe('@boost - Boost', () => {
7171
await tap('CustomFeeButton');
7272
await tap('Plus');
7373
await tap('Minus');
74-
await tap('RecomendedFeeButton');
74+
await tap('RecommendedFeeButton');
7575
await dragOnElement('GRAB', 'right', 0.95); // Swipe to confirm
7676

7777
// check Activity
7878
await elementById('BoostingIcon').waitForDisplayed();
7979
await elementById('ActivityShort-0').waitForDisplayed();
80-
await expect(elementById('ActivityShort-1')).toBeDisplayed();
81-
await expect(elementById('ActivityShort-2')).not.toBeDisplayed();
80+
81+
// no additional boost tx item on iOS, there is one on Android
82+
const showsBoostTxItem = driver.isAndroid;
83+
if (showsBoostTxItem) {
84+
await expect(elementById('ActivityShort-1')).toBeDisplayed();
85+
await expect(elementById('ActivityShort-2')).not.toBeDisplayed();
86+
} else {
87+
await expect(elementById('ActivityShort-1')).not.toBeDisplayed();
88+
await expect(elementById('ActivityShort-2')).not.toBeDisplayed();
89+
}
8290

8391
// orig tx still there
8492
await swipeFullScreen('up');
85-
await tap('ActivityShort-1');
86-
await expectText('100 000');
93+
if (showsBoostTxItem) {
94+
await tap('ActivityShort-1');
95+
} else {
96+
await tap('ActivityShort-0');
97+
}
98+
await expectText('100 000', { strategy: 'contains' });
8799
await elementById('BoostedButton').waitForDisplayed();
88100
await elementById('StatusBoosting').waitForDisplayed();
89101
await tap('ActivityTxDetails');
@@ -95,15 +107,17 @@ describe('@boost - Boost', () => {
95107
console.info({ parentTxId });
96108
await doNavigationClose();
97109

98-
// new tx
99-
await tap('ActivityShort-0');
100-
await tap('ActivityTxDetails');
101-
const boostTxId = await getTextUnder('TXID');
102-
console.info({ newTxId: boostTxId });
103-
await expect(origTxId !== boostTxId).toBe(true);
104-
// TODO: not implemented yet
105-
// await expect(boostTxId === parentTxId).toBe(true);
106-
await doNavigationClose();
110+
if (showsBoostTxItem) {
111+
// new tx
112+
await tap('ActivityShort-0');
113+
await tap('ActivityTxDetails');
114+
const boostTxId = await getTextUnder('TXID');
115+
console.info({ newTxId: boostTxId });
116+
await expect(origTxId !== boostTxId).toBe(true);
117+
// TODO: not implemented yet
118+
// await expect(boostTxId === parentTxId).toBe(true);
119+
await doNavigationClose();
120+
}
107121

108122
// --- skip due to: https://github.com/synonymdev/bitkit-android/issues/321 --- //
109123

@@ -119,8 +133,13 @@ describe('@boost - Boost', () => {
119133
// check activity after restore
120134
await swipeFullScreen('up');
121135
await elementById('BoostingIcon').waitForDisplayed();
122-
await elementById('ActivityShort-1').waitForDisplayed();
123-
await tap('ActivityShort-1');
136+
if (showsBoostTxItem) {
137+
await elementById('ActivityShort-1').waitForDisplayed();
138+
await tap('ActivityShort-1');
139+
} else {
140+
await elementById('ActivityShort-0').waitForDisplayed();
141+
await tap('ActivityShort-0');
142+
}
124143
await elementById('BoostedButton').waitForDisplayed();
125144
await elementById('StatusBoosting').waitForDisplayed();
126145

@@ -135,14 +154,18 @@ describe('@boost - Boost', () => {
135154
await attemptRefreshOnHomeScreen();
136155
await swipeFullScreen('up');
137156
await elementById('ActivityShort-0').waitForDisplayed();
138-
await elementById('ActivityShort-1').waitForDisplayed();
157+
if (showsBoostTxItem) {
158+
await elementById('ActivityShort-1').waitForDisplayed();
159+
}
139160
// TEMP: refresh until proper events available
140161

141162
await tap('ActivityShort-0');
142163
await elementById('StatusConfirmed').waitForDisplayed();
143164
await doNavigationClose();
144-
await tap('ActivityShort-1');
145-
await elementById('StatusConfirmed').waitForDisplayed();
165+
if (showsBoostTxItem) {
166+
await tap('ActivityShort-1');
167+
await elementById('StatusConfirmed').waitForDisplayed();
168+
}
146169
});
147170

148171
ciIt('@boost_2 - Can do RBF', async () => {
@@ -205,7 +228,7 @@ describe('@boost - Boost', () => {
205228
await tap('CustomFeeButton');
206229
await tap('Plus');
207230
await tap('Minus');
208-
await tap('RecomendedFeeButton');
231+
await tap('RecommendedFeeButton');
209232
await dragOnElement('GRAB', 'right', 0.95); // Swipe to confirm
210233

211234
// check Activity

0 commit comments

Comments
 (0)