Skip to content

Commit

Permalink
fix: android tests
Browse files Browse the repository at this point in the history
  • Loading branch information
limpbrains committed Mar 15, 2024
1 parent 3ba5659 commit 2fa8da3
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 15 deletions.
2 changes: 1 addition & 1 deletion e2e/backup.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ d('Backup', () => {
await element(by.id('TagInput')).replaceText(tag);
await element(by.id('TagInput')).tapReturnKey();
await sleep(1000); // animation
await element(by.id('NavigationClose')).tap();
await element(by.id('NavigationClose')).atIndex(0).tap();

// change currency to GBP
await element(by.id('TotalBalance')).tap(); // switch to local currency
Expand Down
2 changes: 1 addition & 1 deletion e2e/numberpad.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ d('NumberPad', () => {
await element(by.id('GeneralSettings')).tap();
await element(by.id('UnitSettings')).tap();
await element(by.id('DenominationClassic')).tap();
await element(by.id('NavigationClose')).tap();
await element(by.id('NavigationClose')).atIndex(0).tap();

await element(by.id('Receive')).tap();
if (await isVisible('UnderstoodButton')) {
Expand Down
6 changes: 6 additions & 0 deletions e2e/security.e2e.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import BitcoinJsonRpc from 'bitcoin-json-rpc';
import { device } from 'detox';

import {
sleep,
Expand Down Expand Up @@ -56,6 +57,11 @@ d('Settings Security And Privacy', () => {
return;
}

// skip test on Android we don't support bitometrics there
if (device.getPlatform() === 'android') {
return;
}

await device.setBiometricEnrollment(true);

await element(by.id('Settings')).tap();
Expand Down
32 changes: 19 additions & 13 deletions e2e/settings.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ d('Settings', () => {
// switch back to sats
await element(by.id('TotalBalance')).tap();

// switch to USD
await element(by.id('Settings')).tap();
await element(by.id('GeneralSettings')).tap();
await element(by.id('CurrenciesSettings')).tap();
await element(by.text('USD ($)')).tap();

markComplete('settings-currency');
});

Expand All @@ -94,33 +100,33 @@ d('Settings', () => {
// check default unit
await expect(unitRow).toHaveText('Bitcoin');

// switch to GBP
// switch to USD
await element(by.id('UnitSettings')).tap();
await element(by.id('GBP')).tap();
await element(by.id('NavigationBack')).tap();
await expect(unitRow).toHaveText('GBP');
await element(by.id('NavigationClose')).tap();
await expect(fiatSymbol).toHaveText('£');
await element(by.id('USD')).tap();
await element(by.id('NavigationBack')).atIndex(0).tap();
await expect(unitRow).toHaveText('USD');
await element(by.id('NavigationClose')).atIndex(0).tap();
await expect(fiatSymbol).toHaveText('$');
await expect(balance).toHaveText('0.00');

// switch back to BTC
await element(by.id('Settings')).tap();
await element(by.id('GeneralSettings')).tap();
await element(by.id('UnitSettings')).tap();
await element(by.id('Bitcoin')).tap();
await element(by.id('NavigationBack')).tap();
await element(by.id('NavigationBack')).atIndex(0).tap();
await expect(unitRow).toHaveText('Bitcoin');
await element(by.id('NavigationClose')).tap();
await element(by.id('NavigationClose')).atIndex(0).tap();
await expect(balance).toHaveText('0');

// switch to classic denomination
await element(by.id('Settings')).tap();
await element(by.id('GeneralSettings')).tap();
await element(by.id('UnitSettings')).tap();
await element(by.id('DenominationClassic')).tap();
await element(by.id('NavigationBack')).tap();
await element(by.id('NavigationBack')).atIndex(0).tap();
await expect(unitRow).toHaveText('Bitcoin');
await element(by.id('NavigationClose')).tap();
await element(by.id('NavigationClose')).atIndex(0).tap();
await expect(balance).toHaveText('0.00000000');

markComplete('settings-unit');
Expand Down Expand Up @@ -242,7 +248,7 @@ d('Settings', () => {
await element(by.id('Settings')).tap();
await element(by.id('SecuritySettings')).tap();
await element(by.id('SwipeBalanceToHide')).tap();
await element(by.id('NavigationClose')).tap();
await element(by.id('NavigationClose')).atIndex(0).tap();

// Balance should be visible
await expect(element(by.id('ShowBalance'))).not.toBeVisible();
Expand Down Expand Up @@ -416,7 +422,7 @@ d('Settings', () => {
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
Expand Down Expand Up @@ -673,7 +679,7 @@ d('Settings', () => {
await expect(element(by.id('Status-lightning_connection'))).toBeVisible();
await expect(element(by.id('Status-full_backup'))).toBeVisible();

await element(by.id('NavigationClose')).tap();
await element(by.id('NavigationClose')).atIndex(0).tap();

markComplete('settings-support-status');
});
Expand Down

0 comments on commit 2fa8da3

Please sign in to comment.