Skip to content

Commit

Permalink
Merge pull request #231 from fluidvanadium/e2e_dry
Browse files Browse the repository at this point in the history
e2e dry
  • Loading branch information
juanky201271 authored Mar 4, 2023
2 parents a0f55cc + 429e009 commit 95649bc
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 37 deletions.
23 changes: 4 additions & 19 deletions e2e/02_preexisting.test.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,12 @@
const { log, device, by, element } = require('detox');

describe('Example', () => {
beforeAll(async () => {
await device.launchApp();
});

beforeEach(async () => {
await device.reloadReactNative();
});
import { loadTestWallet } from "./loadTestWallet.js";

describe('Renders wallet data correctly.', () => {
// i just pulled this seed out of thin air
it('loads my test wallet', async () => {
await element(by.id("loadingapp.restorewalletseed")).tap();
await element(by.id("seed.seedplaceholder")).replaceText(
'lottery multiply patient simple ivory leisure swift square west despair beauty match crowd margin reject box always title photo remind word diet ecology badge'
);
await element(by.id("birthdayinput")).replaceText('1994579');
await element(by.text("RESTORE WALLET")).tap();
});
it('loads my test wallet', loadTestWallet);

// there is a transaction in this plant at 1994580, 1 block after the "birthday".
it('synks 1 block and renders a transaction. this should take less than a minute, but will time out after 16 minutes', async () => {
await waitFor(element(by.id("transactionList.1"))).toBeVisible().withTimeout(1000000)
await waitFor(element(by.id("transactionList.1"))).toBeVisible().withTimeout(sync_timeout)
await element(by.id("transactionList.1")).tap();
// we will test various attributes of this transaction once we testID them
});
Expand Down
3 changes: 0 additions & 3 deletions e2e/03_new_wallet.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
const { log, device, by, element } = require('detox');

describe('Example', () => {
beforeAll(async () => {
await device.launchApp();
});

it('New wallet button works', async () => {
let newWalletButton = element(by.text('CREATE NEW WALLET (NEW SEED)'));
Expand Down
6 changes: 5 additions & 1 deletion e2e/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@
module.exports = {
rootDir: '..',
testMatch: ['<rootDir>/e2e/**/*.test.js'],
testTimeout: 120000,
testTimeout: 1000000,
maxWorkers: 1,
globalSetup: 'detox/runners/jest/globalSetup',
globalTeardown: 'detox/runners/jest/globalTeardown',
reporters: ['detox/runners/jest/reporter'],
testEnvironment: 'detox/runners/jest/testEnvironment',
verbose: true,
globals: {
sync_timeout: 1000000
},
setupFilesAfterEnv: ['<rootDir>/e2e/setup-jest.js']
};
11 changes: 11 additions & 0 deletions e2e/loadTestWallet.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

let loadTestWallet = async () => {
await element(by.id("loadingapp.restorewalletseed")).tap();
await element(by.id("seed.seedplaceholder")).replaceText(
'lottery multiply patient simple ivory leisure swift square west despair beauty match crowd margin reject box always title photo remind word diet ecology badge'
);
await element(by.id("birthdayinput")).replaceText('1994579');
await element(by.text("RESTORE WALLET")).tap();
}

export { loadTestWallet };
19 changes: 5 additions & 14 deletions e2e/new_checkbox_send.test.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
const { log, device, by, element } = require('detox');

describe('Example', () => {
beforeAll(async () => {
await device.launchApp();
});
import { loadTestWallet } from "./loadTestWallet.js";

beforeEach(async () => {
// await device.reloadReactNative();
});

it('Checkbox send screen -> include UA in memo field', async () => {
await element(by.id('loadingapp.restorewalletseed')).tap();
await element(by.id('seed.seedplaceholder')).replaceText(
'lottery multiply patient simple ivory leisure swift square west despair beauty match crowd margin reject box always title photo remind word diet ecology badge',
);
await element(by.id('birthdayinput')).replaceText('1985000');
await element(by.text('RESTORE WALLET')).tap();
describe('Example', () => {

it('loads a test wallet', loadTestWallet);

it('Checkbox send screen -> include UA in memo field', async () => {
await element(by.text('SEND')).tap();
await element(by.id('send.addressplaceholder')).replaceText(
'u1lx7nlnqqqs7p4hcqz4hyjgnw7h8zskcgr2f8dfhm96np0gnfdzu7jtms7q2pxd7ufy96wxzdsdy65jvp3td7fj2ltcz0jpak86ddyszl9ykn5s86q3xataya5867z3tj2x8cw0ljyrenymr2gcqmjf50gmexqj233yn3kdaxn2yukwcx87emurufakf82wapgnu5h3fvae6aw9uus2r',
Expand Down
7 changes: 7 additions & 0 deletions e2e/setup-jest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
beforeAll(async () => {
await device.launchApp();
});

beforeEach(async () => {
await device.reloadReactNative();
});

0 comments on commit 95649bc

Please sign in to comment.