Skip to content

Commit 0b36b65

Browse files
committed
initial v60 settings adjustments
1 parent 413bfe6 commit 0b36b65

16 files changed

Lines changed: 119 additions & 156 deletions

test/helpers/actions.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { ChainablePromiseElement } from 'webdriverio';
22
import { reinstallApp } from './setup';
33
import { deposit, mineBlocks } from './regtest';
4+
import { openSettings } from './settings';
45

56
export const sleep = (ms: number) => browser.pause(ms);
67

@@ -610,9 +611,7 @@ export async function doNavigationClose() {
610611
}
611612

612613
export async function getSeed(): Promise<string> {
613-
await tap('HeaderMenu');
614-
await tap('DrawerSettings');
615-
await tap('BackupSettings');
614+
await openSettings('security');
616615
await tap('BackupWallet');
617616

618617
// get seed from SeedContainer
@@ -810,9 +809,7 @@ async function assertAddressTypeSwitchFeedback() {
810809
}
811810

812811
export async function switchPrimaryAddressType(nextType: addressTypePreference) {
813-
await tap('HeaderMenu');
814-
await tap('DrawerSettings');
815-
await tap('AdvancedSettings');
812+
await openSettings('advanced');
816813
await tap('AddressTypePreference');
817814
await tap(nextType);
818815
await assertAddressTypeSwitchFeedback();
@@ -1165,6 +1162,8 @@ export type ToastId =
11651162
| 'TransactionRemovedToast'
11661163
| 'InvalidAddressToast'
11671164
| 'ExpiredLightningToast'
1165+
| 'DevModeEnabledToast'
1166+
| 'DevModeDisabledToast'
11681167
| 'InsufficientSpendingToast'
11691168
| 'InsufficientSavingsToast';
11701169

@@ -1363,9 +1362,7 @@ export async function acknowledgeHighBalanceWarning({
13631362
// enable/disable widgets in settings
13641363
export async function toggleWidgets() {
13651364
await sleep(3000);
1366-
await tap('HeaderMenu');
1367-
await tap('DrawerSettings');
1368-
await tap('GeneralSettings');
1365+
await openSettings();
13691366
await tap('WidgetsSettings');
13701367
const widgets = await elementsByText('Widgets');
13711368
await widgets[1].click();
@@ -1476,8 +1473,7 @@ export async function attemptRefreshOnHomeScreen() {
14761473
}
14771474

14781475
export async function waitForBackup() {
1479-
await tap('HeaderMenu');
1480-
await tap('DrawerSettings');
1476+
await openSettings('security');
14811477
await tap('BackupSettings');
14821478
await elementById('AllSynced').waitForDisplayed();
14831479
await doNavigationClose();

test/helpers/lnd.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
typeText,
1111
} from './actions';
1212
import { LndConfig } from './constants';
13+
import { openSettings } from './settings';
1314
import createLndRpc, { LnRpc, WalletUnlockerRpc } from '@radar/lnrpc';
1415

1516
export async function setupLND(
@@ -94,9 +95,7 @@ export async function waitForActiveChannel(
9495
}
9596

9697
export async function getLDKNodeID(): Promise<string> {
97-
await tap('HeaderMenu');
98-
await tap('DrawerSettings');
99-
await tap('AdvancedSettings');
98+
await openSettings('advanced');
10099
// wait for LDK to start
101100
await sleep(5000);
102101
await tap('LightningNodeInfo');
@@ -123,9 +122,7 @@ export async function connectToLND(lndNodeID: string, { navigationClose = true }
123122
}
124123

125124
export async function checkChannelStatus({ size = '100 000' } = {}) {
126-
await tap('HeaderMenu');
127-
await tap('DrawerSettings');
128-
await tap('AdvancedSettings');
125+
await openSettings('advanced');
129126
await tap('Channels');
130127
await sleep(1000);
131128
await tap('Channel');

test/helpers/regtest.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ async function localMineBlocks(count: number): Promise<void> {
5151

5252
function lndRestRequest(
5353
path: string,
54-
body: Record<string, unknown>,
54+
body: Record<string, unknown>
5555
): Promise<Record<string, unknown>> {
5656
const tlsCert = fs.readFileSync(lndConfig.tls);
5757
const macaroon = fs.readFileSync(lndConfig.macaroonPath).toString('hex');
@@ -74,15 +74,17 @@ function lndRestRequest(
7474
},
7575
(res) => {
7676
let data = '';
77-
res.on('data', (chunk: Buffer) => { data += chunk.toString(); });
77+
res.on('data', (chunk: Buffer) => {
78+
data += chunk.toString();
79+
});
7880
res.on('end', () => {
7981
if (res.statusCode && res.statusCode >= 200 && res.statusCode < 300) {
8082
resolve(JSON.parse(data) as Record<string, unknown>);
8183
} else {
8284
reject(new Error(`LND REST ${res.statusCode}: ${data}`));
8385
}
8486
});
85-
},
87+
}
8688
);
8789
req.on('error', reject);
8890
req.write(payload);

test/helpers/settings.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { tap, sleep } from './actions';
2+
3+
export type SettingsTab = 'general' | 'security' | 'advanced';
4+
5+
/**
6+
* Opens the Settings screen at the given tab.
7+
* General is the default tab so no extra tap is needed for it.
8+
*/
9+
export async function openSettings(tab: SettingsTab = 'general') {
10+
await tap('HeaderMenu');
11+
await tap('DrawerSettings');
12+
if (tab !== 'general') {
13+
await tap(`Tab-${tab}`);
14+
await sleep(300);
15+
}
16+
}
17+
18+
/**
19+
* Opens the Support screen from the drawer menu.
20+
*/
21+
export async function openSupport() {
22+
await tap('HeaderMenu');
23+
await tap('DrawerSupport');
24+
}

test/specs/backup.e2e.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
} from '../helpers/actions';
2020
import { ciIt } from '../helpers/suite';
2121
import { ensureLocalFunds } from '../helpers/regtest';
22+
import { openSettings } from '../helpers/settings';
2223

2324
describe('@backup - Backup', () => {
2425
let electrum: Awaited<ReturnType<typeof initElectrum>> | undefined;
@@ -66,9 +67,7 @@ describe('@backup - Backup', () => {
6667
await tap('NavigationBack');
6768

6869
// - change settings (currency to GBP) //
69-
await tap('HeaderMenu');
70-
await tap('DrawerSettings');
71-
await tap('GeneralSettings');
70+
await openSettings();
7271
await tap('CurrenciesSettings');
7372
const gbp_opt = await elementByText('GBP (£)');
7473
await gbp_opt.waitForDisplayed();

test/specs/lightning.e2e.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import {
3939
} from '../helpers/lnd';
4040
import { ciIt } from '../helpers/suite';
4141
import { ensureLocalFunds, getBitcoinRpc, mineBlocks } from '../helpers/regtest';
42+
import { openSettings } from '../helpers/settings';
4243

4344
describe('@lightning - Lightning', () => {
4445
let electrum: { waitForSync: any; stop: any };
@@ -262,9 +263,7 @@ describe('@lightning - Lightning', () => {
262263
await doNavigationClose();
263264

264265
// check channel status
265-
await tap('HeaderMenu');
266-
await tap('DrawerSettings');
267-
await tap('AdvancedSettings');
266+
await openSettings('advanced');
268267
await tap('Channels');
269268
await sleep(2000);
270269
await tap('Channel');

test/specs/migration.e2e.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import {
3939
mineBlocks,
4040
payInvoice,
4141
} from '../helpers/regtest';
42+
import { openSettings } from '../helpers/settings';
4243

4344
// Module-level electrum client (set in before hook)
4445
let electrumClient: ElectrumClient;

test/specs/multiaddress.e2e.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ import {
5151
getExternalAddress,
5252
mineBlocks,
5353
} from '../helpers/regtest';
54+
import { openSettings } from '../helpers/settings';
5455

5556
describe('@multi_address - Multi address', () => {
5657
let electrum: Awaited<ReturnType<typeof initElectrum>> | undefined;
@@ -163,10 +164,7 @@ describe('@multi_address - Multi address', () => {
163164
await swipeFullScreen('down');
164165

165166
// check in address viewer all savings are in taproot address
166-
await tap('HeaderMenu');
167-
await tap('DrawerSettings');
168-
await sleep(1000);
169-
await tap('AdvancedSettings');
167+
await openSettings('advanced');
170168
await sleep(1000);
171169
await tap('AddressViewer');
172170
await sleep(1000);
@@ -238,10 +236,7 @@ describe('@multi_address - Multi address', () => {
238236
await expect(remainingTotal).toBeGreaterThan(0);
239237

240238
// verify change is in taproot address
241-
await tap('HeaderMenu');
242-
await tap('DrawerSettings');
243-
await sleep(1000);
244-
await tap('AdvancedSettings');
239+
await openSettings('advanced');
245240
await sleep(1000);
246241
await tap('AddressViewer');
247242
await sleep(1000);
@@ -294,10 +289,7 @@ describe('@multi_address - Multi address', () => {
294289
const savingsBalance = await getSavingsBalance();
295290
await expect(savingsBalance).toEqual(satsPerAddressType);
296291

297-
await tap('HeaderMenu');
298-
await tap('DrawerSettings');
299-
await sleep(1000);
300-
await tap('AdvancedSettings');
292+
await openSettings('advanced');
301293
await sleep(1000);
302294
await tap('AddressViewer');
303295
await sleep(1000);

test/specs/numberpad.e2e.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import initElectrum from '../helpers/electrum';
1515
import { launchFreshApp, reinstallApp } from '../helpers/setup';
1616
import { ciIt } from '../helpers/suite';
1717
import { ensureLocalFunds } from '../helpers/regtest';
18+
import { openSettings } from '../helpers/settings';
1819

1920
describe('@numberpad - NumberPad', () => {
2021
let electrum: Awaited<ReturnType<typeof initElectrum>> | undefined;
@@ -178,9 +179,7 @@ async function makeSureIsBitcoinInput(mode: NumberpadMode) {
178179
}
179180

180181
async function switchToClassicDenomination() {
181-
await tap('HeaderMenu');
182-
await tap('DrawerSettings');
183-
await tap('GeneralSettings');
182+
await openSettings();
184183
await tap('UnitSettings');
185184
await tap('DenominationClassic');
186185
await doNavigationClose();

test/specs/onboarding.e2e.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
} from '../helpers/actions';
1515
import { reinstallApp } from '../helpers/setup';
1616
import { ciIt } from '../helpers/suite';
17+
import { openSettings } from '../helpers/settings';
1718

1819
describe('@onboarding - Onboarding', () => {
1920
beforeEach(async () => {
@@ -85,9 +86,7 @@ describe('@onboarding - Onboarding', () => {
8586

8687
// Go to Address Viewer
8788
await swipeFullScreen('down');
88-
await tap('HeaderMenu');
89-
await tap('DrawerSettings');
90-
await tap('AdvancedSettings');
89+
await openSettings('advanced');
9190
await tap('AddressViewer');
9291

9392
const address0Element = await elementById('Address-0');

0 commit comments

Comments
 (0)