diff --git a/apps/ledger-live-mobile/e2e/models/accounts/accountsPage.ts b/apps/ledger-live-mobile/e2e/models/accounts/accountsPage.ts index 407e13d7a124..df1b45e8c890 100644 --- a/apps/ledger-live-mobile/e2e/models/accounts/accountsPage.ts +++ b/apps/ledger-live-mobile/e2e/models/accounts/accountsPage.ts @@ -4,7 +4,7 @@ const baseLink = "accounts"; export default class accountsPage { accountTitle = (coin: string) => getElementById(`accounts-title-${coin}`); - addAccountCta = () => getElementById("add-account-cta"); + addAccountButton = () => getElementById("add-account-button"); async openViaDeeplink() { await openDeeplink(baseLink); @@ -17,6 +17,6 @@ export default class accountsPage { } async addAccount() { - await tapByElement(this.addAccountCta()); + await tapByElement(this.addAccountButton()); } } diff --git a/apps/ledger-live-mobile/e2e/models/wallet/portfolioPage.ts b/apps/ledger-live-mobile/e2e/models/wallet/portfolioPage.ts index 85abb78e18f1..1fbcba9aab0d 100644 --- a/apps/ledger-live-mobile/e2e/models/wallet/portfolioPage.ts +++ b/apps/ledger-live-mobile/e2e/models/wallet/portfolioPage.ts @@ -4,6 +4,7 @@ import { openDeeplink, scrollToId, tapByElement, + tapById, waitForElementById, } from "../../helpers"; @@ -12,13 +13,14 @@ export default class PortfolioPage { zeroBalance = "$0.00"; graphCardBalanceId = "graphCard-balance"; assetBalanceId = "asset-balance"; - readOnlyPortfolioId = "PortfolioReadOnlyList"; + readOnlyItemsId = "PortfolioReadOnlyItems"; transferScrollListId = "transfer-scroll-list"; stakeMenuButtonId = "transfer-stake-button"; accountsListView = "PortfolioAccountsList"; seeAllTransactionButton = "portfolio-seeAll-transaction"; transactionAmountId = "portfolio-operation-amount"; - emptyPortfolioComponent = () => getElementById("PortfolioEmptyAccount"); + emptyPortfolioListId = "PortfolioEmptyList"; + emptyPortfolioList = () => getElementById(this.emptyPortfolioListId); portfolioSettingsButton = () => getElementById("settings-icon"); transferButton = () => getElementById("transfer-button"); swapTransferMenuButton = () => getElementById("swap-transfer-button"); @@ -29,6 +31,7 @@ export default class PortfolioPage { marketTabButton = () => getElementById("tab-bar-market"); walletTabMarket = () => getElementById("wallet-tab-Market"); earnButton = () => getElementById("tab-bar-earn"); + addAccountCta = "add-account-cta"; lastTransactionAmount = () => getElementById(this.transactionAmountId, 0); navigateToSettings() { @@ -61,18 +64,13 @@ export default class PortfolioPage { return tapByElement(this.receiveTransfertMenuButton()); } - async openAddAccount() { - const element = getElementById("add-account-button"); - await element.tap(); - } - async receive() { const element = getElementById("receive-button"); await element.tap(); } async waitForPortfolioReadOnly() { - await waitForElementById(this.readOnlyPortfolioId); + await waitForElementById(this.readOnlyItemsId); expect(await getTextOfElement(this.graphCardBalanceId)).toBe(this.zeroBalance); for (let index = 0; index < 4; index++) expect(await getTextOfElement(this.assetBalanceId, index)).toBe(this.zeroBalance); @@ -98,6 +96,11 @@ export default class PortfolioPage { return tapByElement(this.earnButton()); } + async addAccount() { + await scrollToId(this.addAccountCta, this.emptyPortfolioListId); + await tapById(this.addAccountCta); + } + async scrollToTransactions() { await scrollToId(this.seeAllTransactionButton, this.accountsListView); } diff --git a/apps/ledger-live-mobile/e2e/specs/addAccounts/addAccount.spec.ts b/apps/ledger-live-mobile/e2e/specs/addAccounts/addAccount.spec.ts index cdec1e892367..ffef16708cef 100644 --- a/apps/ledger-live-mobile/e2e/specs/addAccounts/addAccount.spec.ts +++ b/apps/ledger-live-mobile/e2e/specs/addAccounts/addAccount.spec.ts @@ -3,7 +3,6 @@ import { knownDevice } from "../../models/devices"; import { loadBleState, loadConfig } from "../../bridge/server"; import PortfolioPage from "../../models/wallet/portfolioPage"; import AccountPage from "../../models/accounts/accountPage"; -import AccountsPage from "../../models/accounts/accountsPage"; import DeviceAction from "../../models/DeviceAction"; import AddAccountDrawer from "../../models/accounts/addAccountDrawer"; @@ -13,7 +12,6 @@ let portfolioPage: PortfolioPage; let accountPage: AccountPage; let deviceAction: DeviceAction; let addAccountDrawer: AddAccountDrawer; -let accountsPage: AccountsPage; describe("Add account from modal", () => { beforeAll(async () => { @@ -24,13 +22,12 @@ describe("Add account from modal", () => { accountPage = new AccountPage(); deviceAction = new DeviceAction(knownDevice); addAccountDrawer = new AddAccountDrawer(); - accountsPage = new AccountsPage(); await portfolioPage.waitForPortfolioPageToLoad(); }); it("open add accounts from modal", async () => { - await accountsPage.addAccount(); + await portfolioPage.addAccount(); await addAccountDrawer.importWithYourLedger(); }); diff --git a/apps/ledger-live-mobile/e2e/specs/onboarding.spec.ts b/apps/ledger-live-mobile/e2e/specs/onboarding.spec.ts index 10a2bbae2aae..9ebe06748436 100644 --- a/apps/ledger-live-mobile/e2e/specs/onboarding.spec.ts +++ b/apps/ledger-live-mobile/e2e/specs/onboarding.spec.ts @@ -32,7 +32,7 @@ describe("Onboarding", () => { await portfolioPage.waitForPortfolioPageToLoad(); await expect(portfolioPage.portfolioSettingsButton()).toBeVisible(); //should see an empty portfolio page - await expect(portfolioPage.emptyPortfolioComponent()).toBeVisible(); + await expect(portfolioPage.emptyPortfolioList()).toBeVisible(); }); it("does the Onboarding and choose to restore a Nano X", async () => { @@ -45,7 +45,7 @@ describe("Onboarding", () => { await onboardingSteps.openLedgerLive(); await portfolioPage.waitForPortfolioPageToLoad(); await expect(portfolioPage.portfolioSettingsButton()).toBeVisible(); - await expect(portfolioPage.emptyPortfolioComponent()).toBeVisible(); + await expect(portfolioPage.emptyPortfolioList()).toBeVisible(); }); it("does the Onboarding and choose to restore a Nano SP", async () => { diff --git a/apps/ledger-live-mobile/e2e/specs/unknown-currency-resilience.spec.ts b/apps/ledger-live-mobile/e2e/specs/unknown-currency-resilience.spec.ts index ace682aef6b3..87d8749d6048 100644 --- a/apps/ledger-live-mobile/e2e/specs/unknown-currency-resilience.spec.ts +++ b/apps/ledger-live-mobile/e2e/specs/unknown-currency-resilience.spec.ts @@ -42,6 +42,6 @@ describe("Portfolio to load with unknown currency data in accounts", () => { it("opens to empty state", async () => { await portfolioPage.waitForPortfolioPageToLoad(); - await expect(await portfolioPage.emptyPortfolioComponent()).toBeVisible(); + await expect(await portfolioPage.emptyPortfolioList()).toBeVisible(); }); }); diff --git a/apps/ledger-live-mobile/src/screens/Portfolio/ReadOnly/index.tsx b/apps/ledger-live-mobile/src/screens/Portfolio/ReadOnly/index.tsx index de72a83864be..b74dcc0f8e58 100644 --- a/apps/ledger-live-mobile/src/screens/Portfolio/ReadOnly/index.tsx +++ b/apps/ledger-live-mobile/src/screens/Portfolio/ReadOnly/index.tsx @@ -185,7 +185,7 @@ function ReadOnlyPortfolio({ navigation }: NavigationProps) { renderItem={({ item }: ListRenderItemInfo) => item as JSX.Element} keyExtractor={(_: unknown, index: number) => String(index)} showsVerticalScrollIndicator={false} - testID="PortfolioReadOnlyList" + testID="PortfolioReadOnlyItems" /> ); diff --git a/apps/ledger-live-mobile/src/screens/Portfolio/index.tsx b/apps/ledger-live-mobile/src/screens/Portfolio/index.tsx index 997d64de922c..9bf4d414a1c8 100644 --- a/apps/ledger-live-mobile/src/screens/Portfolio/index.tsx +++ b/apps/ledger-live-mobile/src/screens/Portfolio/index.tsx @@ -222,7 +222,7 @@ function PortfolioScreen({ navigation }: NavigationProps) { }} keyExtractor={(_: unknown, index: number) => String(index)} showsVerticalScrollIndicator={false} - testID={showAssets ? "PortfolioAccountsList" : "PortfolioEmptyAccount"} + testID={showAssets ? "PortfolioAccountsList" : "PortfolioEmptyList"} />