mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2024-11-19 01:40:12 +01:00
CI: refactor some tests
This commit is contained in:
parent
32b7a1166b
commit
583d71efa2
@ -69,7 +69,7 @@
|
||||
"lint": " npm run tslint && node scripts/find-unused-loc.js && eslint --ext .js,.ts,.tsx '*.@(js|ts|tsx)' screen 'blue_modules/*.@(js|ts|tsx)' class models loc tests components navigation typings",
|
||||
"lint:fix": "npm run lint -- --fix",
|
||||
"lint:quickfix": "git status --porcelain | grep -v '\\.json' | grep -E '\\.js|\\.ts' --color=never | awk '{print $2}' | xargs eslint --fix; exit 0",
|
||||
"unit": "jest -b tests/unit/*"
|
||||
"unit": "jest -b -w tests/unit/*"
|
||||
},
|
||||
"jest": {
|
||||
"testEnvironment": "<rootDir>/tests/custom-environment.js",
|
||||
|
@ -16,19 +16,13 @@ import {
|
||||
/**
|
||||
* this testsuite is for test cases that require no wallets to be present
|
||||
*/
|
||||
|
||||
beforeAll(async () => {
|
||||
// reinstalling the app just for any case to clean up app's storage
|
||||
await device.launchApp({ delete: true });
|
||||
}, 300_000);
|
||||
|
||||
describe('BlueWallet UI Tests - no wallets', () => {
|
||||
it('selftest passes', async () => {
|
||||
const lockFile = '/tmp/travislock.' + hashIt('t1');
|
||||
if (process.env.TRAVIS) {
|
||||
if (require('fs').existsSync(lockFile)) return console.warn('skipping', JSON.stringify('t1'), 'as it previously passed on Travis');
|
||||
}
|
||||
await device.launchApp({ newInstance: true });
|
||||
await device.launchApp({ delete: true }); // reinstalling the app just for any case to clean up app's storage
|
||||
await waitFor(element(by.id('WalletsList')))
|
||||
.toBeVisible()
|
||||
.withTimeout(300 * 1000);
|
||||
@ -52,7 +46,7 @@ describe('BlueWallet UI Tests - no wallets', () => {
|
||||
if (process.env.TRAVIS) {
|
||||
if (require('fs').existsSync(lockFile)) return console.warn('skipping', JSON.stringify('t2'), 'as it previously passed on Travis');
|
||||
}
|
||||
await device.launchApp({ newInstance: true });
|
||||
await device.launchApp({ delete: true }); // reinstalling the app just for any case to clean up app's storage
|
||||
await yo('WalletsList');
|
||||
|
||||
// go to settings, press SelfTest and wait for OK
|
||||
@ -190,7 +184,7 @@ describe('BlueWallet UI Tests - no wallets', () => {
|
||||
if (process.env.TRAVIS) {
|
||||
if (require('fs').existsSync(lockFile)) return console.warn('skipping', JSON.stringify('t3'), 'as it previously passed on Travis');
|
||||
}
|
||||
await device.launchApp({ newInstance: true });
|
||||
await device.launchApp({ delete: true }); // reinstalling the app just for any case to clean up app's storage
|
||||
await yo('WalletsList');
|
||||
|
||||
await helperCreateWallet();
|
||||
@ -228,7 +222,7 @@ describe('BlueWallet UI Tests - no wallets', () => {
|
||||
if (process.env.TRAVIS) {
|
||||
if (require('fs').existsSync(lockFile)) return console.warn('skipping', JSON.stringify('t4'), 'as it previously passed on Travis');
|
||||
}
|
||||
await device.launchApp({ newInstance: true });
|
||||
await device.launchApp({ delete: true }); // reinstalling the app just for any case to clean up app's storage
|
||||
await yo('WalletsList');
|
||||
|
||||
// lets create a wallet
|
||||
@ -382,7 +376,7 @@ describe('BlueWallet UI Tests - no wallets', () => {
|
||||
if (process.env.TRAVIS) {
|
||||
if (require('fs').existsSync(lockFile)) return console.warn('skipping', JSON.stringify('t5'), 'as it previously passed on Travis');
|
||||
}
|
||||
await device.launchApp({ newInstance: true });
|
||||
await device.launchApp({ delete: true }); // reinstalling the app just for any case to clean up app's storage
|
||||
await yo('WalletsList');
|
||||
await helperCreateWallet();
|
||||
await element(by.id('SettingsButton')).tap();
|
||||
@ -459,7 +453,7 @@ describe('BlueWallet UI Tests - no wallets', () => {
|
||||
if (process.env.TRAVIS) {
|
||||
if (require('fs').existsSync(lockFile)) return console.warn('skipping as it previously passed on Travis');
|
||||
}
|
||||
await device.launchApp({ newInstance: true });
|
||||
await device.launchApp({ delete: true }); // reinstalling the app just for any case to clean up app's storage
|
||||
await helperSwitchAdvancedMode();
|
||||
await yo('WalletsList');
|
||||
await element(by.id('WalletsList')).swipe('left', 'fast', 1); // in case emu screen is small and it doesnt fit
|
||||
@ -539,7 +533,7 @@ describe('BlueWallet UI Tests - no wallets', () => {
|
||||
if (process.env.TRAVIS) {
|
||||
if (require('fs').existsSync(lockFile)) return console.warn('skipping', JSON.stringify('t6'), 'as it previously passed on Travis');
|
||||
}
|
||||
await device.launchApp({ newInstance: true });
|
||||
await device.launchApp({ delete: true }); // reinstalling the app just for any case to clean up app's storage
|
||||
await yo('WalletsList');
|
||||
await element(by.id('WalletsList')).swipe('left', 'fast', 1); // in case emu screen is small and it doesnt fit
|
||||
await sleep(200); // Wait until bounce animation finishes.
|
||||
@ -670,7 +664,7 @@ describe('BlueWallet UI Tests - no wallets', () => {
|
||||
if (process.env.TRAVIS) {
|
||||
if (require('fs').existsSync(lockFile)) return console.warn('skipping', JSON.stringify('t6'), 'as it previously passed on Travis');
|
||||
}
|
||||
await device.launchApp({ newInstance: true });
|
||||
await device.launchApp({ delete: true }); // reinstalling the app just for any case to clean up app's storage
|
||||
await yo('WalletsList');
|
||||
|
||||
// enable AdvancedMode to see derivation path in wallet details
|
||||
|
@ -3,12 +3,13 @@ import * as bitcoin from 'bitcoinjs-lib';
|
||||
|
||||
import { extractTextFromElementById, hashIt, helperImportWallet, sleep, sup, yo } from './helperz';
|
||||
|
||||
let importedSuccessfully = false;
|
||||
|
||||
/**
|
||||
* in this suite each test requires that there is one specific wallet present, thus, we import it
|
||||
* before anything else.
|
||||
* we dont clean it up as we expect other test suites to do clean install of the app
|
||||
*/
|
||||
|
||||
beforeAll(async () => {
|
||||
if (!process.env.HD_MNEMONIC_BIP84) {
|
||||
console.error('process.env.HD_MNEMONIC_BIP84 not set, skipped');
|
||||
@ -20,6 +21,7 @@ beforeAll(async () => {
|
||||
console.log('before all - importing bip48...');
|
||||
await helperImportWallet(process.env.HD_MNEMONIC_BIP84, 'HDsegwitBech32', 'Imported HD SegWit (BIP84 Bech32 Native)', '0.00105526');
|
||||
console.log('...imported!');
|
||||
importedSuccessfully = true;
|
||||
await device.pressBack();
|
||||
await sleep(15000);
|
||||
}, 1200_000);
|
||||
@ -34,6 +36,8 @@ describe('BlueWallet UI Tests - import BIP84 wallet', () => {
|
||||
console.error('process.env.HD_MNEMONIC_BIP84 not set, skipped');
|
||||
return;
|
||||
}
|
||||
if (!importedSuccessfully) throw new Error('BIP84 was not imported during the setup');
|
||||
|
||||
await device.launchApp({ newInstance: true });
|
||||
|
||||
// go inside the wallet
|
||||
@ -183,6 +187,8 @@ describe('BlueWallet UI Tests - import BIP84 wallet', () => {
|
||||
console.error('process.env.HD_MNEMONIC_BIP84 not set, skipped');
|
||||
return;
|
||||
}
|
||||
if (!importedSuccessfully) throw new Error('BIP84 was not imported during the setup');
|
||||
|
||||
await device.launchApp({ newInstance: true });
|
||||
|
||||
// go inside the wallet
|
||||
@ -256,6 +262,8 @@ describe('BlueWallet UI Tests - import BIP84 wallet', () => {
|
||||
console.error('process.env.HD_MNEMONIC_BIP84 not set, skipped');
|
||||
return;
|
||||
}
|
||||
if (!importedSuccessfully) throw new Error('BIP84 was not imported during the setup');
|
||||
|
||||
await device.launchApp({ newInstance: true });
|
||||
|
||||
// go inside the wallet
|
||||
@ -325,6 +333,8 @@ describe('BlueWallet UI Tests - import BIP84 wallet', () => {
|
||||
console.error('process.env.HD_MNEMONIC_BIP84 not set, skipped');
|
||||
return;
|
||||
}
|
||||
if (!importedSuccessfully) throw new Error('BIP84 was not imported during the setup');
|
||||
|
||||
await device.launchApp({ newInstance: true });
|
||||
|
||||
// go inside the wallet
|
||||
@ -368,6 +378,8 @@ describe('BlueWallet UI Tests - import BIP84 wallet', () => {
|
||||
console.error('process.env.HD_MNEMONIC_BIP84 not set, skipped');
|
||||
return;
|
||||
}
|
||||
if (!importedSuccessfully) throw new Error('BIP84 was not imported during the setup');
|
||||
|
||||
await device.launchApp({ newInstance: true });
|
||||
|
||||
// go inside the wallet
|
||||
@ -417,6 +429,8 @@ describe('BlueWallet UI Tests - import BIP84 wallet', () => {
|
||||
console.error('process.env.HD_MNEMONIC_BIP84 not set, skipped');
|
||||
return;
|
||||
}
|
||||
if (!importedSuccessfully) throw new Error('BIP84 was not imported during the setup');
|
||||
|
||||
await device.launchApp({ newInstance: true });
|
||||
|
||||
await device.launchApp({
|
||||
@ -453,6 +467,8 @@ describe('BlueWallet UI Tests - import BIP84 wallet', () => {
|
||||
console.error('process.env.HD_MNEMONIC_BIP84 not set, skipped');
|
||||
return;
|
||||
}
|
||||
if (!importedSuccessfully) throw new Error('BIP84 was not imported during the setup');
|
||||
|
||||
await device.launchApp({ newInstance: true });
|
||||
// go inside the wallet
|
||||
await element(by.text('Imported HD SegWit (BIP84 Bech32 Native)')).tap();
|
||||
|
Loading…
Reference in New Issue
Block a user