Skip to content

Commit

Permalink
fix: settings
Browse files Browse the repository at this point in the history
  • Loading branch information
limpbrains committed Nov 2, 2023
1 parent 407cc92 commit 0704771
Showing 1 changed file with 29 additions and 13 deletions.
42 changes: 29 additions & 13 deletions e2e/settings.e2e.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import jestExpect from 'expect';
import parse from 'url-parse';
import { device } from 'detox';

import {
sleep,
Expand Down Expand Up @@ -59,7 +60,7 @@ d('Settings', () => {
await element(by.id('GeneralSettings')).tap();
await element(by.id('CurrenciesSettings')).tap();
await element(by.text('GBP (£)')).tap();
await element(by.id('NavigationClose')).tap();
await element(by.id('NavigationClose')).atIndex(0).tap();

await expect(
element(by.id('MoneyFiatSymbol').withAncestor(by.id('TotalBalance'))),
Expand Down Expand Up @@ -114,7 +115,7 @@ d('Settings', () => {
await element(by.id('custom')).tap();
await element(by.id('N1').withAncestor(by.id('CustomFee'))).tap();
await element(by.id('Continue')).tap();
await element(by.id('NavigationBack')).tap();
await element(by.id('NavigationBack')).atIndex(0).tap();
await expect(
element(by.id('Value').withAncestor(by.id('TransactionSpeedSettings'))),
).toHaveText('Custom');
Expand Down Expand Up @@ -150,7 +151,7 @@ d('Settings', () => {
await element(by.id('GeneralSettings')).tap();
await element(by.id('SuggestionsSettings')).tap();
await element(by.id('DisplaySuggestions')).tap();
await element(by.id('NavigationClose')).tap();
await element(by.id('NavigationClose')).atIndex(0).tap();
await expect(element(by.id('Suggestions'))).not.toBeVisible();

// show Suggestions and reset them
Expand All @@ -175,7 +176,7 @@ d('Settings', () => {
await element(by.id('Settings')).tap();
await element(by.id('GeneralSettings')).tap();
await expect(element(by.id('TagsSettings'))).not.toBeVisible();
await element(by.id('NavigationClose')).tap();
await element(by.id('NavigationClose')).atIndex(0).tap();

// open receive tags, add a tag
const tag = 'test123';
Expand All @@ -197,7 +198,7 @@ d('Settings', () => {
await element(by.id('TagsSettings')).tap();
await expect(element(by.text(tag))).toBeVisible();
await element(by.id(`Tag-${tag}-delete`)).tap();
await element(by.id('NavigationClose')).tap();
await element(by.id('NavigationClose')).atIndex(0).tap();

// open receive tags, check tags are gone
await element(by.id('Receive')).tap();
Expand All @@ -219,7 +220,7 @@ d('Settings', () => {
await element(by.id('Settings')).tap();
await element(by.id('BackupSettings')).tap();
await element(by.id('ResetAndRestore')).tap(); // just check if this screen can be opened
await element(by.id('NavigationBack')).tap();
await element(by.id('NavigationBack')).atIndex(0).tap();
await element(by.id('BackupWallet')).tap();
await sleep(1000); // animation
await element(by.id('TapToReveal')).tap();
Expand Down Expand Up @@ -292,7 +293,7 @@ d('Settings', () => {
}

// now switch to Legacy
await element(by.id('NavigationBack')).tap();
await element(by.id('NavigationBack')).atIndex(0).tap();
await element(by.id('AddressTypePreference')).tap();
await element(by.id('p2pkh')).tap();
await sleep(1000); // We need a second after switching address types.
Expand All @@ -314,7 +315,7 @@ d('Settings', () => {
if (!path2.includes("m/44'/0'/0'")) {
throw new Error(`Wrong path: ${path2}`);
}
await element(by.id('NavigationClose')).tap();
await element(by.id('NavigationClose')).atIndex(0).tap();

// check address on Receiving screen
await element(by.id('Receive')).tap();
Expand All @@ -333,7 +334,7 @@ d('Settings', () => {
await element(by.id('AdvancedSettings')).tap();
await element(by.id('AddressTypePreference')).tap();
await element(by.id('p2wpkh')).tap();
await element(by.id('NavigationClose')).tap();
await element(by.id('NavigationClose')).atIndex(0).tap();
await sleep(1000);
markComplete('settings-7');
});
Expand All @@ -353,18 +354,18 @@ d('Settings', () => {
await element(by.id('RefreshLDK')).tap();
await element(by.id('RestartLDK')).tap();
await element(by.id('RebroadcastLDKTXS')).tap();
await waitFor(element(by.id('NavigationBack')))
await waitFor(element(by.id('NavigationBack')).atIndex(0))
.toBeVisible()
.withTimeout(5000);
await element(by.id('NavigationBack')).tap();
await element(by.id('NavigationBack')).atIndex(0).tap();

await element(by.id('LightningNodeInfo')).tap();
// TODO: this fails too often on CI
// await waitFor(element(by.id('LDKNodeID')))
// .toBeVisible()
// .withTimeout(30000);
await element(by.id('NavigationBack')).tap();
await element(by.id('NavigationBack')).tap();
await element(by.id('NavigationBack')).atIndex(0).tap();
await element(by.id('NavigationBack')).atIndex(0).tap();
if (!__DEV__) {
await element(by.id('DevOptions')).multiTap(5); // disable dev mode
}
Expand All @@ -377,6 +378,11 @@ d('Settings', () => {
return;
}

// skip test on Android since we don't have alert with input
if (device.getPlatform() === 'android') {
return;
}

await element(by.id('Settings')).tap();
await element(by.id('AdvancedSettings')).tap();
await element(by.id('ElectrumConfig')).tap();
Expand Down Expand Up @@ -465,6 +471,11 @@ d('Settings', () => {
return;
}

// FIXME: this test fails on andoid
if (device.getPlatform() === 'android') {
return;
}

await element(by.id('Settings')).tap();
await element(by.id('AdvancedSettings')).tap();
await element(by.id('WebRelay')).tap();
Expand Down Expand Up @@ -540,6 +551,11 @@ d('Settings', () => {
return;
}

// TODO: Biometrics test on Android
if (device.getPlatform() === 'android') {
return;
}

await device.setBiometricEnrollment(true);

await element(by.id('Settings')).tap();
Expand Down

0 comments on commit 0704771

Please sign in to comment.