Skip to content

Commit b59266a

Browse files
authored
Merge pull request #180 from synonymdev/fix/amount-screens-cap
test: adjust for SendAmountExceededToast for iOS
2 parents 01e65e8 + 9bd2c5c commit b59266a

2 files changed

Lines changed: 25 additions & 20 deletions

File tree

test/specs/lnurl.e2e.ts

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
enterAddressViaScanPrompt,
2525
acknowledgeReceivedPayment,
2626
acknowledgeExternalSuccess,
27+
enterAmount,
2728
} from '../helpers/actions';
2829
import { reinstallApp } from '../helpers/setup';
2930
import { ciIt } from '../helpers/suite';
@@ -177,27 +178,25 @@ describe('@lnurl - LNURL', () => {
177178
await enterAddressViaScanPrompt(payRequest1.encoded, { acceptCameraPermission: false });
178179
await expectTextWithin('SendNumberField', '0');
179180
// Check that 149 sats is below minimum and 201 sats is above maximum (both rejected)
180-
await tap('N2');
181-
await tap('N0');
182-
await tap('N1');
183-
if (driver.isAndroid) {
184-
await waitForToast('SendAmountExceededToast');
185-
} else {
186-
await elementById('ContinueAmount').waitForEnabled({ reverse: true });
181+
try {
182+
await enterAmount(201);
183+
await waitForToast('SendAmountExceededToast', { dismiss: driver.isAndroid });
184+
} catch {
185+
console.warn('SendAmountExceededToast not triggered, trying again...');
186+
// tap on 1 fast to trigger the toast
187+
await elementById('N1').click();
188+
await waitForToast('SendAmountExceededToast', { dismiss: driver.isAndroid });
187189
}
190+
188191
await multiTap('NRemove', 3); // remove "201"
189-
await tap('N1');
190-
await tap('N4');
191-
await tap('N9');
192+
await enterAmount(149);
192193
await expectTextWithin('SendNumberField', '149');
193194
await tap('ContinueAmount');
194195
await waitForToast('LnurlPayAmountTooLowToast');
195196

196197
await multiTap('NRemove', 3); // remove "149"
197198
// go with 150
198-
await tap('N1');
199-
await tap('N5');
200-
await tap('N0');
199+
await enterAmount(150);
201200
await expectTextWithin('SendNumberField', '150');
202201
await elementById('ContinueAmount').waitForEnabled();
203202
await tap('ContinueAmount');
@@ -264,9 +263,7 @@ describe('@lnurl - LNURL', () => {
264263
await enterAddress(payRequest3.encoded, { acceptCameraPermission: false });
265264
await expectTextWithin('SendNumberField', '0');
266265
// go with 321
267-
await tap('N3');
268-
await tap('N2');
269-
await tap('N1');
266+
await enterAmount(321);
270267
await elementById('ContinueAmount').waitForDisplayed();
271268
await tap('ContinueAmount');
272269
await dragOnElement('GRAB', 'right', 0.95);

test/specs/send.e2e.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,12 @@ describe('@send - Send', () => {
146146
// type amount over balance and verify you cannot continue
147147
await tap('AddressContinue');
148148
await enterAmount(amount + 1);
149-
if (driver.isAndroid) {
149+
try {
150+
await waitForToast('SendAmountExceededToast');
151+
} catch {
152+
console.warn('SendAmountExceededToast not triggered, trying again...');
153+
await elementById('N1').click();
150154
await waitForToast('SendAmountExceededToast');
151-
} else {
152-
await elementById('ContinueAmount').waitForEnabled({ reverse: true });
153155
}
154156
await tap('NavigationBack');
155157

@@ -267,7 +269,13 @@ describe('@send - Send', () => {
267269
console.info({ invoice0 });
268270
await enterAddress(invoice0);
269271
await enterAmount(10_000 + 1);
270-
await elementById('ContinueAmount').waitForEnabled({ reverse: true });
272+
try {
273+
await waitForToast('SendAmountExceededToast');
274+
} catch {
275+
console.warn('SendAmountExceededToast not triggered, trying again...');
276+
await elementById('N1').click();
277+
await waitForToast('SendAmountExceededToast');
278+
}
271279
await swipeFullScreen('down');
272280

273281
// send to onchain address

0 commit comments

Comments
 (0)