diff --git a/apps/ledger-live-desktop/tests/page/account.page.ts b/apps/ledger-live-desktop/tests/page/account.page.ts index 6fe9e8eae741..4d645c0a8913 100644 --- a/apps/ledger-live-desktop/tests/page/account.page.ts +++ b/apps/ledger-live-desktop/tests/page/account.page.ts @@ -26,6 +26,8 @@ export class AccountPage extends AppPage { private advancedButton = this.page.getByText("Advanced"); private accountAdvancedLogs = this.page.getByTestId("Advanced_Logs"); private operationRows = this.page.locator("[data-testid^='operation-row-']"); + private selectSpecificOperation = (operationType: string) => + this.page.locator("[data-testid^='operation-row-']").filter({ hasText: operationType }); private closeModal = this.page.getByTestId("modal-close-button"); private accountbutton = (accountName: string) => this.page.getByRole("button", { name: `${accountName}` }); @@ -81,9 +83,9 @@ export class AccountPage extends AppPage { await this.viewDetailsButton.click(); } - @step("Click on last operation") - async clickOnLastOperation() { - await this.operationRows.first().click(); + @step("Click on last operation ($0)") + async selectAndClickOnLastOperation(operation: string) { + await this.selectSpecificOperation(operation).first().click(); } @step("Click Stake button on banner") diff --git a/apps/ledger-live-desktop/tests/specs/speculos/delegate.spec.ts b/apps/ledger-live-desktop/tests/specs/speculos/delegate.spec.ts index 156d9db6cee8..de4f1e3c9e15 100644 --- a/apps/ledger-live-desktop/tests/specs/speculos/delegate.spec.ts +++ b/apps/ledger-live-desktop/tests/specs/speculos/delegate.spec.ts @@ -1,5 +1,6 @@ import { test } from "../../fixtures/common"; import { Account } from "@ledgerhq/live-common/e2e/enum/Account"; +import { OperationType } from "@ledgerhq/live-common/e2e/enum/OperationType"; import { Delegate } from "../../models/Delegate"; import { addTmsLink } from "tests/utils/allureUtils"; import { getDescription } from "../../utils/customJsonReporter"; @@ -104,7 +105,7 @@ test.describe("Delegate flows", () => { await app.drawer.close(); await app.layout.syncAccounts(); - await app.account.clickOnLastOperation(); + await app.account.selectAndClickOnLastOperation(OperationType.DELEGATE); await app.delegateDrawer.expectDelegationInfos(account.delegate); }, ); diff --git a/apps/ledger-live-desktop/tests/specs/speculos/send.tx.spec.ts b/apps/ledger-live-desktop/tests/specs/speculos/send.tx.spec.ts index e9513e22a627..1b06cbaffece 100644 --- a/apps/ledger-live-desktop/tests/specs/speculos/send.tx.spec.ts +++ b/apps/ledger-live-desktop/tests/specs/speculos/send.tx.spec.ts @@ -1,11 +1,13 @@ import { test } from "../../fixtures/common"; import { Account } from "@ledgerhq/live-common/e2e/enum/Account"; import { Fee } from "@ledgerhq/live-common/e2e/enum/Fee"; +import { OperationType } from "@ledgerhq/live-common/e2e/enum/OperationType"; import { Transaction } from "../../models/Transaction"; -import { addTmsLink, addBugLink } from "tests/utils/allureUtils"; +import { addTmsLink } from "tests/utils/allureUtils"; import { getDescription } from "../../utils/customJsonReporter"; import { CLI } from "tests/utils/cliUtils"; import { isRunningInScheduledWorkflow } from "tests/utils/githubUtils"; +import { getEnv } from "@ledgerhq/live-env"; //Warning 🚨: XRP Tests may fail due to API HTTP 429 issue - Jira: LIVE-14237 @@ -21,10 +23,9 @@ const transactionsAmountInvalid = [ xrayTicket: "B2CQA-2569", }, { - transaction: new Transaction(Account.XRP_1, Account.XRP_3, "1", undefined, "noTag"), - expectedErrorMessage: "Recipient address is inactive. Send at least 10 XRP to activate it", + transaction: new Transaction(Account.XRP_1, Account.XRP_3, "0.1", undefined, "noTag"), + expectedErrorMessage: "Recipient address is inactive. Send at least 1 XRP to activate it", xrayTicket: "B2CQA-2571", - bugTicket: "BACK-8110", }, { transaction: new Transaction(Account.DOT_1, Account.DOT_2, "1.2"), @@ -270,16 +271,18 @@ test.describe("Send flows", () => { transaction.transaction.accountToCredit.address, ); await app.drawer.close(); - - await app.layout.goToAccounts(); - await app.accounts.clickSyncBtnForAccount( - transaction.transaction.accountToCredit.accountName, - ); - await app.accounts.navigateToAccountByName( - transaction.transaction.accountToCredit.accountName, - ); - await app.account.clickOnLastOperation(); - await app.sendDrawer.expectReceiverInfos(transaction.transaction); + // Todo: Update method => Check the receiver account only when we broadcast + if (!getEnv("DISABLE_TRANSACTION_BROADCAST")) { + await app.layout.goToAccounts(); + await app.accounts.clickSyncBtnForAccount( + transaction.transaction.accountToCredit.accountName, + ); + await app.accounts.navigateToAccountByName( + transaction.transaction.accountToCredit.accountName, + ); + await app.account.selectAndClickOnLastOperation(OperationType.RECEIVED); + await app.sendDrawer.expectReceiverInfos(transaction.transaction); + } }, ); }); @@ -444,16 +447,10 @@ test.describe("Send flows", () => { test( `Check "${transaction.expectedErrorMessage}" for ${transaction.transaction.accountToDebit.currency.name} - invalid amount ${transaction.transaction.amount} input error`, { - annotation: [ - { type: "TMS", description: transaction.xrayTicket }, - { type: "BUG", description: transaction.bugTicket }, - ], + annotation: { type: "TMS", description: transaction.xrayTicket }, }, async ({ app }) => { await addTmsLink(getDescription(test.info().annotations).split(", ")); - if (transaction.bugTicket) { - await addBugLink(getDescription(test.info().annotations).split(", ")); - } await app.layout.goToAccounts(); await app.accounts.navigateToAccountByName( diff --git a/libs/ledger-live-common/.unimportedrc.json b/libs/ledger-live-common/.unimportedrc.json index 5f05123af16a..de907b64cc9b 100644 --- a/libs/ledger-live-common/.unimportedrc.json +++ b/libs/ledger-live-common/.unimportedrc.json @@ -313,6 +313,7 @@ "src/deviceSDK/tasks/genuineCheck.ts", "src/e2e/enum/Account.ts", "src/e2e/enum/Nft.ts", + "src/e2e/enum/operationType.ts", "src/e2e/enum/AccountType.ts", "src/e2e/enum/AppInfos.ts", "src/e2e/enum/Currency.ts", diff --git a/libs/ledger-live-common/src/e2e/enum/OperationType.ts b/libs/ledger-live-common/src/e2e/enum/OperationType.ts new file mode 100644 index 000000000000..7919c2605107 --- /dev/null +++ b/libs/ledger-live-common/src/e2e/enum/OperationType.ts @@ -0,0 +1,7 @@ +export enum operationType { + RECEIVED = "Received", + DELEGATED = "Delegated", + NFT_RECEIVED = "NFT Received", + SENT = "Sent", + FEES = "Fees", +}