Skip to content

Commit

Permalink
Addressing PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
VicAlbr committed Dec 19, 2024
1 parent 9ab0ea5 commit 38b2a6e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 18 deletions.
4 changes: 4 additions & 0 deletions apps/ledger-live-desktop/tests/page/asset.page.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
import { step } from "tests/misc/reporters/step";
import { AppPage } from "tests/page/abstractClasses";

export class AssetPage extends AppPage {
private stakeButton = this.page.getByTestId("asset-page-stake-button");
private buyButton = this.page.getByTestId("asset-page-buy-button");
private swapButton = this.page.getByTestId("asset-page-swap-button");

@step("Start stake flow")
async startStakeFlow() {
await this.stakeButton.click();
await this.page.getByText("Choose Account").waitFor({ state: "visible" });
}

@step("Start buy flow")
async startBuyFlow() {
await this.buyButton.click();
}

@step("Start swap flow")
async startSwapFlow() {
await this.swapButton.click();
}
Expand Down
8 changes: 1 addition & 7 deletions apps/ledger-live-desktop/tests/page/swap.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,16 +208,10 @@ export class SwapPage extends AppPage {
await this.chooseAssetDrawer.chooseFromAsset(accountToSwapFrom.currency.name);
}

@step("Expect Highest market cap currency to be selected")
async expectHighestMcapToBeSelected(electronApp: ElectronApplication) {
const [, webview] = electronApp.windows();
expect(webview.getByTestId(this.fromAccountCoinSelector)).toContainText("BTC");
}

@step("Expect asset or account selected $0 to be displayed")
async expectSelectedAssetDisplayed(asset: string, electronApp: ElectronApplication) {
const [, webview] = electronApp.windows();
expect(webview.getByTestId(this.fromAccountCoinSelector)).toContainText(asset);
await expect(webview.getByTestId(this.fromAccountCoinSelector)).toContainText(asset);
}

@step("Fill in amount: $1")
Expand Down
11 changes: 9 additions & 2 deletions apps/ledger-live-desktop/tests/specs/speculos/delegate.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { test } from "../../fixtures/common";
import { Account } from "@ledgerhq/live-common/e2e/enum/Account";
import { Delegate } from "../../models/Delegate";
import { addTmsLink } from "tests/utils/allureUtils";
import { addTmsLink, addBugLink } from "tests/utils/allureUtils";
import { getDescription } from "../../utils/customJsonReporter";
import { CLI } from "tests/utils/cliUtils";
import { Currency } from "@ledgerhq/live-common/e2e/enum/Currency";
Expand All @@ -10,6 +10,7 @@ const e2eDelegationAccounts = [
{
delegate: new Delegate(Account.ATOM_1, "0.001", "Ledger"),
xrayTicket: "B2CQA-2740, B2CQA-2770",
bugLing: "LIVE-14501",
},
{
delegate: new Delegate(Account.SOL_1, "0.001", "Ledger by Figment"),
Expand Down Expand Up @@ -69,10 +70,16 @@ test.describe("Delegate flows", () => {
test(
`[${account.delegate.account.currency.name}] Delegate`,
{
annotation: { type: "TMS", description: account.xrayTicket },
annotation: [
{ type: "TMS", description: account.xrayTicket },
{ type: "BUG", description: account.bugLing },
],
},
async ({ app }) => {
await addTmsLink(getDescription(test.info().annotations, "TMS").split(", "));
if (account.bugLing) {
await addBugLink(getDescription(test.info().annotations, "BUG").split(", "));
}

await app.layout.goToAccounts();
await app.accounts.navigateToAccountByName(account.delegate.account.accountName);
Expand Down
16 changes: 7 additions & 9 deletions apps/ledger-live-desktop/tests/specs/speculos/swap.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const swaps = [
Provider.CHANGELLY,
Rate.FLOAT,
),
xrayTicket: "B2CQA-2828",
xrayTicket: "B2CQA-2775",
},
{
swap: new Swap(
Expand All @@ -132,7 +132,7 @@ const swaps = [
Provider.CHANGELLY,
Rate.FLOAT,
),
xrayTicket: "B2CQA-2827",
xrayTicket: "B2CQA-2776",
},
{
swap: new Swap(
Expand All @@ -143,7 +143,7 @@ const swaps = [
Provider.CHANGELLY,
Rate.FLOAT,
),
xrayTicket: "B2CQA-2829",
xrayTicket: "B2CQA-2777",
},
{
swap: new Swap(
Expand Down Expand Up @@ -436,13 +436,11 @@ test.describe("Swap flow from different entry point", () => {
test.beforeAll(async () => {
process.env.SWAP_DISABLE_APPS_INSTALL = "true";
process.env.SWAP_API_BASE = "https://swap-stg.ledger-test.com/v5";
process.env.DISABLE_TRANSACTION_BROADCAST = "1";
});

test.afterAll(async () => {
delete process.env.SWAP_DISABLE_APPS_INSTALL;
delete process.env.SWAP_API_BASE;
delete process.env.DISABLE_TRANSACTION_BROADCAST;
});

test.use({
Expand All @@ -463,7 +461,7 @@ test.describe("Swap flow from different entry point", () => {
await app.layout.goToPortfolio();
await app.portfolio.clickSwapButton();
await app.swap.waitForPageNetworkIdleState();
await app.swap.expectHighestMcapToBeSelected(electronApp);
await app.swap.expectSelectedAssetDisplayed("BTC", electronApp);
},
);

Expand All @@ -489,7 +487,7 @@ test.describe("Swap flow from different entry point", () => {
);

test(
"Entry Point - Market page - 1",
"Entry Point - Market page - Click on swap for any coin",
{
annotation: {
type: "TMS",
Expand All @@ -515,7 +513,7 @@ test.describe("Swap flow from different entry point", () => {
);

test(
"Entry Point - Market page - 2",
"Entry Point - Market page - More than one account for an asset",
{
annotation: {
type: "TMS",
Expand Down Expand Up @@ -572,7 +570,7 @@ test.describe("Swap flow from different entry point", () => {
await addTmsLink(getDescription(test.info().annotations, "TMS").split(", "));
await app.layout.goToSwap();
await app.swap.waitForPageNetworkIdleState();
await app.swap.expectHighestMcapToBeSelected(electronApp);
await app.swap.expectSelectedAssetDisplayed("BTC", electronApp);
},
);
});
Expand Down

0 comments on commit 38b2a6e

Please sign in to comment.