Unverified Commit cad3e74e authored by Hanwen Cheng's avatar Hanwen Cheng Committed by GitHub
Browse files

test: add e2e signing and ethereum tests (#549)

* rebase to master

* fix rebase deletion

* remove console logs and ignore useless warning

* use eslint unused vars

* add ethereum signing test

* re-arrange e2e and unit configs, use common jest config

* update .gitignore

* fix configs

* fix android bug and upgrade detox

* rename unit test scripts

* update docs with yarn unit

* remove debug logs

* update test config
parent e1785af7
Pipeline #81759 failed with stages
in 3 minutes and 47 seconds
......@@ -3,7 +3,6 @@ const commonRules = {
"comma-dangle": ["error", "never"],
"object-curly-spacing": ["error", "always"],
"quotes": ["error", "single", { "avoidEscape": true }],
"no-unused-vars": ["error", { "args": "none" }],
"react-native/no-inline-styles": "off",
"sort-keys": ["error", "asc", {"caseSensitive": true, "natural": false, "minKeys": 2}],
"import/order": ["error", {
......@@ -22,7 +21,7 @@ module.exports = {
globals: { inTest: "writable" },
overrides: [
{
files: ["e2e/*.spec.js", "e2e/init.js", "e2e/e2eUtils.js"],
files: ["e2e/*.spec.js", "e2e/init.js", "e2e/utils.js"],
rules: {
"no-undef": "off"
}
......@@ -83,5 +82,8 @@ module.exports = {
"version": "16.9.0", // React version, default to the latest React stable release
},
},
rules: commonRules
rules: {
...commonRules,
"no-unused-vars": ["error", { "args": "none" }],
}
};
......@@ -5,7 +5,7 @@ package-lock.json
dist/
# jest cache
.jest/cache
test/.jest/
# NDK
NDK/
......@@ -52,6 +52,7 @@ build/
local.properties
*.iml
gen/
*.hprof
# node.js
#
......
......@@ -11,7 +11,7 @@ install:
script:
- yarn run lint
- yarn run test
- yarn run unit
# TODO complete following part to Integrate E2E test
......
......@@ -119,12 +119,12 @@ Corresponding data:
#### Unit Test
Run `yarn test` for all the units test.
Run `yarn unit` for all the units test.
If debugging is needed:
1. Insert `debugger;` in the code where you think it fails.
2. Run `yarn test:debug`
2. Run `yarn unit:debug`
3. Open a new tab in Chrome and go to `chrome://inspect`
4. Click the `inspect` button of target under `Remote Target`
5. Back to the terminal, choose one of the node watch commands to run the tests again.
......
......@@ -23,7 +23,7 @@ module.exports = {
alias: {
components: './src/components',
constants: './src/constants',
e2e: './e2e',
e2e: './test/e2e',
res: './res',
screens: './src/screens',
stores: './src/stores',
......
{
"setupFilesAfterEnv": ["./init.ts"],
"testEnvironment": "node",
"reporters": ["detox/runners/jest/streamlineReporter"],
"verbose": true
}
......@@ -1491,7 +1491,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh\n";
shellScript = "export NODE_BINARY=node\nexport NODE_OPTIONS=\"--max_old_space_size=8192\"\n../node_modules/react-native/scripts/react-native-xcode.sh\n";
};
/* End PBXShellScriptBuildPhase section */
......
This diff is collapsed.
......@@ -20,8 +20,8 @@
"lint:fix": "npx eslint . --ext .js,.jsx,.ts,.tsx --fix --ignore-path .gitignore",
"postinstall": "npx jetify && chmod +x ./scripts/fix-rn-camera-path.sh && ./scripts/fix-rn-camera-path.sh ./node_modules/react-native-camera/ios/RNCamera.xcodeproj/project.pbxproj",
"start": "NODE_OPTIONS=--max_old_space_size=8192 react-native start",
"test": "jest",
"test:debug": "node --inspect node_modules/.bin/jest --watch --runInBand",
"unit": "jest --config ./test/unit/jest.config.js",
"unit:debug": "node --inspect node_modules/.bin/jest --watch --runInBand",
"test-rust": "cd ./rust/signer && cargo test && cd ../..",
"build-e2e:android": "detox build -c android.emu.debug -l info",
"test-e2e:android": "detox test -c android.emu.debug -l info --noStackTrace",
......@@ -83,13 +83,13 @@
"@types/jest": "^25.1.3",
"@types/react": "^16.9.19",
"@types/react-native": "^0.61.10",
"@typescript-eslint/eslint-plugin": "^2.15.0",
"@typescript-eslint/eslint-plugin": "^2.20.0",
"@typescript-eslint/parser": "^2.15.0",
"babel-eslint": "10.0.3",
"babel-jest": "^25.1.0",
"babel-plugin-module-resolver": "^4.0.0",
"babel-plugin-rewrite-require": "^1.14.5",
"detox": "^14.7.0",
"detox": "^15.4.2",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.2.0",
"eslint-import-resolver-typescript": "^2.0.0",
......@@ -124,7 +124,7 @@
},
"ios.sim.release": {
"binaryPath": "ios/build/NativeSigner/Build/Products/Release-iphonesimulator/NativeSigner.app",
"build": "xcodebuild -project ios/NativeSigner.xcodeproj -scheme NativeSigner -configuration Release -sdk iphonesimulator -derivedDataPath ios/build/NativeSigner -UseModernBuildSystem=NO | xcpretty -t && exit ${PIPESTATUS[0]}",
"build": "xcodebuild -project ios/NativeSigner.xcodeproj -scheme NativeSigner -configuration Release -sdk iphonesimulator -derivedDataPath ios/build/NativeSigner -UseModernBuildSystem=YES | xcpretty -t && exit ${PIPESTATUS[0]}",
"type": "ios.simulator",
"device": {
"type": "iPhone SE"
......@@ -147,7 +147,7 @@
}
}
},
"runner-config": "e2e/config.json",
"runner-config": "test/e2e/jest.config.js",
"test-runner": "jest"
}
}
......@@ -17,7 +17,7 @@
import '../shim';
import * as React from 'react';
import { Platform, StatusBar, View, YellowBox } from 'react-native';
import { StatusBar, View, YellowBox } from 'react-native';
import {
createAppContainer,
createSwitchNavigator,
......@@ -67,38 +67,18 @@ import TermsAndConditions from 'screens/TermsAndConditions';
import TxDetails from 'screens/TxDetails';
import LegacyNetworkChooser from 'screens/LegacyNetworkChooser';
import testIDs from 'e2e/testIDs';
import { AppProps, getLaunchArgs } from 'e2e/injections';
const getLaunchArgs = (props: Props): void => {
if (Platform.OS === 'ios') {
if (
Array.isArray(props.launchArgs) &&
props.launchArgs.includes('-detoxServer')
) {
global.inTest = true;
return;
}
} else {
if (props.launchArgs && props.launchArgs.hasOwnProperty('detoxServer')) {
global.inTest = true;
return;
}
}
global.inTest = false;
};
interface Props {
launchArgs?: Array<string> | object;
}
export default class App<Props> extends React.Component<Props> {
constructor(props: Props) {
export default class App extends React.Component<AppProps> {
constructor(props: AppProps) {
super(props);
getLaunchArgs(props);
if (__DEV__) {
YellowBox.ignoreWarnings([
'Warning: componentWillReceiveProps',
'Warning: componentWillMount',
'Warning: componentWillUpdate'
'Warning: componentWillUpdate',
'Warning: Sending `onAnimatedValueUpdate`'
]);
}
}
......
......@@ -50,7 +50,7 @@ import {
NetworkParams,
SubstrateNetworkParams,
isSubstrateNetworkParams,
EthereumNetworkParams
isEthereumNetworkParams
} from 'types/networkSpecsTypes';
import { NavigationAccountProps } from 'types/props';
......@@ -258,21 +258,24 @@ function AccountNetworkChooser({
<View style={styles.body}>
{renderScreenHeading()}
<ScrollView testID={testIDs.AccountNetworkChooser.chooserScreen}>
{networkList.map(([networkKey, networkParams]) => (
<NetworkCard
key={networkKey}
testID={
testIDs.AccountNetworkChooser.networkButton +
(networkParams as SubstrateNetworkParams).pathId ||
(networkParams as EthereumNetworkParams).ethereumChainId
}
networkKey={networkKey}
onPress={(): Promise<void> =>
onNetworkChosen(networkKey, networkParams)
}
title={networkParams.title}
/>
))}
{networkList.map(([networkKey, networkParams]) => {
const networkIndexSuffix = isEthereumNetworkParams(networkParams)
? networkParams.ethereumChainId
: networkParams.pathId;
return (
<NetworkCard
key={networkKey}
testID={
testIDs.AccountNetworkChooser.networkButton + networkIndexSuffix
}
networkKey={networkKey}
onPress={(): Promise<void> =>
onNetworkChosen(networkKey, networkParams)
}
title={networkParams.title}
/>
);
})}
{renderAddButton()}
</ScrollView>
</View>
......
......@@ -20,6 +20,7 @@ import React from 'react';
import { ScrollView, StyleSheet, Text } from 'react-native';
import { Subscribe } from 'unstated';
import testIDs from 'e2e/testIDs';
import { NETWORK_LIST } from 'constants/networkSpecs';
import { FoundAccount } from 'types/identityTypes';
import {
......@@ -150,6 +151,7 @@ export class MessageDetailsView extends React.PureComponent<Props> {
<ScrollView
contentContainerStyle={styles.bodyContent}
style={styles.body}
testID={testIDs.MessageDetails.scrollScreen}
>
<Background />
<Text style={styles.topTitle}>Sign Message</Text>
......@@ -169,6 +171,7 @@ export class MessageDetailsView extends React.PureComponent<Props> {
/>
<Button
buttonStyles={styles.signButton}
testID={testIDs.MessageDetails.signButton}
title="Sign Message"
onPress={(): void => {
isHash ? alertMultipart(onNext) : onNext();
......
......@@ -19,7 +19,7 @@ import { Alert, Button, StyleSheet, Text, View } from 'react-native';
import { RNCamera } from 'react-native-camera';
import { Subscribe } from 'unstated';
import { createMockSignRequest } from 'e2e/mock';
import { onMockBarCodeRead } from 'e2e/injections';
import { NavigationProps, NavigationScannerProps } from 'types/props';
import colors from 'styles/colors';
import fonts from 'styles/fonts';
......@@ -148,8 +148,8 @@ function QrScannerView({
scannerStore,
...props
}: ViewProps): React.ReactElement {
if (global.inTest) {
props.onBarCodeRead(createMockSignRequest());
if (global.inTest && global.scanRequest !== undefined) {
onMockBarCodeRead(global.scanRequest, props.onBarCodeRead);
}
useEffect((): (() => void) => {
......
......@@ -15,8 +15,9 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import React, { useEffect } from 'react';
import { ScrollView, StyleSheet, Text } from 'react-native';
import { ScrollView, StyleSheet, Text, View } from 'react-native';
import testIDs from 'e2e/testIDs';
import { NavigationScannerProps } from 'types/props';
import colors from 'styles/colors';
import QrView from 'components/QrView';
......@@ -42,7 +43,9 @@ function SignedMessage({
return (
<ScrollView style={styles.body}>
<Text style={styles.topTitle}>Signed Message</Text>
<QrView data={data} />
<View testID={testIDs.SignedMessage.qrView}>
<QrView data={data} />
</View>
<MessageDetailsCard
isHash={isHash}
message={message ?? ''}
......
// Copyright 2015-2019 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
/* eslint-disable @typescript-eslint/no-unused-vars */
import { ScanTestRequest } from 'e2e/mockScanRequests';
export {};
/*~ If the app has properties exposed on a global variable,
......@@ -9,6 +27,7 @@ declare global {
namespace NodeJS {
interface Global {
inTest: boolean;
scanRequest?: ScanTestRequest;
}
}
// declare webpack modules
......
......@@ -14,20 +14,42 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import {
SUBSTRATE_NETWORK_LIST,
SubstrateNetworkKeys
} from 'constants/networkSpecs';
import { Platform } from 'react-native';
import { scanRequestDataMap, ScanTestRequest } from 'e2e/mockScanRequests';
import { TxRequestData } from 'types/scannerTypes';
export const signingTestIdentityPath = `//${
SUBSTRATE_NETWORK_LIST[SubstrateNetworkKeys.KUSAMA].pathId
}//default`;
type AndroidAppArgs = {
scanRequest?: number;
};
type iOSAppArgs = Array<string>;
const setRemarkExtrinsicKusama =
'47900000100005301021e169bcc4cdb062f1c85f971be770b6aea1bd32ac1bf7877aa54ccd73309014a20180000010c11111145030000fe030000b0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafeaf2df518f7017e0442a1d01b0f175e0fa5d427470014c1c3ab2131e6250072a70ec';
export interface AppProps {
launchArgs?: AndroidAppArgs | iOSAppArgs;
}
export const createMockSignRequest = (): TxRequestData => ({
export const getLaunchArgs = (props: AppProps): void => {
const { launchArgs } = props;
if (Platform.OS === 'ios') {
if (Array.isArray(launchArgs) && launchArgs.includes('-detoxServer')) {
global.inTest = true;
const argsIndex = launchArgs.indexOf('-scanRequest');
if (argsIndex !== -1)
global.scanRequest = parseInt(launchArgs[argsIndex + 1], 10);
return;
}
} else {
if (launchArgs && launchArgs.hasOwnProperty('detoxServer')) {
global.inTest = true;
global.scanRequest = (launchArgs as AndroidAppArgs)?.scanRequest;
return;
}
}
global.inTest = false;
};
const buildSignRequest = (rawData: string, data = ''): TxRequestData => ({
bounds: {
bounds: [
{ x: '50', y: '50' },
......@@ -36,8 +58,24 @@ export const createMockSignRequest = (): TxRequestData => ({
height: 1440,
width: 1920
},
data: '',
rawData: setRemarkExtrinsicKusama,
data,
rawData,
target: 319,
type: 'qr'
});
export const onMockBarCodeRead = (
txRequest: ScanTestRequest,
onBarCodeRead: (tx: any) => void
): void => {
const scanRequest = scanRequestDataMap[txRequest];
if (typeof scanRequest === 'string') {
onBarCodeRead(buildSignRequest(scanRequest));
} else if (Array.isArray(scanRequest)) {
(scanRequest as string[]).forEach((rawData: string): void => {
onBarCodeRead(buildSignRequest(rawData));
});
} else if (typeof scanRequest === 'object') {
onBarCodeRead(buildSignRequest(scanRequest.rawData, scanRequest.data));
}
};
const commonConfig = require('../jestCommonConfig');
module.exports = {
...commonConfig,
cacheDirectory: '<rootDir>/test/.jest/e2e/cache',
reporters: ['detox/runners/jest/streamlineReporter'],
roots: ['<rootDir>/test/e2e/specs'],
setupFilesAfterEnv: ['<rootDir>/test/e2e/setup.ts']
};
// Copyright 2015-2019 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
export enum ScanTestRequest {
SetRemarkExtrinsic,
TransferExtrinsic,
SetRemarkMultiPart,
EthereumTransaction,
EthereumMessage
}
export const scanRequestDataMap = {
[ScanTestRequest.SetRemarkExtrinsic]:
'47500000100005301025a4a03f84a19cf8ebda40e62358c592870691a9cf456138bb4829969d10fe96910000104116503000015040000b0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe6f3e4192d8a58ee728ed1f2edf28bb7a78bc62a9b112c190aae5f3eb7de6c5af0ec11ec11ec',
[ScanTestRequest.TransferExtrinsic]:
'49800000100005301025a4a03f84a19cf8ebda40e62358c592870691a9cf456138bb4829969d10fe9699c0400ff3c36776005aec2f32a34c109dc791a82edef980eec3be80da938ac9bcc68217202286bee7503000015040000b0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe19d84dae3af90c5c78ff8eaed58b0db1ff8600c4426d4e0969a905ab5fe2d2e50',
[ScanTestRequest.SetRemarkMultiPart]: [
'4040500000200005301025a4a03f84a19cf8ebda40e62358c592870691a9cf456138bb4829969d10fe9695d1100034d113c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d227574662d38223f3e0a3c7376672076657273696f6e3d22312e31222069643d224c617965725f312220786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323030302f7376672220786d6c6e733a786c696e6b3d22687474703a2f2f7777772e77332e6f72672f313939392f786c696e6b2220783d223070782220793d22307078222076696577426f783d223135203135203134302031343022207374796c653d22656e61626c652d6261636b67726f756e643a6e65772030203020313730203137303b2220786d6c3a73706163653d227072657365727665223e0a3c7374796c6520747970653d22746578742f637373223e0a092e6267307b66696c6c3a236666663b7d0a092e7374307b66696c6c3a234536303037413b7d0a3c2f7374796c653e0a3c673e0a093c636972636c6520636c6173733d22626730222063783d223835222063793d2238352220723d223730222f3e0a093c673e0a09093c7061746820643d224d38352c33342e37632d32302e382c302d33372e382c31362e392d33372e382c33372e3863302c342e322c302e372c382e332c322c31322e3363302e392c322e372c332e392c342e322c362e372c332e3363322e372d302e392c342e322d332e392c332e332d362e3720632d312e312d332e312d312e362d362e342d312e352d392e374335382e312c35372e362c36392e352c34362c38332e362c34352e336331352e372d302e382c32382e372c31312e372c32382e372c32372e3263302c31342e352d31312e342c32362e342d32352e372c32372e322063302c302d352e332c302e332d372e392c302e37632d312e332c302e322d322e332c302e342d332c302e35632d302e332c302e312d302e362d302e322d302e352d302e356c302e392d342e344c38312c37332e3463302e362d322e382d312e322d352e362d342d362e3220632d322e382d302e362d352e362c312e322d362e322c3463302c302d31312e382c35352d31312e392c35352e36632d302e362c322e382c312e322c352e362c342c362e3263322e382c302e362c352e362d312e322c362e322d3463302e312d302e362c312e372d372e392c312e372d372e392063312e322d352e362c352e382d392e372c31312e322d31302e3463312e322d302e322c352e392d302e352c352e392d302e356331392e352d312e352c33342e392d31372e382c33342e392d33372e37433132322e382c35312e362c3130352e382c33342e372c38352c33342e377a222f3e0a093c2f673e0a3c2f673e0a3c7061746820636c6173733d227374302220643d224d38372e372c310ec11ec11ec11ec11ec11ec11ec11ec11ec11ec11ec11ec11ec11ec11ec11',
'400c9000002000132312e37632d332e342d302e372d362e382c312e342d372e352c342e39632d302e372c332e342c312e342c362e382c342e392c372e3563332e342c302e372c362e382d312e342c372e352d342e39204339332e332c3132352e372c39312e322c3132322e342c38372e372c3132312e377a222f3e0a3c2f7376673e0ae503000015040000b0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe89a0d893779d38b2c781bd43be252d3d1e1391dc95025d512d7bb878c368907c0ec11ec11ec11ec11ec11ec11'
],
[ScanTestRequest.EthereumTransaction]: {
data:
'{"action":"signTransaction","data":{"account":"311a6D0334141597828999cc89cFeb738d06Fdc2","rlp":"eb808504a817c80082520894486e7833587284ccde66b31144589f92cb16632887038d7ea4c68000802a8080"}}',
rawData:
'400bb7b22616374696f6e223a227369676e5472616e73616374696f6e222c2264617461223a7b226163636f756e74223a2233313161364430333334313431353937383238393939636338396346656237333864303646646332222c22726c70223a2265623830383530346138313763383030383235323038393434383665373833333538373238346363646536366233313134343538396639326362313636333238383730333864376561346336383030303830326138303830227d7d0ec11ec11ec11ec11ec11ec11ec11ec11ec11ec11ec11ec11ec11'
},
[ScanTestRequest.EthereumMessage]: {
data:
'{"action":"signData","data":{"account":"311a6D0334141597828999cc89cFeb738d06Fdc2","data":"426565722069732074686572617079"}}',
rawData:
'47b7b22616374696f6e223a227369676e44617461222c2264617461223a7b226163636f756e74223a2233313161364430333334313431353937383238393939636338396346656237333864303646646332222c2264617461223a22343236353635373232303639373332303734363836353732363137303739227d7d0ec11ec11ec11ec11ec11ec11ec11ec11ec11ec11ec11ec11ec11ec11ec'
}
};
......@@ -14,11 +14,11 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import { init, cleanup } from 'detox';
import { init, cleanup, device } from 'detox';
import adapter from 'detox/runners/jest/adapter';
import specReporter from 'detox/runners/jest/specReporter';
import { detox as config } from '../package.json';
import { detox as config } from '../../package.json';
// Set the default timeout
jest.setTimeout(120000);
......@@ -30,6 +30,10 @@ jasmine.getEnv().addReporter(specReporter);
beforeAll(async () => {
await init(config, { launchApp: false });
if (device.getPlatform() === 'ios') {
await device.clearKeychain();
}
await device.launchApp({ permissions: { camera: 'YES' } });
});
beforeEach(async () => {
......
......@@ -14,21 +14,23 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import { by, device, element } from 'detox';
import { by, element } from 'detox';
import testIDs from './testIDs';
import testIDs from 'e2e/testIDs';
import {
tapBack,
testExist,
testInput,
testInputWithDone,
testNotExist,
testNotVisible,
testScrollAndTap,
testTap,
testUnlockPin,
testVisible
} from './e2eUtils';
testVisible,
testSetUpDefaultPath,
pinCode
} from 'e2e/utils';
import { EthereumNetworkKeys } from 'constants/networkSpecs';
const {
TacScreen,
......@@ -37,45 +39,15 @@ const {
IdentityManagement,
IdentityNew,
IdentityBackup,
IdentityPin,
PathDerivation,
PathDetail,
PathsList,
SecurityHeader,
SignedTx,
TxDetails
PathsList
} = testIDs;
const pinCode = '123456';
const mockIdentityName = 'mockIdentity';
const substrateNetworkButtonIndex = AccountNetworkChooser.networkButton + '2'; //Need change if network list changes
const defaultPath = '//default',
customPath = '//sunny_day/1';
const mockSeedPhrase =
'split cradle example drum veteran swear cruel pizza guilt surface mansion film grant benefit educate marble cargo ignore bind include advance grunt exile grow';
const testSetUpDefaultPath = async (): Promise<void> => {
await testInput(IdentityPin.setPin, pinCode);
await testInputWithDone(IdentityPin.confirmPin, pinCode);
await testVisible(AccountNetworkChooser.chooserScreen);
await testScrollAndTap(
substrateNetworkButtonIndex,
testIDs.AccountNetworkChooser.chooserScreen
);
await testUnlockPin(pinCode);
await testVisible(PathDetail.screen);
await tapBack();
await testExist(PathsList.screen);
};
describe('Load test', async () => {
beforeAll(async () => {
if (device.getPlatform() === 'ios') {
await device.clearKeychain();
}
await device.launchApp({ permissions: { camera: 'YES' } });
});
const defaultPath = '//default';
const customPath = '//sunny_day/1';
describe('Load test', () => {
it('should have account list screen', async () => {
await testVisible(TacScreen.tacView);
await testTap(TacScreen.agreePrivacyButton);
......@@ -84,12 +56,13 @@ describe('Load test', async () => {
await testVisible(AccountNetworkChooser.noAccountScreen);
});
it('recover a identity with seed phrase', async () => {
await testTap(AccountNetworkChooser.recoverButton);
await testVisible(IdentityNew.seedInput);
await testInput(IdentityNew.nameInput, mockIdentityName);
await element(by.id(IdentityNew.seedInput)).typeText(mockSeedPhrase);
await element(by.id(IdentityNew.seedInput)).tapReturnKey();
it('create a new identity with default substrate account', async () => {
await testTap(AccountNetworkChooser.createButton);
await testNotVisible(IdentityNew.seedInput);
await testTap(IdentityNew.createButton);
await testVisible(IdentityBackup.seedText);
await testTap(IdentityBackup.nextButton);
await element(by.text('Proceed')).tap();
await testSetUpDefaultPath();
});