Skip to content

Commit

Permalink
feat: ✨ Adding Bug link to allure
Browse files Browse the repository at this point in the history
  • Loading branch information
VicAlbr committed Dec 9, 2024
1 parent 02418a1 commit 221fee0
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 27 deletions.
24 changes: 15 additions & 9 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 { commandCLI } from "tests/utils/cliUtils";
import { isRunningInScheduledWorkflow } from "tests/utils/githubUtils";
Expand Down Expand Up @@ -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"),
Expand All @@ -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"),
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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();

Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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({
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ for (const account of accounts) {
{
annotation: {
type: "TMS",
description: "B2CQA-249, B2CQA-651, B2CQA-652",
description: account.xrayTicket,
},
},
async ({ app }) => {
Expand Down
43 changes: 31 additions & 12 deletions apps/ledger-live-desktop/tests/specs/speculos/send.tx.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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"),
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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");
Expand Down
3 changes: 3 additions & 0 deletions apps/ledger-live-desktop/tests/specs/speculos/swap.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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."
Expand Down
6 changes: 6 additions & 0 deletions apps/ledger-live-desktop/tests/utils/allureUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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" });
Expand Down
2 changes: 1 addition & 1 deletion apps/ledger-live-desktop/tests/utils/customJsonReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}

Expand Down

0 comments on commit 221fee0

Please sign in to comment.