From 221fee08ea091a04510e99170f84c73a38d8ab4c Mon Sep 17 00:00:00 2001 From: Victor Alber Date: Thu, 5 Dec 2024 14:17:26 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20=E2=9C=A8=20Adding=20Bug=20link=20to=20?= =?UTF-8?q?allure?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tests/specs/speculos/delegate.spec.ts | 24 +++++++---- .../tests/specs/speculos/portfolio.spec.ts | 4 ++ .../specs/speculos/receive.address.spec.ts | 2 +- .../tests/specs/speculos/send.tx.spec.ts | 43 +++++++++++++------ .../tests/specs/speculos/settings.spec.ts | 8 ++-- .../tests/specs/speculos/swap.spec.ts | 3 ++ .../tests/utils/allureUtils.ts | 6 +++ .../tests/utils/customJsonReporter.ts | 2 +- 8 files changed, 65 insertions(+), 27 deletions(-) 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 214660444c95..5603fc671aec 100644 --- a/apps/ledger-live-desktop/tests/specs/speculos/delegate.spec.ts +++ b/apps/ledger-live-desktop/tests/specs/speculos/delegate.spec.ts @@ -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 { commandCLI } from "tests/utils/cliUtils"; import { isRunningInScheduledWorkflow } from "tests/utils/githubUtils"; @@ -30,6 +30,7 @@ const validators = [ { delegate: new Delegate(Account.SOL_2, "0.001", "Ledger by Chorus One"), xrayTicket: "B2CQA-2730, B2CQA-2764", + bugTicket: "LIVE-14500", }, { delegate: new Delegate(Account.NEAR_2, "0.01", "ledgerbyfigment.poolv1.near"), @@ -38,6 +39,7 @@ const validators = [ { delegate: new Delegate(Account.ADA_1, "0.01", "LBF3 - Ledger by Figment 3"), xrayTicket: "B2CQA-2766", + bug: "LIVE-14500", }, { delegate: new Delegate(Account.MULTIVERS_X_1, "1", "Ledger by Figment"), @@ -75,13 +77,11 @@ test.describe("Delegate flows", () => { test( `[${account.delegate.account.currency.name}] Delegate`, { - annotation: { - type: "TMS", - description: account.xrayTicket, - }, + annotation: { type: "TMS", description: account.xrayTicket }, }, async ({ app }) => { await addTmsLink(getDescription(test.info().annotations).split(", ")); + await app.layout.goToAccounts(); await app.accounts.navigateToAccountByName(account.delegate.account.accountName); @@ -135,13 +135,17 @@ test.describe("Delegate flows", () => { test( `[${validator.delegate.account.currency.name}] - Select validator`, { - annotation: { - type: "TMS", - description: validator.xrayTicket, - }, + annotation: [ + { type: "TMS", description: validator.xrayTicket }, + { type: "BUG", description: validator.bugTicket }, + ], }, async ({ app }) => { await addTmsLink(getDescription(test.info().annotations).split(", ")); + if (validator.bugTicket) { + await addBugLink(getDescription(test.info().annotations).split(", ")); + } + await app.layout.goToAccounts(); await app.accounts.navigateToAccountByName(validator.delegate.account.accountName); @@ -198,6 +202,7 @@ test.describe("Delegate flows", () => { }, async ({ app }) => { await addTmsLink(getDescription(test.info().annotations).split(", ")); + await app.layout.goToPortfolio(); await app.portfolio.startStakeFlow(); @@ -219,6 +224,7 @@ test.describe("Delegate flows", () => { }, async ({ app }) => { await addTmsLink(getDescription(test.info().annotations).split(", ")); + await app.layout.goToMarket(); await app.market.search(delegateAccount.account.currency.name); await app.market.stakeButtonClick(delegateAccount.account.currency.ticker); diff --git a/apps/ledger-live-desktop/tests/specs/speculos/portfolio.spec.ts b/apps/ledger-live-desktop/tests/specs/speculos/portfolio.spec.ts index 58f4fde7c2b2..d5d27c862fdb 100644 --- a/apps/ledger-live-desktop/tests/specs/speculos/portfolio.spec.ts +++ b/apps/ledger-live-desktop/tests/specs/speculos/portfolio.spec.ts @@ -1,4 +1,6 @@ import { test } from "../../fixtures/common"; +import { addTmsLink } from "tests/utils/allureUtils"; +import { getDescription } from "../../utils/customJsonReporter"; test.describe("Portfolio", () => { test.use({ @@ -13,6 +15,8 @@ test.describe("Portfolio", () => { }, }, async ({ app }) => { + await addTmsLink(getDescription(test.info().annotations).split(", ")); + await app.layout.goToPortfolio(); await app.portfolio.checkBuySellButtonVisibility(); await app.portfolio.checkStakeButtonVisibility(); diff --git a/apps/ledger-live-desktop/tests/specs/speculos/receive.address.spec.ts b/apps/ledger-live-desktop/tests/specs/speculos/receive.address.spec.ts index 818ae768b4f2..27cee30acfde 100644 --- a/apps/ledger-live-desktop/tests/specs/speculos/receive.address.spec.ts +++ b/apps/ledger-live-desktop/tests/specs/speculos/receive.address.spec.ts @@ -41,7 +41,7 @@ for (const account of accounts) { { annotation: { type: "TMS", - description: "B2CQA-249, B2CQA-651, B2CQA-652", + description: account.xrayTicket, }, }, async ({ app }) => { 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 ddda98ebfd24..ca7cc7e65987 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 @@ -2,7 +2,7 @@ import { test } from "../../fixtures/common"; import { Account } from "@ledgerhq/live-common/e2e/enum/Account"; import { Fee } from "@ledgerhq/live-common/e2e/enum/Fee"; import { Transaction } from "../../models/Transaction"; -import { addTmsLink } from "tests/utils/allureUtils"; +import { addTmsLink, addBugLink } from "tests/utils/allureUtils"; import { getDescription } from "../../utils/customJsonReporter"; import { commandCLI } from "tests/utils/cliUtils"; import { isRunningInScheduledWorkflow } from "tests/utils/githubUtils"; @@ -24,6 +24,7 @@ const transactionsAmountInvalid = [ 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", xrayTicket: "B2CQA-2571", + bugTicket: "BACK-8110", }, { transaction: new Transaction(Account.DOT_1, Account.DOT_2, "1.2"), @@ -144,10 +145,11 @@ const transactionAddressValid = [ ]; const transactionE2E = [ - /*{ - transaction: new Transaction(Account.sep_ETH_1, Account.sep_ETH_2, "0.00001", Fee.SLOW), //todo: Reactivate when BE issue is fixed - LIVE-14844 + { + transaction: new Transaction(Account.sep_ETH_1, Account.sep_ETH_2, "0.00001", Fee.SLOW), xrayTicket: "B2CQA-2574", - },*/ + bugTicket: "LIVE-14844", + }, { transaction: new Transaction(Account.POL_1, Account.POL_2, "0.001", Fee.SLOW), xrayTicket: "B2CQA-2807", @@ -248,13 +250,16 @@ test.describe("Send flows", () => { test( `Send from ${transaction.transaction.accountToDebit.accountName} to ${transaction.transaction.accountToCredit.accountName}`, { - annotation: { - type: "TMS", - description: transaction.xrayTicket, - }, + annotation: [ + { type: "TMS", description: transaction.xrayTicket }, + { type: "BUG", description: transaction.bugTicket }, + ], }, 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( @@ -320,6 +325,8 @@ test.describe("Send flows", () => { }, }, async ({ app }) => { + await addTmsLink(getDescription(test.info().annotations).split(", ")); + await app.layout.goToAccounts(); await app.accounts.navigateToAccountByName( tokenTransactionInvalid.transaction.accountToDebit.accountName, @@ -361,6 +368,8 @@ test.describe("Send flows", () => { }, }, async ({ app }) => { + await addTmsLink(getDescription(test.info().annotations).split(", ")); + await app.layout.goToAccounts(); await app.accounts.navigateToAccountByName( transaction.transaction.accountToDebit.accountName, @@ -409,6 +418,8 @@ test.describe("Send flows", () => { }, }, async ({ app }) => { + await addTmsLink(getDescription(test.info().annotations).split(", ")); + await app.layout.goToAccounts(); await app.accounts.navigateToAccountByName( tokenTransactionValid.accountToDebit.accountName, @@ -446,12 +457,17 @@ 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, - }, + annotation: [ + { type: "TMS", description: transaction.xrayTicket }, + { type: "BUG", description: transaction.bugTicket }, + ], }, 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( transaction.transaction.accountToDebit.accountName, @@ -500,6 +516,7 @@ test.describe("Send flows", () => { }, async ({ app }) => { await addTmsLink(getDescription(test.info().annotations).split(", ")); + await app.layout.goToAccounts(); await app.accounts.navigateToAccountByName( transactionInputValid.accountToDebit.accountName, @@ -544,6 +561,7 @@ test.describe("Send flows", () => { }, async ({ app }) => { await addTmsLink(getDescription(test.info().annotations).split(", ")); + await app.layout.goToAccounts(); await app.accounts.navigateToAccountByName( transaction.transaction.accountToDebit.accountName, @@ -586,6 +604,7 @@ test.describe("Send flows", () => { }, async ({ app }) => { await addTmsLink(getDescription(test.info().annotations).split(", ")); + await app.layout.goToAccounts(); await app.accounts.navigateToAccountByName( transaction.transaction.accountToDebit.accountName, diff --git a/apps/ledger-live-desktop/tests/specs/speculos/settings.spec.ts b/apps/ledger-live-desktop/tests/specs/speculos/settings.spec.ts index be183cc26793..fd0e35e44ac3 100644 --- a/apps/ledger-live-desktop/tests/specs/speculos/settings.spec.ts +++ b/apps/ledger-live-desktop/tests/specs/speculos/settings.spec.ts @@ -12,13 +12,11 @@ test.describe("Settings", () => { test( `ERC20 token with 0 balance is hidden if 'hide empty token accounts' is ON`, { - annotation: { - type: "TMS", - description: "B2CQA-817", - }, + annotation: [{ type: "TMS", description: "B2CQA-817" }], }, async ({ app }) => { await addTmsLink(getDescription(test.info().annotations).split(", ")); + await app.layout.goToAccounts(); await app.accounts.showParentAccountTokens(Account.ETH_1.accountName); await app.accounts.verifyTokenVisibility( @@ -66,6 +64,7 @@ test.describe("Password", () => { }, async ({ app }) => { await addTmsLink(getDescription(test.info().annotations).split(", ")); + await app.layout.goToAccounts(); const countBeforeLock = await app.accounts.countAccounts(); await app.layout.goToSettings(); @@ -112,6 +111,7 @@ test.describe("counter value selection", () => { }, async ({ app }) => { await addTmsLink(getDescription(test.info().annotations).split(", ")); + await app.layout.goToSettings(); await app.settings.changeCounterValue("euro"); await app.settings.expectCounterValue("Euro - EUR"); diff --git a/apps/ledger-live-desktop/tests/specs/speculos/swap.spec.ts b/apps/ledger-live-desktop/tests/specs/speculos/swap.spec.ts index fd8e9e00b2b7..197c4d5c34c9 100644 --- a/apps/ledger-live-desktop/tests/specs/speculos/swap.spec.ts +++ b/apps/ledger-live-desktop/tests/specs/speculos/swap.spec.ts @@ -222,6 +222,7 @@ for (const { swap, xrayTicket } of swaps) { }, async ({ app, electronApp }) => { await addTmsLink(getDescription(test.info().annotations).split(", ")); + await performSwapUntilQuoteSelectionStep(app, electronApp, swap); await app.swap.selectQuote(electronApp, swap.provider.name, swap.rate); await performSwapUntilDeviceVerificationStep(app, electronApp, swap); @@ -285,6 +286,7 @@ for (const { swap, xrayTicket } of rejectedSwaps) { }, async ({ app, electronApp }) => { await addTmsLink(getDescription(test.info().annotations).split(", ")); + await performSwapUntilQuoteSelectionStep(app, electronApp, swap); await app.swap.selectQuote(electronApp, swap.provider.name, swap.rate); await performSwapUntilDeviceVerificationStep(app, electronApp, swap); @@ -375,6 +377,7 @@ for (const { swap, xrayTicket } of tooLowAmountForQuoteSwaps) { }, async ({ app, electronApp }) => { await addTmsLink(getDescription(test.info().annotations).split(", ")); + await performSwapUntilQuoteSelectionStep(app, electronApp, swap); const errorMessage = swap.accountToDebit.accountType ? "Not enough balance." diff --git a/apps/ledger-live-desktop/tests/utils/allureUtils.ts b/apps/ledger-live-desktop/tests/utils/allureUtils.ts index 9efe66919c44..9cb91d25cc05 100644 --- a/apps/ledger-live-desktop/tests/utils/allureUtils.ts +++ b/apps/ledger-live-desktop/tests/utils/allureUtils.ts @@ -13,6 +13,12 @@ export async function addTmsLink(ids: string[]) { } } +export async function addBugLink(ids: string[]) { + for (const id of ids) { + await allure.issue(id, `https://ledgerhq.atlassian.net/browse/${id}`); + } +} + export async function captureArtifacts(page: Page, testInfo: TestInfo) { const screenshot = await page.screenshot(); await testInfo.attach("Screenshot", { body: screenshot, contentType: "image/png" }); diff --git a/apps/ledger-live-desktop/tests/utils/customJsonReporter.ts b/apps/ledger-live-desktop/tests/utils/customJsonReporter.ts index 16f6c9a85a05..d54c565c7c6e 100644 --- a/apps/ledger-live-desktop/tests/utils/customJsonReporter.ts +++ b/apps/ledger-live-desktop/tests/utils/customJsonReporter.ts @@ -3,7 +3,7 @@ import * as fs from "fs"; import * as path from "path"; export function getDescription(annotations: any) { - const annotation = annotations.find((ann: any) => ann.type === "TMS"); + const annotation = annotations.find((ann: any) => ann.type === "TMS" || ann.type === "BUG"); return annotation ? annotation.description : "Type not found"; }