diff --git a/apps/ledger-live-desktop/tests/families/algorand.ts b/apps/ledger-live-desktop/tests/families/algorand.ts index bd2a9ae0e914..b1f7a016305f 100644 --- a/apps/ledger-live-desktop/tests/families/algorand.ts +++ b/apps/ledger-live-desktop/tests/families/algorand.ts @@ -11,10 +11,8 @@ export async function sendAlgorand(tx: Transaction) { const events = await pressUntilTextFound(DeviceLabels.CAPS_APPROVE); const isAmountCorrect = containsSubstringInEvent(tx.amount, events); expect(isAmountCorrect).toBeTruthy(); - - //Todo: Ractivate after QAA-319 - //const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events); - //expect(isAddressCorrect).toBeTruthy(); + const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events); + expect(isAddressCorrect).toBeTruthy(); await pressBoth(); } diff --git a/apps/ledger-live-desktop/tests/families/cardano.ts b/apps/ledger-live-desktop/tests/families/cardano.ts index c8e39613caf1..7433b878e87c 100644 --- a/apps/ledger-live-desktop/tests/families/cardano.ts +++ b/apps/ledger-live-desktop/tests/families/cardano.ts @@ -22,7 +22,6 @@ export async function sendCardano(tx: Transaction) { await waitFor(DeviceLabels.CONFIRM_TRANSACTION); await pressBoth(); - //Todo: Ractivate after QAA-319 - //const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events); - //expect(isAddressCorrect).toBeTruthy(); + const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events); + expect(isAddressCorrect).toBeTruthy(); } diff --git a/apps/ledger-live-desktop/tests/families/stellar.ts b/apps/ledger-live-desktop/tests/families/stellar.ts index 8389ffd5d425..3936ad2ffe71 100644 --- a/apps/ledger-live-desktop/tests/families/stellar.ts +++ b/apps/ledger-live-desktop/tests/families/stellar.ts @@ -12,9 +12,8 @@ export async function sendStellar(tx: Transaction) { const isAmountCorrect = containsSubstringInEvent(tx.amount, events); expect(isAmountCorrect).toBeTruthy(); - //Todo: Ractivate after QAA-319 - //const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events); - //expect(isAddressCorrect).toBeTruthy(); + const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events); + expect(isAddressCorrect).toBeTruthy(); await pressBoth(); } diff --git a/apps/ledger-live-desktop/tests/models/Transaction.ts b/apps/ledger-live-desktop/tests/models/Transaction.ts index 08333b27e952..42ad80fd4733 100644 --- a/apps/ledger-live-desktop/tests/models/Transaction.ts +++ b/apps/ledger-live-desktop/tests/models/Transaction.ts @@ -6,7 +6,7 @@ export class Transaction { public accountToDebit: Account, public accountToCredit: Account, public amount: string, - public speed: Fee, + public speed?: Fee, public memoTag?: string, ) {} } diff --git a/apps/ledger-live-desktop/tests/page/modal/send.modal.ts b/apps/ledger-live-desktop/tests/page/modal/send.modal.ts index 433dec0675a0..ea7bfcb94296 100644 --- a/apps/ledger-live-desktop/tests/page/modal/send.modal.ts +++ b/apps/ledger-live-desktop/tests/page/modal/send.modal.ts @@ -2,7 +2,6 @@ import { expect } from "@playwright/test"; import { Modal } from "../../component/modal.component"; import { step } from "tests/misc/reporters/step"; import { Transaction } from "../../models/Transaction"; -import { Currency } from "tests/enum/Currency"; export class SendModal extends Modal { private drowdownAccount = this.page.locator('[data-testid="modal-content"] svg').nth(1); @@ -42,7 +41,7 @@ export class SendModal extends Modal { @step("Enter recipient and tag") async fillRecipientInfo(transaction: Transaction) { await this.fillRecipient(transaction.accountToCredit.address); - if (transaction.memoTag) { + if (transaction.memoTag && transaction.memoTag !== "noTag") { await this.tagInput.clear(); await this.tagInput.fill(transaction.memoTag); } @@ -50,19 +49,16 @@ export class SendModal extends Modal { @step("Fill tx information") async craftTx(tx: Transaction) { - const memotagModalCurrencies = [Currency.XLM, Currency.ADA, Currency.ATOM]; - const feeStrategyCurrencies = [Currency.sepETH, Currency.POL, Currency.DOGE, Currency.BCH]; - await this.fillRecipientInfo(tx); await this.continueButton.click(); - if (memotagModalCurrencies.includes(tx.accountToDebit.currency)) { + if (tx.memoTag === "noTag") { await this.noTagButton.click(); } await this.cryptoAmountField.fill(tx.amount); - if (feeStrategyCurrencies.includes(tx.accountToDebit.currency)) { + if (tx.speed !== undefined) { await this.feeStrategy(tx.speed).click(); } 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 d8d9c1ea3c7a..b02b1aed8dc0 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 @@ -20,17 +20,17 @@ const transactionsAmountInvalid = [ xrayTicket: "B2CQA-2569", }, { - transaction: new Transaction(Account.XRP_1, Account.XRP_3, "1", Fee.MEDIUM), + transaction: new Transaction(Account.XRP_1, Account.XRP_3, "1"), expectedErrorMessage: "Recipient address is inactive. Send at least 10 XRP to activate it", xrayTicket: "B2CQA-2571", }, { - transaction: new Transaction(Account.DOT_1, Account.DOT_2, "1.2", Fee.MEDIUM), + transaction: new Transaction(Account.DOT_1, Account.DOT_2, "1.2"), expectedErrorMessage: "Balance cannot be below 1 DOT. Send max to empty account.", xrayTicket: "B2CQA-2567", }, { - transaction: new Transaction(Account.DOT_1, Account.DOT_3, "0.5", Fee.MEDIUM), + transaction: new Transaction(Account.DOT_1, Account.DOT_3, "0.5"), expectedErrorMessage: "Recipient address is inactive. Send at least 1 DOT to activate it", xrayTicket: "B2CQA-2570", }, @@ -53,17 +53,17 @@ const transactionsAddressInvalid = [ xrayTicket: "B2CQA-2710", }, { - transaction: new Transaction(Account.DOT_1, Account.DOT_1, "0.5", Fee.MEDIUM), + transaction: new Transaction(Account.DOT_1, Account.DOT_1, "0.5"), expectedErrorMessage: "Recipient address is the same as the sender address", xrayTicket: "B2CQA-2711", }, { - transaction: new Transaction(Account.XRP_1, Account.XRP_1, "1", Fee.MEDIUM, "123456"), + transaction: new Transaction(Account.XRP_1, Account.XRP_1, "1", undefined, "123456"), expectedErrorMessage: "Recipient address is the same as the sender address", xrayTicket: "B2CQA-2712", }, { - transaction: new Transaction(Account.ATOM_1, Account.ATOM_1, "0.00001", Fee.MEDIUM), + transaction: new Transaction(Account.ATOM_1, Account.ATOM_1, "0.00001"), expectedErrorMessage: "Recipient address is the same as the sender address", xrayTicket: "B2CQA-2713", }, @@ -86,22 +86,22 @@ const transactionAddressValid = [ xrayTicket: "B2CQA-2717", }, { - transaction: new Transaction(Account.XRP_1, Account.XRP_2, "1", Fee.MEDIUM, "123456"), + transaction: new Transaction(Account.XRP_1, Account.XRP_2, "1", undefined, "123456"), expectedWarningMessage: null, xrayTicket: "B2CQA-2718", }, { - transaction: new Transaction(Account.XRP_1, Account.XRP_2, "2", Fee.MEDIUM), + transaction: new Transaction(Account.XRP_1, Account.XRP_2, "2"), expectedWarningMessage: null, xrayTicket: "B2CQA-2719", }, { - transaction: new Transaction(Account.ATOM_1, Account.ATOM_2, "0.00001", Fee.MEDIUM, "123456"), + transaction: new Transaction(Account.ATOM_1, Account.ATOM_2, "0.00001", undefined, "123456"), expectedWarningMessage: null, xrayTicket: "B2CQA-2720", }, { - transaction: new Transaction(Account.ATOM_1, Account.ATOM_2, "0.0001", Fee.MEDIUM), + transaction: new Transaction(Account.ATOM_1, Account.ATOM_2, "0.0001"), expectedWarningMessage: null, xrayTicket: "B2CQA-2721", }, @@ -160,35 +160,35 @@ const transactionE2E = [ xrayTicket: "B2CQA-2808", }, { - transaction: new Transaction(Account.DOT_1, Account.DOT_2, "0.0001", Fee.SLOW), + transaction: new Transaction(Account.DOT_1, Account.DOT_2, "0.0001"), xrayTicket: "B2CQA-2809", }, { - transaction: new Transaction(Account.ALGO_1, Account.ALGO_2, "0.001", Fee.SLOW), + transaction: new Transaction(Account.ALGO_1, Account.ALGO_2, "0.001"), xrayTicket: "B2CQA-2810", }, { - transaction: new Transaction(Account.SOL_1, Account.SOL_2, "0.000001", Fee.SLOW), + transaction: new Transaction(Account.SOL_1, Account.SOL_2, "0.000001"), xrayTicket: "B2CQA-2811", }, { - transaction: new Transaction(Account.TRX_1, Account.TRX_2, "0.01", Fee.SLOW), + transaction: new Transaction(Account.TRX_1, Account.TRX_2, "0.01"), xrayTicket: "B2CQA-2812", }, { - transaction: new Transaction(Account.XLM_1, Account.XLM_2, "0.0001", Fee.SLOW), + transaction: new Transaction(Account.XLM_1, Account.XLM_2, "0.0001", undefined, "noTag"), xrayTicket: "B2CQA-2813", }, { - transaction: new Transaction(Account.ATOM_1, Account.ATOM_2, "0.0001", Fee.SLOW), + transaction: new Transaction(Account.ATOM_1, Account.ATOM_2, "0.0001", undefined, "noTag"), xrayTicket: "B2CQA-2814", }, { - transaction: new Transaction(Account.ADA_1, Account.ADA_1, "1", Fee.SLOW), + transaction: new Transaction(Account.ADA_1, Account.ADA_1, "1", undefined, "noTag"), xrayTicket: "B2CQA-2815", }, { - transaction: new Transaction(Account.XRP_1, Account.XRP_2, "0.0001", Fee.SLOW), + transaction: new Transaction(Account.XRP_1, Account.XRP_2, "0.0001"), xrayTicket: "B2CQA-2816", }, ]; diff --git a/libs/ledger-live-common/src/e2e/speculos.ts b/libs/ledger-live-common/src/e2e/speculos.ts index 349058d3de86..0d5fffe6416d 100644 --- a/libs/ledger-live-common/src/e2e/speculos.ts +++ b/libs/ledger-live-common/src/e2e/speculos.ts @@ -399,8 +399,17 @@ async function pressRightButton(speculosApiPort: number): Promise { } export function containsSubstringInEvent(targetString: string, events: string[]): boolean { - const relevantEvent = events.find(entry => entry.includes(targetString.slice(0, 6))); - return !!relevantEvent && events.join("").includes(targetString); + const concatenatedEvents = events.join(""); + + let result = concatenatedEvents.includes(targetString); + + if (!result) { + const regexPattern = targetString.split("").join(".*?"); + const regex = new RegExp(regexPattern, "s"); + result = regex.test(concatenatedEvents); + } + + return result; } export async function takeScreenshot() {