Skip to content

Commit

Permalink
Merge pull request #8634 from LedgerHQ/support/qaa-355
Browse files Browse the repository at this point in the history
[QAA-355] Adding Bug link to allure - e2e testing
  • Loading branch information
VicAlbr authored Dec 10, 2024
2 parents c9dde82 + fd1df2c commit e764d7d
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 28 deletions.
18 changes: 8 additions & 10 deletions apps/ledger-live-desktop/tests/specs/speculos/delegate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ const validators = [
xrayTicket: "B2CQA-2731, B2CQA-2763",
},
{
delegate: new Delegate(Account.SOL_2, "0.001", "Ledger by Chorus One"),
delegate: new Delegate(Account.SOL_2, "0.001", "Ledger by Chorus One"), //Issue with the provider - CI ✅ because failling code is commented - LIVE-14500
xrayTicket: "B2CQA-2730, B2CQA-2764",
},
{
delegate: new Delegate(Account.NEAR_2, "0.01", "ledgerbyfigment.poolv1.near"),
xrayTicket: "B2CQA-2732, B2CQA-2765",
},
{
delegate: new Delegate(Account.ADA_1, "0.01", "LBF3 - Ledger by Figment 3"),
delegate: new Delegate(Account.ADA_1, "0.01", "LBF3 - Ledger by Figment 3"), //Issue with the provider - CI ✅ because failling code is commented - LIVE-14500
xrayTicket: "B2CQA-2766",
},
{
Expand Down Expand Up @@ -74,13 +74,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 @@ -133,13 +131,11 @@ test.describe("Delegate flows", () => {
test(
`[${validator.delegate.account.currency.name}] - Select validator`,
{
annotation: {
type: "TMS",
description: validator.xrayTicket,
},
annotation: { type: "TMS", description: validator.xrayTicket },
},
async ({ app }) => {
await addTmsLink(getDescription(test.info().annotations).split(", "));

await app.layout.goToAccounts();
await app.accounts.navigateToAccountByName(validator.delegate.account.accountName);

Expand Down Expand Up @@ -195,6 +191,7 @@ test.describe("Delegate flows", () => {
},
async ({ app }) => {
await addTmsLink(getDescription(test.info().annotations).split(", "));

await app.layout.goToPortfolio();
await app.portfolio.startStakeFlow();

Expand All @@ -216,6 +213,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 @@ -40,7 +40,7 @@ for (const account of accounts) {
{
annotation: {
type: "TMS",
description: "B2CQA-249, B2CQA-651, B2CQA-652",
description: account.xrayTicket,
},
},
async ({ app }) => {
Expand Down
36 changes: 24 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 { CLI } 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,10 @@ 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",
},*/
},
{
transaction: new Transaction(Account.POL_1, Account.POL_2, "0.001", Fee.SLOW),
xrayTicket: "B2CQA-2807",
Expand Down Expand Up @@ -246,10 +247,7 @@ 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 },
},
async ({ app }) => {
await addTmsLink(getDescription(test.info().annotations).split(", "));
Expand Down Expand Up @@ -317,6 +315,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 @@ -357,6 +357,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 @@ -404,6 +406,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 @@ -440,12 +444,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 @@ -493,6 +502,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 @@ -536,6 +546,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 @@ -577,6 +588,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 @@ -65,6 +63,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 @@ -110,6 +109,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 e764d7d

Please sign in to comment.