From 4f27dd1fb4f5142ce6cbb0b97656c50db1af32a9 Mon Sep 17 00:00:00 2001 From: KVNLS Date: Tue, 17 Oct 2023 21:41:50 +0200 Subject: [PATCH] fix: update account order --- .../tests/models/AddAccountModal.ts | 1 + .../tests/models/LiveAppWebview.ts | 4 + .../tests/specs/services/buy.spec.ts | 1 + .../specs/services/ethereumStaking.spec.ts | 2 +- .../tests/specs/services/liveapp-sdk.spec.ts | 2 +- .../tests/specs/services/wallet-api.spec.ts | 108 +++++++++--------- 6 files changed, 62 insertions(+), 56 deletions(-) diff --git a/apps/ledger-live-desktop/tests/models/AddAccountModal.ts b/apps/ledger-live-desktop/tests/models/AddAccountModal.ts index 524e58da0ced..8801d8310169 100644 --- a/apps/ledger-live-desktop/tests/models/AddAccountModal.ts +++ b/apps/ledger-live-desktop/tests/models/AddAccountModal.ts @@ -36,6 +36,7 @@ export class AddAccountModal extends Modal { } async getFirstAccountName() { + await this.page.waitForTimeout(500); const firstAccountName = await this.accountsList.locator("input").first().inputValue(); return firstAccountName; } diff --git a/apps/ledger-live-desktop/tests/models/LiveAppWebview.ts b/apps/ledger-live-desktop/tests/models/LiveAppWebview.ts index 4c0b3bc435ad..37bd57bf4d7d 100644 --- a/apps/ledger-live-desktop/tests/models/LiveAppWebview.ts +++ b/apps/ledger-live-desktop/tests/models/LiveAppWebview.ts @@ -112,6 +112,10 @@ export class LiveAppWebview { return waitFor(() => this.textIsPresent(textToCheck)); } + async waitForLoaded() { + return this.page.waitForLoadState("domcontentloaded"); + } + async textIsPresent(textToCheck: string) { const result: boolean = await this.page.evaluate(textToCheck => { const webview = document.querySelector("webview"); diff --git a/apps/ledger-live-desktop/tests/specs/services/buy.spec.ts b/apps/ledger-live-desktop/tests/specs/services/buy.spec.ts index 521ba601377f..b628277ae336 100644 --- a/apps/ledger-live-desktop/tests/specs/services/buy.spec.ts +++ b/apps/ledger-live-desktop/tests/specs/services/buy.spec.ts @@ -55,6 +55,7 @@ test("Buy / Sell @smoke", async ({ page }) => { await test.step("Navigate to Buy app from portfolio banner", async () => { await portfolioPage.startBuyFlow(); + await liveAppWebview.waitForLoaded(); await expect(await liveAppWebview.waitForCorrectTextInWebview("theme: dark")).toBe(true); await expect(await liveAppWebview.waitForCorrectTextInWebview("lang: en")).toBe(true); await expect diff --git a/apps/ledger-live-desktop/tests/specs/services/ethereumStaking.spec.ts b/apps/ledger-live-desktop/tests/specs/services/ethereumStaking.spec.ts index c6bcbdb67e4e..8c11d79368ed 100644 --- a/apps/ledger-live-desktop/tests/specs/services/ethereumStaking.spec.ts +++ b/apps/ledger-live-desktop/tests/specs/services/ethereumStaking.spec.ts @@ -95,7 +95,7 @@ test("Ethereum staking flows via portfolio, asset page and market page @smoke", }); await test.step("choose ethereum account", async () => { - await drawer.selectAccount("Ethereum", 1); + await drawer.selectAccount("Ethereum"); await expect.soft(page).toHaveScreenshot("choose-stake-provider-modal-from-portfolio-page.png"); }); diff --git a/apps/ledger-live-desktop/tests/specs/services/liveapp-sdk.spec.ts b/apps/ledger-live-desktop/tests/specs/services/liveapp-sdk.spec.ts index 7441db04ca96..5e0aa6454b24 100644 --- a/apps/ledger-live-desktop/tests/specs/services/liveapp-sdk.spec.ts +++ b/apps/ledger-live-desktop/tests/specs/services/liveapp-sdk.spec.ts @@ -71,7 +71,7 @@ test("Live App SDK methods @smoke", async ({ page }) => { }); await test.step("Request Account - select BTC", async () => { - await drawer.selectAccount("Bitcoin", 0); + await drawer.selectAccount("Bitcoin", 1); await drawer.waitForDrawerToDisappear(); await liveAppWebview.waitForCorrectTextInWebview("mock:1:bitcoin:true_bitcoin_0:"); }); diff --git a/apps/ledger-live-desktop/tests/specs/services/wallet-api.spec.ts b/apps/ledger-live-desktop/tests/specs/services/wallet-api.spec.ts index 6b3ea98e941d..ae6548624265 100644 --- a/apps/ledger-live-desktop/tests/specs/services/wallet-api.spec.ts +++ b/apps/ledger-live-desktop/tests/specs/services/wallet-api.spec.ts @@ -35,15 +35,6 @@ const methods = [ const account_list_mock = { rawAccounts: [ - { - id: "2d23ca2a-069e-579f-b13d-05bc706c7583", - name: "Bitcoin 1 (legacy)", - address: "1xeyL26EKAAR3pStd7wEveajk4MQcrYezeJ", - currency: "bitcoin", - balance: "35688397", - spendableBalance: "35688397", - blockHeight: 194870, - }, { id: "3463fc5b-deb9-5b19-a27e-4554624f2090", name: "Bitcoin 2 (legacy)", @@ -54,31 +45,13 @@ const account_list_mock = { blockHeight: 124828, }, { - id: "b60265f4-e52d-5800-9203-1609b9461654", - name: "Bitcoin 3 (legacy)", - address: "13x7TUzymwejUWQmoWusnYcdmC8RNMGG17f", + id: "2d23ca2a-069e-579f-b13d-05bc706c7583", + name: "Bitcoin 1 (legacy)", + address: "1xeyL26EKAAR3pStd7wEveajk4MQcrYezeJ", currency: "bitcoin", - balance: "0", - spendableBalance: "0", - blockHeight: 136277, - }, - { - id: "e86e3bc1-49e1-53fd-a329-96ba6f1b06d3", - name: "Ethereum 1", - address: "0x6EB963EFD0FEF7A4CFAB6CE6F1421C3279D11707", - currency: "ethereum", - balance: "10135465432293584185", - spendableBalance: "10135465432293584185", - blockHeight: 122403, - }, - { - id: "7c99915b-f186-5b44-82cc-fb21fa084292", - name: "Ethereum 1 (DAI)", - address: "0x6EB963EFD0FEF7A4CFAB6CE6F1421C3279D11707", - currency: "ethereum/erc20/dai_stablecoin_v2_0", - balance: "82865885", - spendableBalance: "82865885", - blockHeight: 122403, + balance: "35688397", + spendableBalance: "35688397", + blockHeight: 194870, }, { id: "d9d1d396-2081-53e1-9c67-f0623e0c4d3a", @@ -90,12 +63,12 @@ const account_list_mock = { blockHeight: 168357, }, { - id: "f5a525d7-1ec6-57ca-a26a-d34fc5158e84", - name: "Ethereum 2 (DAI)", + id: "80828eb7-49ca-54e8-8454-79c0e5557aec", + name: "Ethereum 2 (USDC)", address: "0x046615F0862392BC5E6FB43C92AAD73DE158D235", - currency: "ethereum/erc20/dai_stablecoin_v2_0", - balance: "81381327", - spendableBalance: "81381327", + currency: "ethereum/erc20/usd__coin", + balance: "102966480", + spendableBalance: "102966480", blockHeight: 168357, }, { @@ -108,14 +81,41 @@ const account_list_mock = { blockHeight: 168357, }, { - id: "80828eb7-49ca-54e8-8454-79c0e5557aec", - name: "Ethereum 2 (USDC)", + id: "f5a525d7-1ec6-57ca-a26a-d34fc5158e84", + name: "Ethereum 2 (DAI)", address: "0x046615F0862392BC5E6FB43C92AAD73DE158D235", - currency: "ethereum/erc20/usd__coin", - balance: "102966480", - spendableBalance: "102966480", + currency: "ethereum/erc20/dai_stablecoin_v2_0", + balance: "81381327", + spendableBalance: "81381327", blockHeight: 168357, }, + { + id: "e86e3bc1-49e1-53fd-a329-96ba6f1b06d3", + name: "Ethereum 1", + address: "0x6EB963EFD0FEF7A4CFAB6CE6F1421C3279D11707", + currency: "ethereum", + balance: "10135465432293584185", + spendableBalance: "10135465432293584185", + blockHeight: 122403, + }, + { + id: "7c99915b-f186-5b44-82cc-fb21fa084292", + name: "Ethereum 1 (DAI)", + address: "0x6EB963EFD0FEF7A4CFAB6CE6F1421C3279D11707", + currency: "ethereum/erc20/dai_stablecoin_v2_0", + balance: "82865885", + spendableBalance: "82865885", + blockHeight: 122403, + }, + { + id: "b60265f4-e52d-5800-9203-1609b9461654", + name: "Bitcoin 3 (legacy)", + address: "13x7TUzymwejUWQmoWusnYcdmC8RNMGG17f", + currency: "bitcoin", + balance: "0", + spendableBalance: "0", + blockHeight: 136277, + }, { id: "2f374bf7-948a-56b8-b967-fd6acd9e1f3d", name: "Ethereum 3", @@ -126,12 +126,12 @@ const account_list_mock = { blockHeight: 181116, }, { - id: "e9ee57d1-f29c-55ed-ad85-de9b6426ce45", - name: "Ethereum 3 (DAI)", + id: "d53ce93d-61d1-5ae1-8258-85a03e47f096", + name: "Ethereum 3 (USDC)", address: "0xE9CAF97C863A92EBB4D76FF37EE71C84D7E09723", - currency: "ethereum/erc20/dai_stablecoin_v2_0", - balance: "45480062", - spendableBalance: "45480062", + currency: "ethereum/erc20/usd__coin", + balance: "106621194", + spendableBalance: "106621194", blockHeight: 181116, }, { @@ -144,12 +144,12 @@ const account_list_mock = { blockHeight: 181116, }, { - id: "d53ce93d-61d1-5ae1-8258-85a03e47f096", - name: "Ethereum 3 (USDC)", + id: "e9ee57d1-f29c-55ed-ad85-de9b6426ce45", + name: "Ethereum 3 (DAI)", address: "0xE9CAF97C863A92EBB4D76FF37EE71C84D7E09723", - currency: "ethereum/erc20/usd__coin", - balance: "106621194", - spendableBalance: "106621194", + currency: "ethereum/erc20/dai_stablecoin_v2_0", + balance: "45480062", + spendableBalance: "45480062", blockHeight: 181116, }, ], @@ -218,7 +218,7 @@ test("Wallet API methods @smoke", async ({ page }) => { }); await drawer.selectCurrency("bitcoin"); - await drawer.selectAccount("bitcoin"); + await drawer.selectAccount("bitcoin", 1); await expect(response).resolves.toMatchObject({ id,