Skip to content

Commit

Permalink
Fee Bump UI Tests (#1191)
Browse files Browse the repository at this point in the history
  • Loading branch information
quietbits authored Dec 10, 2024
1 parent 56daeab commit 4e95f99
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/app/(sidebar)/transaction/fee-bump/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ export default function FeeBumpTransaction() {
variant="success"
title="Success! Transaction Envelope XDR:"
response={
<Box gap="xs">
<Box gap="xs" data-testid="fee-bump-success">
<TxResponse
label="Network Passphrase:"
value={network.passphrase}
Expand Down
79 changes: 79 additions & 0 deletions tests/feeBumpPage.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import { test, expect } from "@playwright/test";

test.describe("Fee Bump Page", () => {
test.beforeEach(async ({ page }) => {
await page.goto("http://localhost:3000/transaction/fee-bump");
});

test("Loads", async ({ page }) => {
await expect(page.locator("h1")).toHaveText("Fee Bump");
await expect(page.getByText("Fee bump errors")).toBeVisible();
});

test.describe("Render", () => {
let successCard: any;

test.beforeEach(async ({ page }) => {
await page
.getByLabel("Source Account")
.fill("GA46LGGOLXJY5OSX6N4LHV4MWDFXNGLK76I4NDNKKYAXRRSKI5AJGMXG");
await page
.getByLabel("Input a base-64 encoded TransactionEnvelope")
.fill(
"AAAAAgAAAAA55ZjOXdOOulfzeLPXjLDLdplq/5HGjapWAXjGSkdAkwAAAGQADQioAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAC7OH53UcxOpgzL8V6oMoe/fz8QrTsG/TE1hHiDWv0K/AAAAAJUC+QAAAAAAAAAAAA=",
);

successCard = page.getByTestId("fee-bump-success");
});

test("Base Fee validation + Success", async ({ page }) => {
await page.getByLabel("Base Fee").fill("10");

await expect(
page.getByText("Invalid baseFee, it should be at least 100 stroops."),
).toBeVisible();

await page.getByLabel("Base Fee").fill(BASE_FEE);

await expect(
successCard.getByText("Network Passphrase:").locator("+ div"),
).toHaveText("Test SDF Network ; September 2015");
await expect(successCard.getByText("XDR:").locator("+ div")).toHaveText(
MOCK_XDR,
);
});

test("Clear", async ({ page }) => {
await page.getByLabel("Base Fee").fill(BASE_FEE);
await expect(successCard).toBeVisible();

await page.getByText("Clear and import new").click();
await expect(successCard).toBeHidden();
});

test("Sign in Transaction Signer", async ({ page }) => {
await page.getByLabel("Base Fee").fill(BASE_FEE);
await page.getByText("Sign in Transaction Signer").click();

await expect(page.locator("h1")).toHaveText("Transaction Overview");
await expect(page.getByLabel("Transaction Envelope XDR")).toHaveText(
MOCK_XDR,
);
});

test("View in XDR viewer", async ({ page }) => {
await page.getByLabel("Base Fee").fill(BASE_FEE);
await page.getByText("View in XDR Viewer").click();

await expect(page.locator("h1")).toHaveText("View XDR");
await expect(page.getByLabel("Base-64 encoded XDR")).toHaveText(MOCK_XDR);
});
});
});

// =============================================================================
// Mock data
// =============================================================================
const MOCK_XDR =
"AAAABQAAAAA55ZjOXdOOulfzeLPXjLDLdplq/5HGjapWAXjGSkdAkwAAAAAAAADIAAAAAgAAAAA55ZjOXdOOulfzeLPXjLDLdplq/5HGjapWAXjGSkdAkwAAAGQADQioAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAC7OH53UcxOpgzL8V6oMoe/fz8QrTsG/TE1hHiDWv0K/AAAAAJUC+QAAAAAAAAAAAAAAAAAAAAAAA==";
const BASE_FEE = "100";

0 comments on commit 4e95f99

Please sign in to comment.