From c02f0145c883ba47c012a810eecb8ecb2c4f25c6 Mon Sep 17 00:00:00 2001 From: Victor Alber Date: Wed, 15 Jan 2025 14:04:23 +0100 Subject: [PATCH] =?UTF-8?q?test:=20=E2=9C=85=20adding=20ENS=20test=20+=20u?= =?UTF-8?q?pdate=20NFT=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tests/page/modal/send.modal.ts | 10 ++- .../tests/specs/speculos/nft.spec.ts | 2 +- .../tests/specs/speculos/send.tx.spec.ts | 75 +++++++++++++++++++ .../src/e2e/enum/Account.ts | 10 +-- .../src/e2e/enum/DeviceLabels.ts | 1 + .../src/e2e/families/evm.ts | 9 ++- libs/ledger-live-common/src/e2e/speculos.ts | 1 + 7 files changed, 95 insertions(+), 13 deletions(-) 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 f61454bfef06..ff52caab493b 100644 --- a/apps/ledger-live-desktop/tests/page/modal/send.modal.ts +++ b/apps/ledger-live-desktop/tests/page/modal/send.modal.ts @@ -50,7 +50,15 @@ export class SendModal extends Modal { @step("Enter recipient and tag") async fillRecipientInfo(transaction: Transaction) { - await this.fillRecipient(transaction.accountToCredit.address); + await this.fillRecipient( + transaction.accountToCredit.ensName || transaction.accountToCredit.address, + ); + + if (transaction.accountToCredit.ensName) { + const displayedAddress = await this.ENSAddressLabel.innerText(); + expect(displayedAddress).toEqual(transaction.accountToCredit.address); + } + if (transaction.memoTag && transaction.memoTag !== "noTag") { await this.tagInput.clear(); await this.tagInput.fill(transaction.memoTag); diff --git a/apps/ledger-live-desktop/tests/specs/speculos/nft.spec.ts b/apps/ledger-live-desktop/tests/specs/speculos/nft.spec.ts index c92f2b46e1d1..ea79be10c511 100644 --- a/apps/ledger-live-desktop/tests/specs/speculos/nft.spec.ts +++ b/apps/ledger-live-desktop/tests/specs/speculos/nft.spec.ts @@ -14,7 +14,7 @@ test.describe("send NFT to ENS address", () => { test.beforeAll(async () => { process.env.DISABLE_TRANSACTION_BROADCAST = "1"; }); - const transaction = new NFTTransaction(Account.ETH_1, Account.ETH_MC, Nft.PODIUM, Fee.SLOW); + const transaction = new NFTTransaction(Account.ETH_1, Account.ETH_2, Nft.PODIUM, Fee.SLOW); test.use({ userdata: "skip-onboarding", cliCommands: [ 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 3aa124788e6c..30d85e1c3403 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 @@ -604,4 +604,79 @@ test.describe("Send flows", () => { ); }); } + + const originalValue = process.env.DISABLE_TRANSACTION_BROADCAST; // todo: should we broadcast once a week? + + test.describe.only("User send funds to ENS address", () => { + const transactionEnsAddress = new Transaction( + Account.ETH_1, + Account.ETH_2, + "0.0001", + Fee.MEDIUM, + ); + + test.beforeAll(async () => { + process.env.DISABLE_TRANSACTION_BROADCAST = "1"; // todo: should we broadcast once a week? + }); + + test.use({ + userdata: "skip-onboarding", + speculosApp: transactionEnsAddress.accountToDebit.currency.speculosApp, + cliCommands: [ + (appjsonPath: string) => { + return CLI.liveData({ + currency: transactionEnsAddress.accountToCredit.currency.currencyId, + index: transactionEnsAddress.accountToCredit.index, + add: true, + appjson: appjsonPath, + }); + }, + (appjsonPath: string) => { + return CLI.liveData({ + currency: transactionEnsAddress.accountToDebit.currency.currencyId, + index: transactionEnsAddress.accountToDebit.index, + add: true, + appjson: appjsonPath, + }); + }, + ], + }); + test( + `User send funds to ENS address - ${transactionEnsAddress.accountToCredit.ensName}`, + { + annotation: { + type: "TMS", + description: "B2CQA-2202", + }, + }, + async ({ app }) => { + await addTmsLink(getDescription(test.info().annotations, "TMS").split(", ")); + + await app.layout.goToAccounts(); + await app.accounts.navigateToAccountByName( + transactionEnsAddress.accountToDebit.accountName, + ); + + await app.account.clickSend(); + await app.send.craftTx(transactionEnsAddress); + await app.send.countinueSendAmount(); + await app.send.expectTxInfoValidity(transactionEnsAddress); + await app.send.clickContinueToDevice(); + + await app.speculos.signSendTransaction(transactionEnsAddress); + await app.send.expectTxSent(); + await app.account.navigateToViewDetails(); + await app.sendDrawer.addressValueIsVisible(transactionEnsAddress.accountToCredit.address); + await app.drawer.close(); + }, + ); + + test.afterAll(() => { + if (originalValue !== undefined) { + process.env.DISABLE_TRANSACTION_BROADCAST = originalValue; // todo: should we broadcast once a week? + } else { + delete process.env.DISABLE_TRANSACTION_BROADCAST; + } + }); + }); }); diff --git a/libs/ledger-live-common/src/e2e/enum/Account.ts b/libs/ledger-live-common/src/e2e/enum/Account.ts index 965aa4923461..cc73659600f9 100644 --- a/libs/ledger-live-common/src/e2e/enum/Account.ts +++ b/libs/ledger-live-common/src/e2e/enum/Account.ts @@ -159,15 +159,7 @@ export class Account { "0x43047a5023D55a8658Fcb1c1Cea468311AdAA3Ad", undefined, 1, - ); - - static readonly ETH_MC = new Account( - Currency.ETH, - "Ethereum MC", - "0x4258A05DBA420A398bcdFB389E4250759b4223ea", - undefined, - undefined, - "ldgrqamco.eth", + "speculos.eth", ); static readonly ETH_3 = new Account( diff --git a/libs/ledger-live-common/src/e2e/enum/DeviceLabels.ts b/libs/ledger-live-common/src/e2e/enum/DeviceLabels.ts index ea2868183ed3..86a5f1f02ab6 100644 --- a/libs/ledger-live-common/src/e2e/enum/DeviceLabels.ts +++ b/libs/ledger-live-common/src/e2e/enum/DeviceLabels.ts @@ -13,6 +13,7 @@ export enum DeviceLabels { CAPS_APPROVE = "APPROVE", CAPS_REJECT = "REJECT", TO = "To", + TO_DOMAIN = "To (domain)", CANCEL = "Cancel", ACCOUNT = "Account", DESTINATION = "Destination", diff --git a/libs/ledger-live-common/src/e2e/families/evm.ts b/libs/ledger-live-common/src/e2e/families/evm.ts index 6d42c2406438..00b75b8077ab 100644 --- a/libs/ledger-live-common/src/e2e/families/evm.ts +++ b/libs/ledger-live-common/src/e2e/families/evm.ts @@ -7,8 +7,13 @@ export async function sendEVM(tx: Transaction) { const events = await pressUntilTextFound(DeviceLabels.ACCEPT); const isAmountCorrect = containsSubstringInEvent(tx.amount, events); expect(isAmountCorrect).toBeTruthy(); - const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events); - expect(isAddressCorrect).toBeTruthy(); + if (tx.accountToCredit.ensName) { + const isENSNameCorrect = containsSubstringInEvent(tx.accountToCredit.ensName, events); + expect(isENSNameCorrect).toBeTruthy(); + } else { + const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events); + expect(isAddressCorrect).toBeTruthy(); + } await pressBoth(); } diff --git a/libs/ledger-live-common/src/e2e/speculos.ts b/libs/ledger-live-common/src/e2e/speculos.ts index ceda0854cfbf..17f4f1b93947 100644 --- a/libs/ledger-live-common/src/e2e/speculos.ts +++ b/libs/ledger-live-common/src/e2e/speculos.ts @@ -498,6 +498,7 @@ export async function signSendTransaction(tx: Transaction) { switch (currencyName) { case Currency.sepETH: case Currency.POL: + case Currency.ETH: await sendEVM(tx); break; case Currency.DOGE: