Skip to content
This repository has been archived by the owner on Jun 16, 2022. It is now read-only.

Commit

Permalink
Poc detox (#2211)
Browse files Browse the repository at this point in the history
* Squashed commit of the following:

commit 9cbd84e
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Wed May 4 10:29:58 2022 +0200

    changed to text

commit ed7e441
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Tue May 3 17:53:55 2022 +0200

    fix node step issue

commit 20366c4
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Tue May 3 17:46:08 2022 +0200

    further yarn cache changes

commit 0dc6d71
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Tue May 3 17:29:38 2022 +0200

    making review changes - mostly removing console logs, tidying up comments and fixing workflow issues

commit 0b92a27
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Tue May 3 16:39:23 2022 +0200

    added cron job and merging from develop

commit fcfa9ab
Merge: 0092b61 2c9c363
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Tue May 3 16:38:39 2022 +0200

    Merge branch 'develop' of github.com:LedgerHQ/ledger-live-mobile into poc-detox

commit 0092b61
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Tue May 3 13:53:58 2022 +0200

    merging and reverting confirmation changes

commit 2883d22
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Tue May 3 13:39:45 2022 +0200

    more refactoring

commit 18678f8
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Tue May 3 12:23:59 2022 +0200

    removed some shite

commit af2df7b
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Tue May 3 10:41:41 2022 +0200

    running iOS only in preparation for merge

commit 9af839e
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Mon May 2 20:23:59 2022 +0200

    Trigger Build

commit dd90e9c
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Mon May 2 18:56:33 2022 +0200

    added some sleeps to see if that helps

commit 4137e7c
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Mon May 2 17:27:04 2022 +0200

    fixed wrong config name

commit 9964d83
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Mon May 2 16:42:52 2022 +0200

    trying with android staging ci

commit f0432ad
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Mon May 2 15:24:18 2022 +0200

    Trigger Build

commit 480d9fc
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Mon May 2 13:40:47 2022 +0200

    removing android tests

commit 3f24cff
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Sun May 1 22:00:37 2022 +0200

    trying with android debug

commit 762a5da
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Sun May 1 20:05:29 2022 +0200

    fixing path to bridge for tests

commit 7ff8a54
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Fri Apr 29 19:24:27 2022 +0200

    trying bridge in tests themselves

commit 5ed8b18
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Fri Apr 29 16:16:06 2022 +0200

    adding flags to test

commit 1f0af63
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Fri Apr 29 13:17:07 2022 +0200

    adding lots more screenshots and videos

commit 19dd63a
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Fri Apr 29 11:27:05 2022 +0200

    adding screenshots and test butler

commit a7ef3c6
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Fri Apr 29 10:03:16 2022 +0200

    fixing method name and making both tests run on android

commit 89dd701
Merge: 7f43f75 d178dce
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Fri Apr 29 09:10:53 2022 +0200

    Merge branch 'poc-detox' of github.com:LedgerHQ/ledger-live-mobile into poc-detox

commit 7f43f75
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Fri Apr 29 09:09:33 2022 +0200

    lowering timeout for android

commit 03d2584
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Fri Apr 29 09:08:27 2022 +0200

    removed comments, fixed password test and changed onboarding matcher to text instead of testID

commit d178dce
Author: Nabil Bourenane <nabil.bourenane@icloud.com>
Date:   Thu Apr 28 18:50:00 2022 +0200

    removed forced timezone on device and keep hermes 0.10.0 for now

commit d55f1a2
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Thu Apr 28 18:22:30 2022 +0200

    removed setprop

commit c9aa1a2
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Thu Apr 28 18:10:21 2022 +0200

    adding second test and changed logs to verbose

commit d121087
Merge: 743d332 424ea26
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Thu Apr 28 18:09:05 2022 +0200

    Merge branch 'poc-detox' of github.com:LedgerHQ/ledger-live-mobile into poc-detox

commit 424ea26
Author: Nabil Bourenane <nabil.bourenane@icloud.com>
Date:   Thu Apr 28 17:16:30 2022 +0200

    upgrading hermes-engine to 0.10.0

commit 743d332
Merge: 1f40ece 94464ca
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Thu Apr 28 16:56:37 2022 +0200

    Merge branch 'poc-detox' of github.com:LedgerHQ/ledger-live-mobile into poc-detox

commit 1f40ece
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Thu Apr 28 16:53:13 2022 +0200

    adding UTC timezone

commit 94464ca
Author: Nabil Bourenane <nabil.bourenane@icloud.com>
Date:   Thu Apr 28 16:07:25 2022 +0200

    set timezone on android

commit 13bcadd
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Thu Apr 28 15:44:29 2022 +0200

    add locale try catch

commit ae85cd1
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Thu Apr 28 14:50:36 2022 +0200

    adding logging to timezone and setting timezone to Europe/Paris

commit 8f8ef3c
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Thu Apr 28 11:18:24 2022 +0200

    updated podfile

commit b85a5d5
Merge: 4ce4a81 d2e1742
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Thu Apr 28 10:07:19 2022 +0200

    Merge branch 'develop' of github.com:LedgerHQ/ledger-live-mobile into poc-detox

commit 4ce4a81
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Wed Apr 27 18:18:38 2022 +0200

    added detox recorder and android/ios specific matchers since testIDs were unavailable

commit 612eeb8
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Wed Apr 27 16:23:22 2022 +0200

    added settings testIds

commit 77f2366
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Tue Apr 26 17:27:09 2022 +0200

    trying to run just one test

commit 8a7634f
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Tue Apr 26 09:42:17 2022 +0200

    adding trace logging and reinstalling app before test run

commit 00fb90e
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Mon Apr 25 17:44:35 2022 +0200

    increasing ram size

commit 17026e0
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Mon Apr 25 17:03:31 2022 +0200

    changed method names

commit 5220b3a
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Mon Apr 25 15:52:27 2022 +0200

    onboarding test should be working

commit 0bd1451
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Mon Apr 25 12:05:45 2022 +0200

    added some new steps to onboarding

commit 4d6fc44
Merge: 70370d8 6477c77
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Fri Apr 22 15:57:01 2022 +0200

    Merge branch 'develop' of github.com:LedgerHQ/ledger-live-mobile into poc-detox

commit 70370d8
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Thu Apr 21 15:50:20 2022 +0200

    added git config to detox java file

commit ad7b25b
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Wed Apr 20 17:17:11 2022 +0200

    relogging android goings-on

commit 68b5faf
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Tue Apr 19 17:04:27 2022 +0200

    fixing artifacts path

commit 8b9a386
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Tue Apr 19 14:17:21 2022 +0200

    removing logging in server

commit b3d3bb5
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Tue Apr 19 12:07:38 2022 +0200

    fixing comment

commit ce7d938
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Tue Apr 19 09:54:50 2022 +0200

    adding screenshots back in

commit 2605094
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Fri Apr 15 16:29:56 2022 +0200

    changing to staging

commit 2b7971c
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Fri Apr 15 16:19:40 2022 +0200

    removed force avd install

commit 9213b75
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Fri Apr 15 14:34:28 2022 +0200

    adding console.logs

commit 861001a
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Fri Apr 15 10:30:58 2022 +0200

    adding yarn start

commit 9b6b5ef
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Thu Apr 14 16:43:28 2022 +0200

    removing test butler and adding device object to test setup

commit c8029db
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Thu Apr 14 15:46:47 2022 +0200

    downgrading to API 29

commit 0327446
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Thu Apr 14 14:35:34 2022 +0200

    changing emulator device

commit bc20103
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Thu Apr 14 13:18:58 2022 +0200

    fixing engine bugs

commit ef8ee12
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Thu Apr 14 11:58:00 2022 +0200

    adding in files that were removed in the rebase

commit f7444ec
Author: Gregor Gilchrist <gregor.gilchrist@ledger.fr>
Date:   Tue Mar 29 15:44:43 2022 +0200

    more cache fuckery

    Squashing and rebasing

* updated flaky Let's pair nano step

* changed to lets pair my nano to tapByText

* fixed linting and yarn issues
  • Loading branch information
ggilchrist-ledger authored May 4, 2022
1 parent 60d3a94 commit f72d961
Show file tree
Hide file tree
Showing 37 changed files with 1,799 additions and 722 deletions.
13 changes: 11 additions & 2 deletions .detoxrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"build": "cd android && ENVFILE=.env.mock ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..",
"type": "android.emulator",
"device": {
"avdName": "Nexus_5X_API_29_x86"
"avdName": "Nexus_6_API_30"
}
},
"android.staging": {
Expand All @@ -33,7 +33,16 @@
"build": "cd android && ENVFILE=.env.mock ./gradlew assembleStagingRelease assembleAndroidTest -DtestBuildType=stagingRelease && cd ..",
"type": "android.emulator",
"device": {
"avdName": "Nexus_5X_API_29_x86"
"avdName": "Nexus_6_API_30"
}
},
"android.staging-ci": {
"binaryPath": "android/app/build/outputs/apk/stagingRelease/app-x86-stagingRelease.apk",
"testBinaryPath": "android/app/build/outputs/apk/androidTest/stagingRelease/app-stagingRelease-androidTest.apk",
"build": "cd android && ENVFILE=.env.mock ./gradlew assembleStagingRelease assembleAndroidTest -DtestBuildType=stagingRelease -PwithTestButler --warning-mode all && cd ..",
"type": "android.emulator",
"device": {
"avdName": "Nexus_6_API_30"
}
}
}
Expand Down
77 changes: 77 additions & 0 deletions .github/workflows/detox-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Detox E2E CI

on:
pull_request:
branches:
- "*"
workflow_dispatch:
inputs:
prNumber:
description: pr number to trigger on
required: true
schedule:
- cron: "0 0 * * *"

jobs:
ios:
runs-on: macos-latest
steps:
- name: Checkout PR
uses: actions/checkout@v2
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6 # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically

- name: Install applesimutils
run: |
brew tap wix/brew
brew install applesimutils
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 14
cache: 'yarn'

- name: Has hash commit deps
uses: ledgerhq/actions/packages/has-hash-commit-deps@main
id: has-hash-commit-deps
with:
workspace: ${{ github.workspace }}

- name: Install dependencies without network concurrency
if: ${{ steps.has-hash-commit-deps.outputs.has-hash-commit-deps == 'true' }}
env:
JOBS: max
run: yarn --prefer-offline --frozen-lockfile --network-timeout 100000 --network-concurrency 1

- name: Install dependencies with network concurrency
if: ${{ steps.has-hash-commit-deps.outputs.has-hash-commit-deps == 'false' }}
env:
JOBS: max
run: yarn --prefer-offline --frozen-lockfile --network-timeout 100000

- name: Rebuild detox
run: yarn detox clean-framework-cache && yarn detox build-framework-cache

- name: Build iOS app for Detox test run
env:
NODE_OPTIONS: "--max-old-space-size=7168"
run: yarn e2e:build -c ios.staging

- name: Test iOS app
timeout-minutes: 15
run: yarn e2e:test -c ios.staging --loglevel verbose --record-logs failing --record-timeline all --take-screenshots all --record-videos failing --detectOpenHandles

- name: Upload test artifacts
if: always()
uses: actions/upload-artifact@v2
with:
name: test-ios-artifacts
path: artifacts
12 changes: 6 additions & 6 deletions e2e/engine/bridge/client.js → e2e/bridge/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { Platform } from "react-native";
import invariant from "invariant";
import { Subject } from "rxjs/Subject";
import type { AccountRaw } from "@ledgerhq/live-common/lib/types";
import { store } from "../../../src/context/LedgerStore";
import { importSettings } from "../../../src/actions/settings";
import { setAccounts } from "../../../src/actions/accounts";
import { acceptTerms } from "../../../src/logic/terms";
import accountModel from "../../../src/logic/accountModel";
import { navigate } from "../../../src/rootnavigation";
import { store } from "../../src/context/LedgerStore";
import { importSettings } from "../../src/actions/settings";
import { setAccounts } from "../../src/actions/accounts";
import { acceptTerms } from "../../src/logic/terms";
import accountModel from "../../src/logic/accountModel";
import { navigate } from "../../src/rootnavigation";

let ws: WebSocket;

Expand Down
8 changes: 2 additions & 6 deletions e2e/engine/bridge/server.js → e2e/bridge/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import { Server } from "ws";
import path from "path";
import fs from "fs";
import type { E2EBridgeMessage } from "./client";
import { $waitFor } from "../utils";
import { NavigatorName } from "../../../src/const";
import { NavigatorName } from "../../src/const";

let wss: Server;

Expand Down Expand Up @@ -35,15 +34,12 @@ export async function loadConfig(
const { data } = JSON.parse(f);

postMessage({ type: "importSettngs", payload: data.settings });

navigate(NavigatorName.Base);

if (data.accounts.length) {
postMessage({ type: "importAccounts", payload: data.accounts });
await $waitFor("PortfolioAccountsList", -1, 10000);
return;
}

await $waitFor("PortfolioEmptyAccount");
}

function navigate(name: string) {
Expand Down
8 changes: 5 additions & 3 deletions e2e/config.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"globalSetup": "./global-setup.js",
"globalTeardown": "./global-teardown.js",
"setupFilesAfterEnv": ["./setup.js"],
"testEnvironment": "./environment",
"testRunner": "jest-circus/runner",
"testTimeout": 120000,
"testTimeout": 300000,
"testRegex": "\\.spec\\.js$",
"reporters": ["detox/runners/jest/streamlineReporter"],
"verbose": true,
"setupFilesAfterEnv": ["./init.js"]
"verbose": true
}
2 changes: 1 addition & 1 deletion e2e/e2e-bridge-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
import Config from "react-native-config";

if (Config.MOCK) {
import("./engine/bridge/client").then(({ init }) => init());
import("./bridge/client").then(({ init }) => init());
}
2 changes: 0 additions & 2 deletions e2e/engine/flows/index.js

This file was deleted.

66 changes: 0 additions & 66 deletions e2e/engine/flows/onboarding.js

This file was deleted.

6 changes: 0 additions & 6 deletions e2e/engine/index.js

This file was deleted.

63 changes: 0 additions & 63 deletions e2e/engine/utils.js

This file was deleted.

7 changes: 7 additions & 0 deletions e2e/global-setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const detox = require("detox");

async function globalSetup() {
await detox.globalInit();
}

module.exports = globalSetup;
7 changes: 7 additions & 0 deletions e2e/global-teardown.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const detox = require("detox");

async function globalTeardown() {
await detox.globalCleanup();
}

module.exports = globalTeardown;
Loading

0 comments on commit f72d961

Please sign in to comment.