From d6954007584641b50c1b44bd38366c92200bce62 Mon Sep 17 00:00:00 2001 From: Abdurrahman SASTIM Date: Mon, 28 Oct 2024 16:13:24 +0100 Subject: [PATCH] test: separate coin by file --- apps/ledger-live-mobile/e2e/helpers.ts | 2 +- .../e2e/specs/speculos/addAccount.spec.ts | 51 ------------------- .../specs/speculos/addAccount/AddAccount.ts | 34 +++++++++++++ .../speculos/addAccount/AddAccountADA.spec.ts | 4 ++ .../addAccount/AddAccountALGO.spec.ts | 4 ++ .../addAccount/AddAccountATOM.spec.ts | 4 ++ .../speculos/addAccount/AddAccountBCH.spec.ts | 4 ++ .../speculos/addAccount/AddAccountBTC.spec.ts | 4 ++ .../speculos/addAccount/AddAccountDOT.spec.ts | 4 ++ .../speculos/addAccount/AddAccountETC.spec.ts | 4 ++ .../speculos/addAccount/AddAccountETH.spec.ts | 4 ++ .../speculos/addAccount/AddAccountSOL.spec.ts | 4 ++ .../speculos/addAccount/AddAccountTON.spec.ts | 4 ++ .../speculos/addAccount/AddAccountTRX.spec.ts | 4 ++ .../speculos/addAccount/AddAccountXLM.spec.ts | 4 ++ .../speculos/addAccount/AddAccountXRP.spec.ts | 4 ++ .../speculos/addAccount/AddAccountXTZ.spec.ts | 4 ++ apps/ledger-live-mobile/package.json | 2 +- 18 files changed, 92 insertions(+), 53 deletions(-) delete mode 100644 apps/ledger-live-mobile/e2e/specs/speculos/addAccount.spec.ts create mode 100644 apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccount.ts create mode 100644 apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountADA.spec.ts create mode 100644 apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountALGO.spec.ts create mode 100644 apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountATOM.spec.ts create mode 100644 apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountBCH.spec.ts create mode 100644 apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountBTC.spec.ts create mode 100644 apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountDOT.spec.ts create mode 100644 apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountETC.spec.ts create mode 100644 apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountETH.spec.ts create mode 100644 apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountSOL.spec.ts create mode 100644 apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountTON.spec.ts create mode 100644 apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountTRX.spec.ts create mode 100644 apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountXLM.spec.ts create mode 100644 apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountXRP.spec.ts create mode 100644 apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountXTZ.spec.ts diff --git a/apps/ledger-live-mobile/e2e/helpers.ts b/apps/ledger-live-mobile/e2e/helpers.ts index 0490f2f60238..9e8e782c4c0e 100644 --- a/apps/ledger-live-mobile/e2e/helpers.ts +++ b/apps/ledger-live-mobile/e2e/helpers.ts @@ -172,7 +172,7 @@ export async function launchSpeculos(appName: string, proxyPort: number) { } const speculosPort = portCounter++; const speculosPidOffset = - (speculosPort - BASE_PORT) * 1000 + parseInt(process.env.TEST_WORKER_INDEX || "0") * 100; + (speculosPort - BASE_PORT) * 1000 + parseInt(process.env.JEST_WORKER_ID || "0") * 100; setEnv("SPECULOS_PID_OFFSET", speculosPidOffset); const testName = expect.getState().testPath || "unknown"; diff --git a/apps/ledger-live-mobile/e2e/specs/speculos/addAccount.spec.ts b/apps/ledger-live-mobile/e2e/specs/speculos/addAccount.spec.ts deleted file mode 100644 index c254e2e373c9..000000000000 --- a/apps/ledger-live-mobile/e2e/specs/speculos/addAccount.spec.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { Application } from "../../page"; -import { Currency } from "@ledgerhq/live-common/e2e/enum/Currency"; - -let app: Application; -let deviceNumber: number; - -const currencies = [ - { currency: Currency.BTC, tmsLink: "B2CQA-2499, B2CQA-2644, B2CQA-2672, B2CQA-786" }, - { currency: Currency.ETH, tmsLink: "B2CQA-2503, B2CQA-2645, B2CQA-2673" }, - { currency: Currency.ETC, tmsLink: "B2CQA-2502, B2CQA-2646, B2CQA-2674" }, - { currency: Currency.XRP, tmsLink: "B2CQA-2505, B2CQA-2647, B2CQA-2675" }, - { currency: Currency.DOT, tmsLink: "B2CQA-2504, B2CQA-2648, B2CQA-2676" }, - { currency: Currency.TRX, tmsLink: "B2CQA-2508, B2CQA-2649, B2CQA-2677" }, - { currency: Currency.ADA, tmsLink: "B2CQA-2500, B2CQA-2650, B2CQA-2678" }, - { currency: Currency.XLM, tmsLink: "B2CQA-2506, B2CQA-2651, B2CQA-2679" }, - { currency: Currency.BCH, tmsLink: "B2CQA-2498, B2CQA-2652, B2CQA-2680" }, - { currency: Currency.ALGO, tmsLink: "B2CQA-2497, B2CQA-2653, B2CQA-2681" }, - { currency: Currency.ATOM, tmsLink: "B2CQA-2501, B2CQA-2654, B2CQA-2682" }, - { currency: Currency.XTZ, tmsLink: "B2CQA-2507, B2CQA-2655, B2CQA-2683" }, - { currency: Currency.SOL, tmsLink: "B2CQA-2642, B2CQA-2656, B2CQA-2684" }, - { currency: Currency.TON, tmsLink: "B2CQA-2643, B2CQA-2657, B2CQA-2685" }, -]; - -beforeAll(async () => { - app = await Application.init("onboardingcompleted"); - await app.portfolio.waitForPortfolioPageToLoad(); -}); - -currencies.forEach(({ currency, tmsLink }) => { - $TmsLink(tmsLink); - describe(`Add accounts - ${currency.name}`, () => { - it(`Perform an add account`, async () => { - await app.addAccount.openViaDeeplink(); - await app.common.performSearch(currency.name); - await app.addAccount.selectCurrency(currency.currencyId); - - deviceNumber = await app.common.addSpeculos(currency.speculosApp.name); - - await app.addAccount.startAccountsDiscovery(); - await app.addAccount.expectAccountDiscovery(currency.name, currency.currencyId); - await app.addAccount.finishAccountsDiscovery(); - await app.addAccount.tapSuccessCta(); - await app.account.waitForAccountPageToLoad(currency.name); - await app.account.expectAccountBalanceVisible(); - }); - - afterAll(async () => { - await app.common.removeSpeculos(deviceNumber); - }); - }); -}); diff --git a/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccount.ts b/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccount.ts new file mode 100644 index 000000000000..4fe283ea9d06 --- /dev/null +++ b/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccount.ts @@ -0,0 +1,34 @@ +import { Application } from "../../../page"; +import { Currency } from "@ledgerhq/live-common/e2e/enum/Currency"; + +export async function runAddAccountTest(currency: Currency, tmsLink: string) { + let app: Application; + let deviceNumber: number; + + describe(`Add accounts - ${currency.name}`, () => { + beforeAll(async () => { + app = await Application.init("onboardingcompleted"); + await app.portfolio.waitForPortfolioPageToLoad(); + }); + + $TmsLink(tmsLink); + it(`Perform an add account`, async () => { + await app.addAccount.openViaDeeplink(); + await app.common.performSearch(currency.name); + await app.addAccount.selectCurrency(currency.currencyId); + + deviceNumber = await app.common.addSpeculos(currency.speculosApp.name); + + await app.addAccount.startAccountsDiscovery(); + await app.addAccount.expectAccountDiscovery(currency.name, currency.currencyId); + await app.addAccount.finishAccountsDiscovery(); + await app.addAccount.tapSuccessCta(); + await app.account.waitForAccountPageToLoad(currency.name); + await app.account.expectAccountBalanceVisible(); + }); + + afterAll(async () => { + await app.common.removeSpeculos(deviceNumber); + }); + }); +} diff --git a/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountADA.spec.ts b/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountADA.spec.ts new file mode 100644 index 000000000000..87cb6f45ef9e --- /dev/null +++ b/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountADA.spec.ts @@ -0,0 +1,4 @@ +import { runAddAccountTest } from "./AddAccount"; +import { Currency } from "@ledgerhq/live-common/e2e/enum/Currency"; + +runAddAccountTest(Currency.ADA, "B2CQA-2500, B2CQA-2650, B2CQA-2678"); diff --git a/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountALGO.spec.ts b/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountALGO.spec.ts new file mode 100644 index 000000000000..a3933d2af648 --- /dev/null +++ b/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountALGO.spec.ts @@ -0,0 +1,4 @@ +import { runAddAccountTest } from "./AddAccount"; +import { Currency } from "@ledgerhq/live-common/e2e/enum/Currency"; + +runAddAccountTest(Currency.ALGO, "B2CQA-2497, B2CQA-2653, B2CQA-2681"); diff --git a/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountATOM.spec.ts b/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountATOM.spec.ts new file mode 100644 index 000000000000..314443b0f41d --- /dev/null +++ b/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountATOM.spec.ts @@ -0,0 +1,4 @@ +import { runAddAccountTest } from "./AddAccount"; +import { Currency } from "@ledgerhq/live-common/e2e/enum/Currency"; + +runAddAccountTest(Currency.ATOM, "B2CQA-2501, B2CQA-2654, B2CQA-2682"); diff --git a/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountBCH.spec.ts b/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountBCH.spec.ts new file mode 100644 index 000000000000..cfa248cea620 --- /dev/null +++ b/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountBCH.spec.ts @@ -0,0 +1,4 @@ +import { runAddAccountTest } from "./AddAccount"; +import { Currency } from "@ledgerhq/live-common/e2e/enum/Currency"; + +runAddAccountTest(Currency.BCH, "B2CQA-2498, B2CQA-2652, B2CQA-2680"); diff --git a/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountBTC.spec.ts b/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountBTC.spec.ts new file mode 100644 index 000000000000..a023f24482d4 --- /dev/null +++ b/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountBTC.spec.ts @@ -0,0 +1,4 @@ +import { runAddAccountTest } from "./AddAccount"; +import { Currency } from "@ledgerhq/live-common/e2e/enum/Currency"; + +runAddAccountTest(Currency.BTC, "B2CQA-2499, B2CQA-2644, B2CQA-2672, B2CQA-786"); diff --git a/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountDOT.spec.ts b/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountDOT.spec.ts new file mode 100644 index 000000000000..fedd5ccf18d7 --- /dev/null +++ b/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountDOT.spec.ts @@ -0,0 +1,4 @@ +import { runAddAccountTest } from "./AddAccount"; +import { Currency } from "@ledgerhq/live-common/e2e/enum/Currency"; + +runAddAccountTest(Currency.DOT, "B2CQA-2504, B2CQA-2648, B2CQA-2676"); diff --git a/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountETC.spec.ts b/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountETC.spec.ts new file mode 100644 index 000000000000..801794424158 --- /dev/null +++ b/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountETC.spec.ts @@ -0,0 +1,4 @@ +import { runAddAccountTest } from "./AddAccount"; +import { Currency } from "@ledgerhq/live-common/e2e/enum/Currency"; + +runAddAccountTest(Currency.ETC, "B2CQA-2502, B2CQA-2646, B2CQA-2674"); diff --git a/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountETH.spec.ts b/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountETH.spec.ts new file mode 100644 index 000000000000..225cc83eec46 --- /dev/null +++ b/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountETH.spec.ts @@ -0,0 +1,4 @@ +import { runAddAccountTest } from "./AddAccount"; +import { Currency } from "@ledgerhq/live-common/e2e/enum/Currency"; + +runAddAccountTest(Currency.ETH, "B2CQA-2503, B2CQA-2645, B2CQA-26736"); diff --git a/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountSOL.spec.ts b/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountSOL.spec.ts new file mode 100644 index 000000000000..42eb44faeff6 --- /dev/null +++ b/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountSOL.spec.ts @@ -0,0 +1,4 @@ +import { runAddAccountTest } from "./AddAccount"; +import { Currency } from "@ledgerhq/live-common/e2e/enum/Currency"; + +runAddAccountTest(Currency.SOL, "B2CQA-2642, B2CQA-2656, B2CQA-2684"); diff --git a/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountTON.spec.ts b/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountTON.spec.ts new file mode 100644 index 000000000000..28b01f50f71c --- /dev/null +++ b/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountTON.spec.ts @@ -0,0 +1,4 @@ +import { runAddAccountTest } from "./AddAccount"; +import { Currency } from "@ledgerhq/live-common/e2e/enum/Currency"; + +runAddAccountTest(Currency.TON, "B2CQA-2643, B2CQA-2657, B2CQA-2685"); diff --git a/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountTRX.spec.ts b/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountTRX.spec.ts new file mode 100644 index 000000000000..1310e7efadd8 --- /dev/null +++ b/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountTRX.spec.ts @@ -0,0 +1,4 @@ +import { runAddAccountTest } from "./AddAccount"; +import { Currency } from "@ledgerhq/live-common/e2e/enum/Currency"; + +runAddAccountTest(Currency.TRX, "B2CQA-2508, B2CQA-2649, B2CQA-2677"); diff --git a/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountXLM.spec.ts b/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountXLM.spec.ts new file mode 100644 index 000000000000..42a0b7d7002b --- /dev/null +++ b/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountXLM.spec.ts @@ -0,0 +1,4 @@ +import { runAddAccountTest } from "./AddAccount"; +import { Currency } from "@ledgerhq/live-common/e2e/enum/Currency"; + +runAddAccountTest(Currency.XLM, "B2CQA-2506, B2CQA-2651, B2CQA-2679"); diff --git a/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountXRP.spec.ts b/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountXRP.spec.ts new file mode 100644 index 000000000000..1f6df1119d48 --- /dev/null +++ b/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountXRP.spec.ts @@ -0,0 +1,4 @@ +import { runAddAccountTest } from "./AddAccount"; +import { Currency } from "@ledgerhq/live-common/e2e/enum/Currency"; + +runAddAccountTest(Currency.XRP, "B2CQA-2505, B2CQA-2647, B2CQA-2675"); diff --git a/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountXTZ.spec.ts b/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountXTZ.spec.ts new file mode 100644 index 000000000000..bce641c496b6 --- /dev/null +++ b/apps/ledger-live-mobile/e2e/specs/speculos/addAccount/AddAccountXTZ.spec.ts @@ -0,0 +1,4 @@ +import { runAddAccountTest } from "./AddAccount"; +import { Currency } from "@ledgerhq/live-common/e2e/enum/Currency"; + +runAddAccountTest(Currency.XTZ, "B2CQA-2507, B2CQA-2655, B2CQA-2683"); diff --git a/apps/ledger-live-mobile/package.json b/apps/ledger-live-mobile/package.json index 0525f7b9c90c..891bd96a5297 100644 --- a/apps/ledger-live-mobile/package.json +++ b/apps/ledger-live-mobile/package.json @@ -20,7 +20,7 @@ "e2e:build": "pnpm detox build", "e2e:ci": "zx ./scripts/e2e-ci.mjs", "e2e:test": "export MOCK=1 && pnpm detox test", - "e2e:test:speculos": "export MOCK=0 && pnpm detox test --testMatch $(pwd)/e2e/specs/speculos/**/*.spec.ts", + "e2e:test:speculos": "export MOCK=0 && pnpm detox test --testMatch $(pwd)/e2e/specs/speculos/**/**/*.spec.ts", "prebeta": "bundle install", "debug:detox": "pnpm detox test -c ios.manual currencies.spec.ts", "ios:staging": "ENVFILE=.env.ios.staging react-native run-ios --mode Staging",