Skip to content

Commit d28c443

Browse files
authored
Merge pull request #178 from synonymdev/fix/block-input-over-max
Fix/block input over max
2 parents 0442112 + 1ebfcc4 commit d28c443

5 files changed

Lines changed: 20 additions & 14 deletions

File tree

test/helpers/actions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1222,7 +1222,8 @@ export type ToastId =
12221222
| 'ProfileUpdatedToast'
12231223
| 'ContactSavedToast'
12241224
| 'ContactUpdatedToast'
1225-
| 'ContactDeletedToast';
1225+
| 'ContactDeletedToast'
1226+
| 'SendAmountExceededToast';
12261227

12271228
/** Wait for a toast by test id. Prefer `waitToDisappear` for iOS: success toasts live in a separate
12281229
* window, so swipe-dismiss (`dismiss: true`) often uses wrong coordinates and blocks later UI. */

test/specs/lnurl.e2e.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,11 @@ describe('@lnurl - LNURL', () => {
180180
await tap('N2');
181181
await tap('N0');
182182
await tap('N1');
183-
await expectTextWithin('SendNumberField', '201');
184-
await elementById('ContinueAmount').waitForEnabled({ reverse: true });
183+
if (driver.isAndroid) {
184+
await waitForToast('SendAmountExceededToast');
185+
} else {
186+
await elementById('ContinueAmount').waitForEnabled({ reverse: true });
187+
}
185188
await multiTap('NRemove', 3); // remove "201"
186189
await tap('N1');
187190
await tap('N4');

test/specs/numberpad.e2e.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('@numberpad - NumberPad', () => {
2525
electrum = await initElectrum();
2626
await reinstallApp();
2727
await completeOnboarding();
28-
await receiveOnchainFunds({ sats: 10_000 });
28+
await receiveOnchainFunds({ sats: 500_000_000, expectHighBalanceWarning: true });
2929
});
3030

3131
after(async () => {
@@ -89,11 +89,11 @@ async function modernDenominationChecks(mode: NumberpadMode) {
8989

9090
await tap('N000');
9191
await expectText('123 000');
92-
await checkContinueButton(mode, { aboveBalance: true });
92+
await checkContinueButton(mode);
9393

9494
// Switch to USD
9595
await tap(`${mode}NumberPadUnit`);
96-
await checkContinueButton(mode, { aboveBalance: true });
96+
await checkContinueButton(mode);
9797

9898
// reset to 0
9999
await multiTap('NRemove', 8);
@@ -112,7 +112,7 @@ async function modernDenominationChecks(mode: NumberpadMode) {
112112
await tap('NDecimal');
113113
await tap('N1');
114114
await expectText('1.01');
115-
await checkContinueButton(mode, { aboveBalance: false });
115+
await checkContinueButton(mode);
116116

117117
// Switch back to BTC
118118
await tap(`${mode}NumberPadUnit`);
@@ -157,15 +157,11 @@ async function classicDenominationChecks(mode: NumberpadMode) {
157157
}
158158

159159
async function checkContinueButton(
160-
mode: NumberpadMode,
161-
{ aboveBalance = true }: { aboveBalance?: boolean } = {}
160+
mode: NumberpadMode
162161
) {
163162
if (mode === 'Send') {
164-
// make sure Continue button is disabled as amount is above balance
165-
if (driver.isAndroid) return; // https://github.com/synonymdev/bitkit-android/issues/611
166-
await elementById('ContinueAmount').waitForEnabled({ reverse: aboveBalance });
163+
await elementById('ContinueAmount').waitForEnabled();
167164
} else {
168-
// In receive mode Continue is always enabled
169165
await elementById('ReceiveNumberPadSubmit').waitForEnabled();
170166
}
171167
}

test/specs/send.e2e.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,11 @@ describe('@send - Send', () => {
146146
// type amount over balance and verify you cannot continue
147147
await tap('AddressContinue');
148148
await enterAmount(amount + 1);
149-
await elementById('ContinueAmount').waitForEnabled({ reverse: true });
149+
if (driver.isAndroid) {
150+
await waitForToast('SendAmountExceededToast');
151+
} else {
152+
await elementById('ContinueAmount').waitForEnabled({ reverse: true });
153+
}
150154
await tap('NavigationBack');
151155

152156
// check validation for unified invoice when balance is enough (10_000 sats)

test/specs/transfer.e2e.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ describe('@transfer - Transfer', () => {
9999
const eurBalance = Number.parseInt(label, 10);
100100
await expect(eurBalance).toBeGreaterThan(440);
101101
await expect(eurBalance).toBeLessThan(460);
102+
await sleep(1000);
102103
await tap('SpendingAdvancedNumberField'); // change back to sats
103104
await tap('SpendingAdvancedContinue');
104105
await sleep(500);
@@ -163,6 +164,7 @@ describe('@transfer - Transfer', () => {
163164
// Get another channel with custom receiving capacity
164165
await tap('ActivitySavings');
165166
await tap('TransferToSpending');
167+
await elementById('SpendingAmountContinue').waitForEnabled();
166168
await tap('N1');
167169
await multiTap('N0', 5);
168170
await tap('SpendingAmountContinue');

0 commit comments

Comments
 (0)