forked from zingolabs/zingo-mobile
-
Notifications
You must be signed in to change notification settings - Fork 1
/
change_custom_testnet_server.test.js
60 lines (47 loc) · 2.9 KB
/
change_custom_testnet_server.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
const { log, by, element } = require('detox');
import { loadTestWallet } from "./e2e-utils/loadTestWallet.js";
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
describe('Change the Server.', () => {
// i just pulled this seed out of thin air
it('loads a wallet', async () => await loadTestWallet());
it('Go settings & change to a correct Testnet server URI.', async () => {
//await sleep(4000);
// go to setting modal screen
await waitFor(element(by.id('header.drawmenu'))).toBeVisible().withTimeout(sync_timeout);
await element(by.id('header.drawmenu')).tap();
await waitFor(element(by.id('menu.settings'))).toBeVisible().withTimeout(sync_timeout);
await element(by.id('menu.settings')).tap();
// waiting for custom server radio button
await waitFor(element(by.id('settings.scroll-view'))).toBeVisible().withTimeout(sync_timeout);
await waitFor(element(by.id('settings.securitytitle'))).toBeVisible()
.whileElement(by.id('settings.scroll-view')).scroll(200, 'down');
// choose the custom server
await waitFor(element(by.id('settings.custom-server'))).toBeVisible().withTimeout(sync_timeout);
await element(by.id('settings.custom-server')).tap();
// waiting for the custom server field
await waitFor(element(by.id('settings.custom-server-field'))).toBeVisible()
.whileElement(by.id('settings.scroll-view')).scroll(100, 'down');
await element(by.id("settings.custom-server-field")).replaceText('https://testnet.zec.rocks:443');
// waiting for the toggle, tap on testnet
await waitFor(element(by.id('settings.custom-server-chain.testnet'))).toBeVisible()
.whileElement(by.id('settings.scroll-view')).scroll(100, 'down');
await element(by.id('settings.custom-server-chain.testnet')).tap();
// save the new testnet server
await waitFor(element(by.id('settings.button.save'))).toBeVisible().withTimeout(sync_timeout);
await element(by.id('settings.button.save')).tap();
// waiting for seed server change screen
await waitFor(element(by.id('seed.button.ok'))).toBeVisible().withTimeout(sync_timeout);
await element(by.id('seed.button.ok')).tap();
await waitFor(element(by.text('CONFIRM'))).toBeVisible().withTimeout(sync_timeout);
await element(by.text('CONFIRM')).tap();
// restart the App with the new testnet server, without any wallet.
// create a new wallet in testnet
await waitFor(element(by.id('loadingapp.createnewwallet'))).toBeVisible().withTimeout(sync_timeout);
await element(by.id('loadingapp.createnewwallet')).tap();
// click the button accepting the new testnet seed
await waitFor(element(by.id('seed.button.ok'))).toBeVisible().withTimeout(sync_timeout);
await element(by.id('seed.button.ok')).tap();
// waiting for a testnet new wallet fully synced
await waitFor(element(by.id('header.checkicon'))).toBeVisible().withTimeout(sync_timeout);
});
});