Skip to content

Commit

Permalink
fix: update account order
Browse files Browse the repository at this point in the history
  • Loading branch information
KVNLS committed Oct 18, 2023
1 parent 1a25eba commit 6709b8e
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 56 deletions.
1 change: 1 addition & 0 deletions apps/ledger-live-desktop/tests/models/AddAccountModal.ts
Expand Up @@ -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;
}
Expand Down
4 changes: 4 additions & 0 deletions apps/ledger-live-desktop/tests/models/LiveAppWebview.ts
Expand Up @@ -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");
Expand Down
Expand Up @@ -61,6 +61,7 @@ test.describe.parallel("Accounts @smoke", () => {
await test.step(`Navigate to first account`, async () => {
await layout.goToAccounts();
await accountsPage.navigateToAccountByName(firstAccountName);
await page.mouse.move(0, 0); // prevent instability if select is hovered
await expect.soft(page).toHaveScreenshot(`${currency}-firstAccountPage.png`);
});

Expand Down
1 change: 1 addition & 0 deletions apps/ledger-live-desktop/tests/specs/services/buy.spec.ts
Expand Up @@ -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
Expand Down
Expand Up @@ -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");
});

Expand Down
Expand Up @@ -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:");
});
Expand Down
108 changes: 54 additions & 54 deletions apps/ledger-live-desktop/tests/specs/services/wallet-api.spec.ts
Expand Up @@ -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)",
Expand All @@ -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",
Expand All @@ -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,
},
{
Expand All @@ -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",
Expand All @@ -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,
},
{
Expand All @@ -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,
},
],
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 6709b8e

Please sign in to comment.