Skip to content

Commit

Permalink
test: add a case for the token name and balance
Browse files Browse the repository at this point in the history
  • Loading branch information
Justkant authored and jdabbech-ledger committed Jul 22, 2024
1 parent 3298ccb commit 3fe4557
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
14 changes: 10 additions & 4 deletions apps/ledger-live-desktop/tests/page/drawer/drawer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ export class Drawer extends Component {
private continueButton = this.page.getByTestId("drawer-continue-button");
private closeButton = this.page.getByTestId("drawer-close-button");
private currencyButton = (currency: string) =>
this.page.getByTestId(`currency-row-${currency.toLowerCase()}`);
private accountButton = (accountName: string, index: number) =>
this.page.getByTestId(`account-row-${accountName.toLowerCase()}-${index}`).first();
this.page.getByTestId(`currency-row-${currency.toLowerCase()}`).first();
readonly selectAssetTitle = this.page.getByTestId("select-asset-drawer-title").first();
readonly selectAccountTitle = this.page.getByTestId("select-account-drawer-title").first();
readonly swapAmountFrom = this.page.getByTestId("swap-amount-from").first();
readonly swapAmountTo = this.page.getByTestId("swap-amount-to").first();
readonly swapAccountFrom = this.page.getByTestId("swap-account-from").first();
readonly swapAccountTo = this.page.getByTestId("swap-account-to").first();
readonly backButton = this.page.getByRole("button", { name: "Back" });

async continue() {
await this.continueButton.click();
Expand All @@ -41,7 +40,14 @@ export class Drawer extends Component {
await this.currencyButton(currency).click();
}

getAccountButton = (accountName: string, index: number) =>
this.page.getByTestId(`account-row-${accountName.toLowerCase()}-${index}`).first();

async selectAccount(accountName: string, index = 0) {
await this.accountButton(accountName, index).click();
await this.getAccountButton(accountName, index).click();
}

back() {
return this.backButton.click();
}
}
13 changes: 12 additions & 1 deletion apps/ledger-live-desktop/tests/specs/services/wallet-api.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,24 @@ test("Wallet API methods @smoke", async ({ page }) => {
id,
method: "account.request",
params: {
currencyIds: ["ethereum", "bitcoin"],
currencyIds: ["ethereum", "bitcoin", "ethereum/erc20/usd_tether__erc20_"],
},
});

await drawer.waitForDrawerToBeVisible();

await drawer.selectCurrency("tether usd");
// Test name and balance for tokens
await expect(drawer.getAccountButton("tether usd", 2)).toContainText(
"Tether USD (USDT)71.8174 USDT", // Special space present in the actual rendered element apparently
);
await drawer.back();

await drawer.selectCurrency("bitcoin");
await drawer.selectAccount("bitcoin");

await drawer.waitForDrawerToDisappear();

await expect(response).resolves.toMatchObject({
id,
jsonrpc: "2.0",
Expand Down

0 comments on commit 3fe4557

Please sign in to comment.