Skip to content

Commit 08a779c

Browse files
committed
RGS and Electrum toast ids
1 parent 79a2efa commit 08a779c

File tree

2 files changed

+15
-22
lines changed

2 files changed

+15
-22
lines changed

test/helpers/actions.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,14 +674,21 @@ export async function receiveOnchainFunds(
674674
}
675675

676676
type ToastId =
677+
| 'RgsUpdatedToast'
678+
| 'RgsErrorToast'
679+
| 'ElectrumErrorToast'
680+
| 'ElectrumUpdatedToast'
677681
| 'PaymentFailedToast'
678682
| 'ReceivedTransactionReplacedToast'
679683
| 'TransactionReplacedToast'
680684
| 'TransactionUnconfirmedToast'
681685
| 'TransactionRemovedToast';
682686

683-
export async function waitForToast(toastId: ToastId) {
687+
export async function waitForToast(toastId: ToastId, { waitToDisappear = true } = {}) {
684688
await elementById(toastId).waitForDisplayed();
689+
if (waitToDisappear) {
690+
await elementById(toastId).waitForDisplayed({ reverse: true, timeout: 15_000 });
691+
}
685692
}
686693

687694
/** Acknowledges the received payment notification by tapping the button.

test/specs/settings.e2e.ts

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import {
1414
confirmInputOnKeyboard,
1515
multiTap,
1616
getAccessibleText,
17-
expectText,
1817
doNavigationClose,
18+
waitForToast,
1919
} from '../helpers/actions';
2020
import { electrumHost, electrumPort } from '../helpers/constants';
2121
import { launchFreshApp, reinstallApp } from '../helpers/setup';
@@ -380,7 +380,7 @@ describe('@settings - Settings', () => {
380380

381381
// disconnected warning should appear
382382
await elementById('Disconnected').waitForDisplayed();
383-
await sleep(1000);
383+
await waitForToast('ElectrumErrorToast');
384384

385385
// scanner - check all possible connection formats
386386
// Umbrel format
@@ -397,20 +397,6 @@ describe('@settings - Settings', () => {
397397
expectedProtocol: 'TLS',
398398
};
399399

400-
// should detect protocol for common ports
401-
const noProto1 = {
402-
url: `${electrumHost}:50001`,
403-
expectedHost: electrumHost,
404-
expectedPort: '50001',
405-
expectedProtocol: 'TCP',
406-
};
407-
const noProto2 = {
408-
url: `${electrumHost}:50002`,
409-
expectedHost: electrumHost,
410-
expectedPort: '50002',
411-
expectedProtocol: 'TLS',
412-
};
413-
414400
// HTTP URL
415401
const http1 = {
416402
url: `http://${electrumHost}:${electrumPort}`,
@@ -425,7 +411,7 @@ describe('@settings - Settings', () => {
425411
expectedProtocol: 'TLS',
426412
};
427413

428-
const conns = [umbrel1, umbrel2, noProto1, noProto2, http1, http2];
414+
const conns = [umbrel1, umbrel2, http1, http2];
429415
let i = 0;
430416
for (const conn of conns) {
431417
await sleep(1000);
@@ -437,6 +423,7 @@ describe('@settings - Settings', () => {
437423
await tap('ScanPrompt');
438424
await typeText('QRInput', conn.url);
439425
await tap('DialogConfirm');
426+
await waitForToast('ElectrumUpdatedToast');
440427
await expect(await elementById('HostInput')).toHaveText(conn.expectedHost);
441428
expect(await elementById('PortInput')).toHaveText(conn.expectedPort);
442429
// await expectTextWithin('ElectrumProtocol', conn.expectedProtocol);
@@ -447,6 +434,7 @@ describe('@settings - Settings', () => {
447434
await elementById('ResetToDefault').waitForEnabled();
448435
await tap('ResetToDefault');
449436
await tap('ConnectToHost');
437+
await waitForToast('ElectrumUpdatedToast', { waitToDisappear: false });
450438
await elementById('Connected').waitForDisplayed();
451439
await sleep(1000);
452440
});
@@ -467,16 +455,14 @@ describe('@settings - Settings', () => {
467455
await typeText('RGSUrl', newUrl);
468456
await confirmInputOnKeyboard();
469457
await tap('ConnectToHost');
470-
const updatedMsg = 'Rapid-Gossip-Sync Server Updated';
471-
await expectText(updatedMsg);
472-
await expectText(updatedMsg, { visible: false });
458+
await waitForToast('RgsUpdatedToast');
473459
const updatedUrl = await (await elementById('ConnectedUrl')).getText();
474460
await expect(updatedUrl).toBe(newUrl);
475461

476462
// switch back to default
477463
await tap('ResetToDefault');
478464
await tap('ConnectToHost');
479-
await expectText(updatedMsg);
465+
await waitForToast('RgsUpdatedToast', { waitToDisappear: false });
480466

481467
const resetUrl = await (await elementById('ConnectedUrl')).getText();
482468
await expect(resetUrl).toBe(rgsUrl);

0 commit comments

Comments
 (0)