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

ci: use github actions (#554)



* use github actions

* change version to iphone 8

* rebase to master

* fix rebase deletion

* remove console logs and ignore useless warning

* use eslint unused vars

* up cache

* fix env in actions

* Create install-sccache.ps1

* Create clean-target.sh

* Delete install-sccache.ps1

* Create install-sccache.ps1

* 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 detox settings

* add yarn and npm cache

* small fix cache

* fix sccache

* Update actions.yml

cache PATH package.json

* fix memory out problem

* fix stop sccache

* Update actions.yml

* Update identityManipulation.spec.ts

* install pods and cache it

* add ESLint

* fix release patch settings xcodeworkspace

* eslint on ubuntu-latest

* yarn tools

* update yarn resolution

* make lint happy

* update toolchain

* update node version

* eslint with it installed

* install dependencies

* Update eslint.yml

* rename and split test suites

* tempororay disable build for caching build

* ignore 32 bit architecture in building

* Update actions.yml

* change test build arch

* update package location

* remove travis

* renaming
Co-authored-by: Denis S. Soldatov aka General-Beck's avatarDenis S. Soldatov aka General-Beck <general.beck@gmail.com>
parent 67fd659d
Pipeline #89415 failed with stages
in 4 minutes and 4 seconds
name: E2E & Rust Unit
on:
pull_request:
push:
branches:
- master
- stable
jobs:
check:
name: Check
runs-on: macos-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
with:
fetch-depth: 50
- name: Checkout submodules
shell: bash
run: git submodule update --init --recursive
- name: Install 1.41.1 toolchain
uses: actions-rs/toolchain@v1.0.5
with:
toolchain: 1.41.1
profile: minimal
override: true
- name: Add target x86_64-apple-ios
uses: actions-rs/toolchain@v1.0.5
with:
toolchain: 1.41.1
target: x86_64-apple-ios
- name: Cache cargo registry
uses: actions/cache@v1.1.2
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v1.1.2
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v1.1.2
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Cache sccache MacOS
uses: actions/cache@v1.1.2
with:
path: "/Users/runner/Library/Caches/Mozilla.sccache"
key: ${{ runner.os }}-sccache-build-tests-${{ hashFiles('**/Cargo.lock') }}
- name: Install sccache for MacOS
shell: pwsh
run: pwsh scripts/actions/install-sccache.ps1 ${{ runner.os}}
- name: Install NodeJS
uses: actions/setup-node@v1
with:
node-version: '13.x'
- name: Cache Npm
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Yarn
uses: actions/cache@v1
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Cache Pods
uses: actions/cache@v1
with:
path: ios/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Install dependencies
run: |
brew tap wix/brew
brew install applesimutils
npm install -g yarn
npm install -g react-native-cli
npm install -g detox-cli
gem install xcpretty
yarn
- name: Build CocoaPods
run: cd ios && pod install && cd ..
- name: Build targets
run: |
cd rust/signer
cargo build --target x86_64-apple-ios --release --no-default-features
lipo -create -output libsigner.a ./target/x86_64-apple-ios/release/libsigner.a
- name: Rust Unit Test
run: yarn test-rust
- name: Stop sccache
if: always()
run: sccache --stop-server
- name: Detox biuld
run: yarn build-e2e:ci
- name: Detox test
run: yarn test-e2e:ci
name: Lint & Unit Test
on:
pull_request:
push:
branches:
- master
- stable
jobs:
check:
name: Yarn
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
with:
fetch-depth: 50
- name: Checkout submodules
shell: bash
run: git submodule update --init --recursive
- name: Install NodeJS
uses: actions/setup-node@v1
with:
node-version: '13.x'
- name: Cache Npm
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Yarn
uses: actions/cache@v1
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: |
npm install -g yarn
yarn
- name: Lint
run: yarn lint
- name: Unit Test
run: yarn unit
- name: Type checking
run: yarn tsc
---
language: node_js
node_js: 10
cache:
directories:
- node_modules
install:
- yarn
script:
- yarn run lint
- yarn run unit
# TODO complete following part to Integrate E2E test
#matrix:
# include:
# - language: objective-c
# osx_image: xcode10.3
#
# branches:
# only:
# - master
#
# cache:
# directories:
# - node_modules
#
# install:
# - brew tap wix/brew
# - brew install applesimutils
# - curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
# - export NVM_DIR="$HOME/.nvm" && [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
# - nvm install 8
# - nvm use 8
# - nvm alias default 8
# - npm install -g yarn
# - npm install -g react-native-cli
# - npm install -g detox-cli
# - gem install xcpretty
# - yarn
#
# script:
# - detox build -c ios.sim.release
# - detox test -c ios.sim.release
#
# - language: android
## env:
## - REACT_NATIVE_VERSION=0.60.5
# android:
# components:
# - tools
# - platform-tools
# - build-tools-28.0.3
# - android-28
# - extra-google-google_play_services
# - extra-google-m2repository
# - extra-android-m2repository
## - sys-img-x86-android-26
# - sys-img-x86-android-28
#
# cache:
# directories:
# - node_modules
#
# install:
# - curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
# - export NVM_DIR="$HOME/.nvm" && [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
# - nvm install 8
# - nvm use 8
# - nvm alias default 8
# - npm install -g yarn
# - npm install -g react-native-cli
# - npm install -g detox-cli
# - yes | sdkmanager "build-tools;28.0.3"
# - yarn
#
# script:
# - detox build -c android.emu.release
# - detox test -c android.emu.release
#
# - language: node_js
# node_js: 8
#
# cache:
# directories:
# - node_modules
#
# install:
# - yarn
#
# script:
# - yarn run lint
# - yarn run test
......@@ -98,6 +98,7 @@
00E356F21AD99517003FC87E /* NativeSignerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NativeSignerTests.m; sourceTree = "<group>"; };
020454D0D3C74A398EC7F440 /* Roboto-Thin.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "Roboto-Thin.ttf"; path = "../res/fonts/Roboto-Thin.ttf"; sourceTree = "<group>"; };
0A3530DA239B43579EF02112 /* Roboto-BoldItalic.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "Roboto-BoldItalic.ttf"; path = "../res/fonts/Roboto-BoldItalic.ttf"; sourceTree = "<group>"; };
0AA4DB90D1567F2A67D76C03 /* Pods-NativeSignerTests.githubactions.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NativeSignerTests.githubactions.xcconfig"; path = "Target Support Files/Pods-NativeSignerTests/Pods-NativeSignerTests.githubactions.xcconfig"; sourceTree = "<group>"; };
13B07F961A680F5B00A75B9A /* NativeSigner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NativeSigner.app; sourceTree = BUILT_PRODUCTS_DIR; };
13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = NativeSigner/AppDelegate.h; sourceTree = "<group>"; };
13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = NativeSigner/AppDelegate.m; sourceTree = "<group>"; };
......@@ -114,6 +115,7 @@
1F426F9B208D358500CA43DB /* NativeSigner-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NativeSigner-Bridging-Header.h"; path = "NativeSigner/NativeSigner-Bridging-Header.h"; sourceTree = "<group>"; };
1F7FFA3B208B691700FF717A /* libresolv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libresolv.tbd; path = usr/lib/libresolv.tbd; sourceTree = SDKROOT; };
20F1F05FC5284C6035A69A81 /* Pods-NativeSignerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NativeSignerTests.debug.xcconfig"; path = "Target Support Files/Pods-NativeSignerTests/Pods-NativeSignerTests.debug.xcconfig"; sourceTree = "<group>"; };
21D34EA2E76B31A77F8F1EED /* Pods-NativeSigner.githubactions.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NativeSigner.githubactions.xcconfig"; path = "Target Support Files/Pods-NativeSigner/Pods-NativeSigner.githubactions.xcconfig"; sourceTree = "<group>"; };
2D0EA96B71FC4AFF8C35B80E /* Feather.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Feather.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Feather.ttf"; sourceTree = "<group>"; };
2EC5DDFE054D4A68B1B7D900 /* Manifold-CF.otf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "Manifold-CF.otf"; path = "../res/fonts/Manifold-CF.otf"; sourceTree = "<group>"; };
31AAF2CB51C04377BFC79634 /* Manifold-CF-Light.otf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "Manifold-CF-Light.otf"; path = "../res/fonts/Manifold-CF-Light.otf"; sourceTree = "<group>"; };
......@@ -349,6 +351,8 @@
A65CCA1E762F964F4F4ECF79 /* Pods-NativeSigner.release.xcconfig */,
20F1F05FC5284C6035A69A81 /* Pods-NativeSignerTests.debug.xcconfig */,
ACD155787D878DAB195A49CF /* Pods-NativeSignerTests.release.xcconfig */,
21D34EA2E76B31A77F8F1EED /* Pods-NativeSigner.githubactions.xcconfig */,
0AA4DB90D1567F2A67D76C03 /* Pods-NativeSignerTests.githubactions.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
......@@ -840,6 +844,115 @@
};
name = Release;
};
678810072450B99B00838601 /* GithubActions */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_VERSION = 5.0;
VALIDATE_PRODUCT = YES;
VALID_ARCHS = x86_64;
};
name = GithubActions;
};
678810082450B99B00838601 /* GithubActions */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 21D34EA2E76B31A77F8F1EED /* Pods-NativeSigner.githubactions.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = P2PX3JU8FT;
ENABLE_BITCODE = NO;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-camera/ios",
"$(SRCROOT)/../rust/signer",
"${PODS_ROOT}/",
);
INFOPLIST_FILE = NativeSigner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"${PODS_ROOT}/",
"$(SRCROOT)/../rust/signer",
);
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
"-lc++",
);
PRODUCT_BUNDLE_IDENTIFIER = io.parity.NativeSigner;
PRODUCT_NAME = NativeSigner;
SWIFT_OBJC_BRIDGING_HEADER = "NativeSigner/NativeSigner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 1;
VALID_ARCHS = x86_64;
VERSIONING_SYSTEM = "apple-generic";
};
name = GithubActions;
};
678810092450B99B00838601 /* GithubActions */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 0AA4DB90D1567F2A67D76C03 /* Pods-NativeSignerTests.githubactions.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
COPY_PHASE_STRIP = NO;
DEVELOPMENT_TEAM = P2PX3JU8FT;
INFOPLIST_FILE = NativeSignerTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = "$(inherited)";
"OTHER_LDFLAGS[arch=*]" = " -lc++";
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/NativeSigner.app/NativeSigner";
};
name = GithubActions;
};
83CBBA201A601CBA00E9B192 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
......@@ -952,6 +1065,7 @@
buildConfigurations = (
00E356F61AD99517003FC87E /* Debug */,
00E356F71AD99517003FC87E /* Release */,
678810092450B99B00838601 /* GithubActions */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
......@@ -961,6 +1075,7 @@
buildConfigurations = (
13B07F941A680F5B00A75B9A /* Debug */,
13B07F951A680F5B00A75B9A /* Release */,
678810082450B99B00838601 /* GithubActions */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
......@@ -970,6 +1085,7 @@
buildConfigurations = (
83CBBA201A601CBA00E9B192 /* Debug */,
83CBBA211A601CBA00E9B192 /* Release */,
678810072450B99B00838601 /* GithubActions */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
......
......@@ -17,6 +17,7 @@
"build:android": "yarn install && yarn build-rust:android",
"xcbuild:debug": "xcodebuild -workspace ios/NativeSigner.xcworkspace -scheme NativeSigner -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build/NativeSigner",
"xcbuild:release": "xcodebuild -workspace ios/NativeSigner.xcworkspace -scheme NativeSigner -configuration Release -sdk iphonesimulator -derivedDataPath ios/build/NativeSigner -UseModernBuildSystem=YES | xcpretty -t && exit ${PIPESTATUS[0]}",
"xcbuild:githubActions": "xcodebuild -workspace ios/NativeSigner.xcworkspace -scheme NativeSigner -configuration GithubActions -sdk iphonesimulator -derivedDataPath ios/build/NativeSigner -UseModernBuildSystem=YES | xcpretty -t && exit ${PIPESTATUS[0]}",
"clean": "watchman watch-del-all && rm -rf /tmp/metro-bundler-cache-* && rm -rf /tmp/haste-map-react-native-packager-* && rm -rf node_modules/ && yarn cache clean --force && rm -rf ./android/app/build && rm -rf ./ios/build && yarn clean-rust && (cd ios && pod deintegrate)",
"clean-rust": "(cd rust/signer && cargo clean)",
"commit": "commit-wizard",
......@@ -31,7 +32,9 @@
"test-e2e:android": "detox test -c android.emu.debug -l info --noStackTrace",
"e2e:android": "yarn run build-e2e:android && yarn run test-e2e:android",
"build-e2e:ios": "detox build -c ios.sim.debug -l info",
"build-e2e:ci": "detox build -c ios.sim.release -l info",
"test-e2e:ios": "detox test -c ios.sim.debug -l info --noStackTrace",
"test-e2e:ci": "detox test -c ios.sim.release -l info --noStackTrace --cleanup",
"e2e:ios": "yarn run build-e2e:ios && yarn run test-e2e:ios",
"e2e": "yarn e2e:ios && yarn e2e:android"
},
......@@ -126,11 +129,12 @@
}
},
"ios.sim.release": {
"binaryPath": "ios/build/NativeSigner/Build/Products/Release-iphonesimulator/NativeSigner.app",
"build": "yarn xcbuild:release",
"binaryPath": "ios/build/NativeSigner/Build/Products/GithubActions-iphonesimulator/NativeSigner.app",
"build": "yarn xcbuild:githubActions",
"type": "ios.simulator",
"device": {
"type": "iPhone SE"
"os": "iOS 13.3",
"type": "iPhone 8"
}
},
"android.emu.debug": {
......
#!/bin/bash
set -e # fail on any error
set -u # treat unset variables as error
find ./target/release -maxdepth 1 -type f -delete;
rm -fr ./target/release/{deps,.fingerprint}/*{parity,ethcore,ethkey,ethstore,parity-evm}*;
rm -f ./target/.rustc_info.json;
#!/usr/bin/env pwsh
$os=$args[0]
$SCCACHE_CACHE_SIZE="1G"
$SCCACHE_IDLE_TIMEOUT=0
$version="0.2.12"
echo "Current OS:" $os
switch ($os){
"macOS" {$platform = "x86_64-apple-darwin"}
"Linux" {$platform = "x86_64-unknown-linux-musl"}
"Windows" {$platform ="x86_64-pc-windows-msvc"}
}
echo "Target arch: " $platform
$basename = "sccache-$version-$platform"
$url = "https://github.com/mozilla/sccache/releases/download/"+"$version/$basename.tar.gz"
echo "Download sccache from "+$url
curl -LO $url
tar -xzvf "$basename.tar.gz"
ls $basename/
. $basename/sccache --start-server
echo "::add-path::$(pwd)/$basename"
echo "::set-env name=RUSTC_WRAPPER::sccache"
......@@ -30,7 +30,10 @@ import {
testSetUpDefaultPath,
pinCode
} from 'e2e/utils';
import { EthereumNetworkKeys } from 'constants/networkSpecs';
import {
ETHEREUM_NETWORK_LIST,
EthereumNetworkKeys
} from 'constants/networkSpecs';
const {
AccountNetworkChooser,
......@@ -45,6 +48,8 @@ const {
const defaultPath = '//default';
const customPath = '//sunny_day/1';
const ethereumButtonIndex =
ETHEREUM_NETWORK_LIST[EthereumNetworkKeys.FRONTIER].ethereumChainId;
describe('Load test', () => {
it('create a new identity with default substrate account', async () => {
......@@ -106,13 +111,15 @@ describe('Load test', () => {
it('is able to delete it', async () => {
//'1' is frontier network chainId defined in networkSpecs.ts
await testTap(AccountNetworkChooser.networkButton + 1);
await testTap(AccountNetworkChooser.networkButton + ethereumButtonIndex);
await testVisible(PathDetail.screen);
await testTap(PathDetail.popupMenuButton);
await testTap(PathDetail.deleteButton);
await element(by.text('Delete')).tap();
await testUnlockPin(pinCode);
await testNotExist(AccountNetworkChooser.networkButton + 1);
await testNotExist(
AccountNetworkChooser.networkButton + ethereumButtonIndex
);
});
it('delete identity', async () => {
......
......@@ -17,6 +17,12 @@
import { expect, element, by, device } from 'detox';
import testIDs from './testIDs';
import {
SUBSTRATE_NETWORK_LIST,
SubstrateNetworkKeys
} from 'constants/networkSpecs';
const {
IdentityPin,
IdentityNew,
......@@ -30,7 +36,8 @@ export const mockSeedPhrase =
'ability cave solid soccer gloom thought response hard around minor want welcome';
export const pinCode = '000000';
const substrateNetworkButtonIndex =
AccountNetworkChooser.networkButton + 'kusama';
AccountNetworkChooser.networkButton +
SUBSTRATE_NETWORK_LIST[SubstrateNetworkKeys.KUSAMA].pathId;
export const testTap = async (buttonId: string): Promise<Detox.Actions<any>> =>
await element(by.id(buttonId)).tap();
......
......@@ -1529,7 +1529,7 @@
dependencies:
"@typescript-eslint/eslint-plugin" "^1.5.0"
"@typescript-eslint/parser" "^1.5.0"
babel-eslint "10.0.1"
babel-eslint "10.0.3"
eslint-plugin-eslint-comments "^3.1.1"
eslint-plugin-flowtype "2.50.3"
eslint-plugin-jest "22.4.1"
......@@ -2238,7 +2238,7 @@ babel-code-frame@^6.26.0:
esutils "^2.0.2"
js-tokens "^3.0.2"
babel-eslint@10.0.1, babel-eslint@10.0.3:
babel-eslint@10.0.3:
version "10.0.3"
resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.0.3.tgz#81a2c669be0f205e19462fed2482d33e4687a88a"
integrity sha512-z3U7eMY6r/3f3/JB9mTsLjyxrv0Yb1zb8PCWCLpguxfCzBIZUwy23R1t/XKewP+8mEN2Ck8Dtr4q20z6ce6SoA==
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment