Skip to content

Commit

Permalink
test: 💅 updating checks for broadcast
Browse files Browse the repository at this point in the history
  • Loading branch information
VicAlbr committed Dec 11, 2024
1 parent e764d7d commit 0c14853
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 25 deletions.
8 changes: 5 additions & 3 deletions apps/ledger-live-desktop/tests/page/account.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export class AccountPage extends AppPage {
private advancedButton = this.page.getByText("Advanced");
private accountAdvancedLogs = this.page.getByTestId("Advanced_Logs");
private operationRows = this.page.locator("[data-testid^='operation-row-']");
private selectSpecificOperation = (operationType: string) =>
this.page.locator("[data-testid^='operation-row-']").filter({ hasText: operationType });
private closeModal = this.page.getByTestId("modal-close-button");
private accountbutton = (accountName: string) =>
this.page.getByRole("button", { name: `${accountName}` });
Expand Down Expand Up @@ -81,9 +83,9 @@ export class AccountPage extends AppPage {
await this.viewDetailsButton.click();
}

@step("Click on last operation")
async clickOnLastOperation() {
await this.operationRows.first().click();
@step("Click on last operation ($0)")
async selectAndClickOnLastOperation(operation: string) {
await this.selectSpecificOperation(operation).first().click();
}

@step("Click Stake button on banner")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { test } from "../../fixtures/common";
import { Account } from "@ledgerhq/live-common/e2e/enum/Account";
import { OperationType } from "@ledgerhq/live-common/e2e/enum/OperationType";
import { Delegate } from "../../models/Delegate";
import { addTmsLink } from "tests/utils/allureUtils";
import { getDescription } from "../../utils/customJsonReporter";
Expand Down Expand Up @@ -104,7 +105,7 @@ test.describe("Delegate flows", () => {
await app.drawer.close();

await app.layout.syncAccounts();
await app.account.clickOnLastOperation();
await app.account.selectAndClickOnLastOperation(OperationType.DELEGATE);
await app.delegateDrawer.expectDelegationInfos(account.delegate);
},
);
Expand Down
39 changes: 18 additions & 21 deletions apps/ledger-live-desktop/tests/specs/speculos/send.tx.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { test } from "../../fixtures/common";
import { Account } from "@ledgerhq/live-common/e2e/enum/Account";
import { Fee } from "@ledgerhq/live-common/e2e/enum/Fee";
import { OperationType } from "@ledgerhq/live-common/e2e/enum/OperationType";
import { Transaction } from "../../models/Transaction";
import { addTmsLink, addBugLink } from "tests/utils/allureUtils";
import { addTmsLink } from "tests/utils/allureUtils";
import { getDescription } from "../../utils/customJsonReporter";
import { CLI } from "tests/utils/cliUtils";
import { isRunningInScheduledWorkflow } from "tests/utils/githubUtils";
import { getEnv } from "@ledgerhq/live-env";

//Warning 🚨: XRP Tests may fail due to API HTTP 429 issue - Jira: LIVE-14237

Expand All @@ -21,10 +23,9 @@ const transactionsAmountInvalid = [
xrayTicket: "B2CQA-2569",
},
{
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",
transaction: new Transaction(Account.XRP_1, Account.XRP_3, "0.1", undefined, "noTag"),
expectedErrorMessage: "Recipient address is inactive. Send at least 1 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 @@ -270,16 +271,18 @@ test.describe("Send flows", () => {
transaction.transaction.accountToCredit.address,
);
await app.drawer.close();

await app.layout.goToAccounts();
await app.accounts.clickSyncBtnForAccount(
transaction.transaction.accountToCredit.accountName,
);
await app.accounts.navigateToAccountByName(
transaction.transaction.accountToCredit.accountName,
);
await app.account.clickOnLastOperation();
await app.sendDrawer.expectReceiverInfos(transaction.transaction);
// Todo: Update method => Check the receiver account only when we broadcast
if (!getEnv("DISABLE_TRANSACTION_BROADCAST")) {
await app.layout.goToAccounts();
await app.accounts.clickSyncBtnForAccount(
transaction.transaction.accountToCredit.accountName,
);
await app.accounts.navigateToAccountByName(
transaction.transaction.accountToCredit.accountName,
);
await app.account.selectAndClickOnLastOperation(OperationType.RECEIVED);
await app.sendDrawer.expectReceiverInfos(transaction.transaction);
}
},
);
});
Expand Down Expand Up @@ -444,16 +447,10 @@ 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 },
{ type: "BUG", description: transaction.bugTicket },
],
annotation: { type: "TMS", description: transaction.xrayTicket },
},
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
1 change: 1 addition & 0 deletions libs/ledger-live-common/.unimportedrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@
"src/deviceSDK/tasks/genuineCheck.ts",
"src/e2e/enum/Account.ts",
"src/e2e/enum/Nft.ts",
"src/e2e/enum/OperationType.ts",
"src/e2e/enum/AccountType.ts",
"src/e2e/enum/AppInfos.ts",
"src/e2e/enum/Currency.ts",
Expand Down
7 changes: 7 additions & 0 deletions libs/ledger-live-common/src/e2e/enum/OperationType.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export enum OperationType {
RECEIVED = "Received",
DELEGATED = "Delegated",
NFT_RECEIVED = "NFT Received",
SENT = "Sent",
FEES = "Fees",
}

0 comments on commit 0c14853

Please sign in to comment.