Skip to content

Commit

Permalink
test: Adding checks - add Account - B2CQA-2073
Browse files Browse the repository at this point in the history
  • Loading branch information
VicAlbr committed Jan 14, 2025
1 parent 412d1ff commit 600dbb1
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ const OperationD = (props: Props) => {
<Box mr={2}>
{hasFailed ? null : (
<CounterValue
data-testid="operation-amount"
alwaysShowSign
color="palette.text.shade60"
fontSize={3}
Expand Down Expand Up @@ -615,7 +616,9 @@ const OperationD = (props: Props) => {
</Box>

<TextEllipsis>
<Link onClick={goToMainAccount}>{name}</Link>
<Link data-testId="account-name" onClick={goToMainAccount}>
{name}
</Link>
</TextEllipsis>
<AccountTagDerivationMode account={account} />
</Box>
Expand All @@ -640,13 +643,13 @@ const OperationD = (props: Props) => {
{isNftOperation ? <NFTOperationDetails operation={operation} /> : null}
<OpDetailsSection>
<OpDetailsTitle>{t("operationDetails.date")}</OpDetailsTitle>
<OpDetailsData>{dateFormatted}</OpDetailsData>
<OpDetailsData data-testid="operation-date">{dateFormatted}</OpDetailsData>
</OpDetailsSection>
<B />
<OpDetailsSection>
<OpDetailsTitle>{t("operationDetails.identifier")}</OpDetailsTitle>
<OpDetailsData>
<HashContainer>
<HashContainer data-testid="operation-id">
<SplitAddress value={hash} />
</HashContainer>
<GradientHover>
Expand Down
39 changes: 39 additions & 0 deletions apps/ledger-live-desktop/tests/page/drawer/operation.drawer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { step } from "tests/misc/reporters/step";
import { Drawer } from "tests/component/drawer.component";
import { expect } from "@playwright/test";

export class OperationDrawer extends Drawer {
readonly drawer = this.page.getByTestId("drawer-content");
readonly transactionIdLabel = this.page.getByText("Transaction ID");
readonly transactionIdValue = this.page.getByTestId("operation-id");
readonly dateLabel = this.page.getByText("Date");
readonly dateValue = this.page.getByTestId("operation-date");
readonly amountLabel = this.page.getByText("Amount", { exact: true });
readonly amountValue = this.page.getByTestId("operation-amount");
readonly transactionType = this.page.getByTestId("transaction-type");
readonly drawerCloseButton = this.page.getByTestId("drawer-close-button");
readonly accountName = this.page.getByTestId("account-name");

@step("Verify drawer information")
async expectDrawerInfos(accountName: string) {
await expect(this.drawer).toBeVisible();
const transactionType = await this.transactionType.textContent();
await expect(this.transactionType).toBeVisible();
await expect(this.accountName).toHaveText(accountName);
await expect(this.dateLabel).toBeVisible();
expect(await this.dateValue.textContent()).toMatch(
/^\d{1,2}\/\d{1,2}\/\d{4}, \d{1,2}:\d{2} (AM|PM)$/,
);
await expect(this.transactionIdLabel).toBeVisible();
expect(await this.transactionIdValue.textContent()).toMatch(/^[a-zA-Z0-9+/=]{40,}$/);
if (transactionType !== "NFT Received") {
await expect(this.amountLabel).toBeVisible();
expect(await this.amountValue.textContent()).toMatch(/^[+-]?\$\d+\.\d{2}$/);
}
}

@step("Close drawer")
async closeDrawer() {
await this.drawerCloseButton.click();
}
}
2 changes: 2 additions & 0 deletions apps/ledger-live-desktop/tests/page/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { NftGallery } from "./nftGallery.page";
import { AssetPage } from "./asset.page";
import { SettingsModal } from "tests/page/modal/settings.modal";
import { OnboardingPage } from "tests/page/onboarding.page";
import { OperationDrawer } from "./drawer/operation.drawer";

export class Application extends PageHolder {
public account = new AccountPage(this.page);
Expand Down Expand Up @@ -53,4 +54,5 @@ export class Application extends PageHolder {
public assetPage = new AssetPage(this.page);
public settingsModal = new SettingsModal(this.page);
public onboarding = new OnboardingPage(this.page);
public operationDrawer = new OperationDrawer(this.page);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import { addTmsLink } from "tests/utils/allureUtils";
import { getDescription } from "../../utils/customJsonReporter";

const currencies = [
{ currency: Currency.BTC, xrayTicket: "B2CQA-2499, B2CQA-2644, B2CQA-2672, B2CQA-786" },
{
currency: Currency.BTC,
xrayTicket: "B2CQA-2499, B2CQA-2644, B2CQA-2672, B2CQA-786, B2CQA-2073",
},
{ currency: Currency.ETH, xrayTicket: "B2CQA-2503, B2CQA-929, B2CQA-2645, B2CQA-2673" },
{ currency: Currency.ETC, xrayTicket: "B2CQA-2502, B2CQA-2646, B2CQA-2674" },
{ currency: Currency.XRP, xrayTicket: "B2CQA-2505, B2CQA-2647, B2CQA-2675" },
Expand Down Expand Up @@ -53,6 +56,9 @@ for (const currency of currencies) {
await app.account.expectAccountVisibility(firstAccountName);
await app.account.expectAccountBalance();
await app.account.expectLastOperationsVisibility();
await app.account.clickOnLastOperation();
await app.operationDrawer.expectDrawerInfos(firstAccountName);
await app.operationDrawer.closeDrawer();
await app.account.expectAddressIndex(0);
await app.account.expectShowMoreButton();
},
Expand Down

0 comments on commit 600dbb1

Please sign in to comment.