-
Notifications
You must be signed in to change notification settings - Fork 348
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8709 from LedgerHQ/support/qaa_308_Detox_Speculos…
…_Adapt_tests [Detox][Speculos] Adapt existing tests
- Loading branch information
Showing
9 changed files
with
335 additions
and
45 deletions.
There are no files selected for viewing
102 changes: 102 additions & 0 deletions
102
apps/ledger-live-mobile/e2e/specs/speculos/deeplinks.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
import { AppInfos } from "@ledgerhq/live-common/e2e/enum/AppInfos"; | ||
import { Application } from "../../page"; | ||
import { CLI } from "../../utils/cliUtils"; | ||
|
||
const app = new Application(); | ||
const nanoApp = AppInfos.ETHEREUM; | ||
|
||
const ethereumLong = "ethereum"; | ||
const bitcoinLong = "bitcoin"; | ||
const arbitrumLong = "arbitrum"; | ||
const bobaLong = "boba"; | ||
|
||
$TmsLink("B2CQA-1837"); | ||
describe("DeepLinks Tests", () => { | ||
beforeAll(async () => { | ||
await app.init({ | ||
speculosApp: nanoApp, | ||
cliCommands: [ | ||
async () => { | ||
return CLI.liveData({ | ||
currency: nanoApp.name, | ||
index: 0, | ||
appjson: app.userdataPath, | ||
add: true, | ||
}); | ||
}, | ||
], | ||
}); | ||
await app.portfolio.waitForPortfolioPageToLoad(); | ||
}); | ||
|
||
it("should open My Ledger page", async () => { | ||
await app.manager.openViaDeeplink(); | ||
await app.manager.expectManagerPage(); | ||
}); | ||
|
||
it("should open Account page", async () => { | ||
await app.assetAccountsPage.openViaDeeplink(); | ||
await app.accounts.waitForAccountsPageToLoad(); | ||
}); | ||
|
||
it("should open Add Account drawer", async () => { | ||
await app.addAccount.openViaDeeplink(); | ||
await app.addAccount.selectCurrency(ethereumLong); | ||
}); | ||
|
||
it("should open ETH Account Asset page when given currency param", async () => { | ||
await app.assetAccountsPage.openViaDeeplink(ethereumLong); | ||
await app.assetAccountsPage.waitForAccountAssetsToLoad(ethereumLong); | ||
}); | ||
|
||
it("should open BTC Account Asset page when given currency param", async () => { | ||
await app.assetAccountsPage.openViaDeeplink(bitcoinLong); | ||
await app.assetAccountsPage.waitForAccountAssetsToLoad(bitcoinLong); | ||
}); | ||
|
||
it("should open Custom Lock Screen page", async () => { | ||
await app.customLockscreen.openViaDeeplink(); | ||
await app.customLockscreen.expectCustomLockscreenPage(); | ||
}); | ||
|
||
it("should open the Discover page", async () => { | ||
await app.discover.openViaDeeplink(); | ||
await app.discover.expectDiscoverPage(); | ||
}); | ||
|
||
it(`should open discovery to random live App`, async () => { | ||
// Opening only one random liveApp to avoid flakiness | ||
const randomLiveApp = app.discover.getRandomLiveApp(); | ||
await app.discover.openViaDeeplink(randomLiveApp); | ||
await app.discover.expectApp(randomLiveApp); | ||
}); | ||
|
||
it("should open NFT Gallery", async () => { | ||
await app.nftGallery.openViaDeeplink(); | ||
await app.nftGallery.expectGalleryVisible(); | ||
}); | ||
|
||
it("should open Swap Form page", async () => { | ||
await app.swap.openViaDeeplink(); | ||
await app.swap.expectSwapPage(); | ||
}); | ||
|
||
it("should open Send pages", async () => { | ||
await app.send.openViaDeeplink(); | ||
await app.send.expectFirstStep(); | ||
await app.portfolio.openViaDeeplink(); | ||
await app.portfolio.waitForPortfolioPageToLoad(); | ||
await app.send.sendViaDeeplink(ethereumLong); | ||
await app.send.expectFirstStep(); | ||
await app.common.expectSearch(ethereumLong); | ||
}); | ||
|
||
it("should open Receive pages", async () => { | ||
await app.receive.openViaDeeplink(); | ||
await app.receive.expectFirstStep(); | ||
await app.portfolio.openViaDeeplink(); | ||
await app.portfolio.waitForPortfolioPageToLoad(); | ||
await app.receive.receiveViaDeeplink(ethereumLong); | ||
await app.receive.expectSecondStepNetworks([ethereumLong, arbitrumLong, bobaLong]); | ||
}); | ||
}); |
57 changes: 57 additions & 0 deletions
57
apps/ledger-live-mobile/e2e/specs/speculos/languageChange.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { AppInfos } from "@ledgerhq/live-common/e2e/enum/AppInfos"; | ||
import { Application } from "../../page"; | ||
import { CLI } from "../../utils/cliUtils"; | ||
|
||
const app = new Application(); | ||
const nanoApp = AppInfos.ETHEREUM; | ||
|
||
const langButtonText = [ | ||
{ lang: "Français", localization: "Général" }, | ||
{ lang: "Español", localization: "General" }, | ||
{ lang: "Русский", localization: "Общие" }, | ||
{ lang: "Deutsch", localization: "Allgemeines" }, | ||
{ lang: "Português (Brasil)", localization: "Geral" }, | ||
{ lang: "Türkçe", localization: "Genel" }, | ||
{ lang: "简体中文", localization: "常规" }, | ||
{ lang: "한국어", localization: "일반" }, | ||
{ lang: "日本語", localization: "一般" }, | ||
{ lang: "English", localization: "General" }, | ||
]; | ||
|
||
const verifyLanguageCanBeChanged = (l10n: { lang: string; localization: string }) => { | ||
it(`should change selected language to ${l10n.lang}`, async () => { | ||
await app.settingsGeneral.navigateToLanguageSelect(); | ||
await app.settingsGeneral.selectLanguage(l10n.lang); | ||
await app.settingsGeneral.expectLocalizedText(l10n.localization); | ||
}); | ||
}; | ||
|
||
$TmsLink("B2CQA-2344"); | ||
describe("Change Language", () => { | ||
beforeAll(async () => { | ||
await app.init({ | ||
speculosApp: nanoApp, | ||
cliCommands: [ | ||
async () => { | ||
return CLI.liveData({ | ||
currency: nanoApp.name, | ||
index: 0, | ||
appjson: app.userdataPath, | ||
add: true, | ||
}); | ||
}, | ||
], | ||
}); | ||
await app.portfolio.waitForPortfolioPageToLoad(); | ||
}); | ||
|
||
it("should go to General Settings", async () => { | ||
await app.portfolio.navigateToSettings(); | ||
await app.settings.navigateToGeneralSettings(); | ||
}); | ||
|
||
// test steps for each language | ||
for (const l10n of langButtonText) { | ||
verifyLanguageCanBeChanged(l10n); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { AppInfos } from "@ledgerhq/live-common/e2e/enum/AppInfos"; | ||
import { Application } from "../../page"; | ||
import { CLI } from "../../utils/cliUtils"; | ||
|
||
const app = new Application(); | ||
const nanoApp = AppInfos.ETHEREUM; | ||
const asset = "Ethereum (ETH)"; | ||
|
||
describe("Market page for user with no device", () => { | ||
beforeAll(async () => { | ||
await app.init({ | ||
speculosApp: nanoApp, | ||
cliCommands: [ | ||
async () => { | ||
return CLI.liveData({ | ||
currency: nanoApp.name, | ||
index: 0, | ||
appjson: app.userdataPath, | ||
add: true, | ||
}); | ||
}, | ||
], | ||
}); | ||
await app.portfolio.waitForPortfolioPageToLoad(); | ||
}); | ||
|
||
$TmsLink("B2CQA-1880"); | ||
it("should find the researched crypto", async () => { | ||
await app.walletTabNavigator.navigateToMarket(); | ||
await app.market.searchAsset("eth"); | ||
await app.market.expectMarketRowTitle(asset); | ||
}); | ||
|
||
$TmsLink("B2CQA-1879"); | ||
it("should filter starred asset in the list", async () => { | ||
await app.market.openAssetPage(asset); | ||
await app.market.starFavoriteCoin(); | ||
await app.market.backToAssetList(); | ||
await app.market.filterStaredAsset(); | ||
await app.market.expectMarketRowTitle(asset); | ||
}); | ||
}); |
16 changes: 16 additions & 0 deletions
16
apps/ledger-live-mobile/e2e/specs/speculos/onboardingReadOnly.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Application } from "../../page"; | ||
|
||
const app = new Application(); | ||
|
||
describe("Onboarding - Read Only", () => { | ||
$TmsLink("B2CQA-370"); | ||
$TmsLink("B2CQA-1753"); | ||
$TmsLink("B2CQA-1806"); | ||
it("goes through discover app and should see an empty portfolio page", async () => { | ||
await app.onboarding.startOnboarding(); | ||
await app.onboarding.chooseNoLedgerYet(); | ||
await app.onboarding.chooseToExploreApp(); | ||
await app.portfolio.waitForPortfolioPageToLoad(); | ||
await app.portfolio.expectPortfolioReadOnly(); | ||
}); | ||
}); |
55 changes: 55 additions & 0 deletions
55
apps/ledger-live-mobile/e2e/specs/speculos/password.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { device } from "detox"; | ||
import { Application } from "../../page"; | ||
import { AppInfos } from "@ledgerhq/live-common/e2e/enum/AppInfos"; | ||
import { CLI } from "../../utils/cliUtils"; | ||
|
||
const app = new Application(); | ||
const nanoApp = AppInfos.ETHEREUM; | ||
|
||
const CORRECT_PASSWORD = "passWORD$123!"; | ||
|
||
describe("Password Lock Screen", () => { | ||
beforeAll(async () => { | ||
await app.init({ | ||
speculosApp: nanoApp, | ||
cliCommands: [ | ||
async () => { | ||
return CLI.liveData({ | ||
currency: nanoApp.name, | ||
index: 0, | ||
appjson: app.userdataPath, | ||
add: true, | ||
}); | ||
}, | ||
], | ||
}); | ||
await app.portfolio.waitForPortfolioPageToLoad(); | ||
}); | ||
|
||
$TmsLink("B2CQA-1763"); | ||
it("should ask for the password when lock is toggled", async () => { | ||
await app.portfolio.navigateToSettings(); | ||
await app.settings.navigateToGeneralSettings(); | ||
await app.settingsGeneral.togglePassword(); | ||
await app.settingsGeneral.enterNewPassword(CORRECT_PASSWORD); | ||
await app.settingsGeneral.enterNewPassword(CORRECT_PASSWORD); // confirm password step | ||
await device.sendToHome(); | ||
await device.launchApp(); // restart LLM | ||
await app.passwordEntry.expectLock(); | ||
}); | ||
|
||
$TmsLink("B2CQA-2343"); | ||
it("should stay locked with incorrect password", async () => { | ||
await app.passwordEntry.enterPassword("INCORRECT_PASSWORD"); | ||
await app.passwordEntry.login(); | ||
await app.passwordEntry.expectLock(); | ||
}); | ||
|
||
$TmsLink("B2CQA-1763"); | ||
it("should unlock with correct password", async () => { | ||
await app.passwordEntry.enterPassword(CORRECT_PASSWORD); | ||
await app.passwordEntry.login(); | ||
await app.passwordEntry.expectNoLock(); | ||
await app.settingsGeneral.expectpreferredCurrencyButton(); | ||
}); | ||
}); |
40 changes: 0 additions & 40 deletions
40
apps/ledger-live-mobile/e2e/specs/speculos/receive/receive.ts
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
apps/ledger-live-mobile/e2e/specs/speculos/receive/receiveBTC.spec.ts
This file was deleted.
Oops, something went wrong.
62 changes: 62 additions & 0 deletions
62
apps/ledger-live-mobile/e2e/specs/speculos/verifyAddress/receiveFlowETH.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { Account } from "@ledgerhq/live-common/e2e/enum/Account"; | ||
import { Application } from "../../../page"; | ||
|
||
const app = new Application(); | ||
const account = Account.ETH_1; | ||
|
||
describe("Receive Flow", () => { | ||
beforeAll(async () => { | ||
app.userdataSpeculos = "EthAccountXrpAccountReadOnlyFalse"; | ||
await app.init({ | ||
speculosApp: account.currency.speculosApp, | ||
}); | ||
|
||
await app.portfolio.waitForPortfolioPageToLoad(); | ||
}); | ||
|
||
async function openReceive() { | ||
await app.portfolio.openViaDeeplink(); | ||
await app.portfolio.waitForPortfolioPageToLoad(); | ||
await app.receive.openViaDeeplink(); | ||
} | ||
|
||
$TmsLink("B2CQA-1858"); | ||
$TmsLink("B2CQA-1860"); | ||
it("Should display the number of account existing per networks", async () => { | ||
await openReceive(); | ||
await app.receive.selectAsset("ETH"); | ||
await app.receive.expectNumberOfAccountInListIsDisplayed("ethereum", 3); | ||
await app.receive.expectNumberOfAccountInListIsDisplayed("op mainnet", 1); | ||
}); | ||
|
||
$TmsLink("B2CQA-1856"); | ||
$TmsLink("B2CQA-1862"); | ||
it("Should create an account on a network", async () => { | ||
await openReceive(); | ||
await app.receive.selectAsset("ETH"); | ||
await app.receive.selectNetwork("op mainnet"); | ||
await app.receive.createAccount(); | ||
await app.receive.continueCreateAccount(); | ||
await app.receive.expectAccountIsCreated("OP Mainnet 1"); | ||
}); | ||
|
||
$TmsLink("B2CQA-650"); | ||
it("Should access to receive after importing a cryptocurrency on a selected network", async () => { | ||
await openReceive(); | ||
await app.common.performSearch("Polygon"); | ||
await app.receive.selectAsset("POL"); | ||
await app.receive.selectNetwork("binance smart chain"); | ||
await app.receive.selectAccount("Binance Smart Chain 1"); | ||
await app.receive.doNotVerifyAddress(); | ||
await app.receive.expectReceivePageIsDisplayed("BNB", "Binance Smart Chain 1"); | ||
}); | ||
|
||
$TmsLink("B2CQA-1859"); | ||
it("Should access to receive after selecting an existing account", async () => { | ||
await openReceive(); | ||
await app.receive.selectAsset("XRP"); | ||
await app.receive.selectAccount("XRP 2"); | ||
await app.receive.doNotVerifyAddress(); | ||
await app.receive.expectReceivePageIsDisplayed("XRP", "XRP 2"); | ||
}); | ||
}); |
2 changes: 1 addition & 1 deletion
2
apps/ledger-live-mobile/e2e/specs/speculos/verifyAddress/verifyAddressBTC.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { runVerifyAddressTest } from "./verifyAddress"; | ||
import { Account } from "@ledgerhq/live-common/e2e/enum/Account"; | ||
|
||
runVerifyAddressTest(Account.BTC_NATIVE_SEGWIT_1, "B2CQA-2559, B2CQA-2687"); | ||
runVerifyAddressTest(Account.BTC_NATIVE_SEGWIT_1, "B2CQA-2559, B2CQA-2687, B2CQA-1864"); |