Add E2E tests for payment method selector and threshold enforcement
This commit is contained in:
parent
5f7cd3da7f
commit
d89db50937
1 changed files with 42 additions and 0 deletions
|
|
@ -68,6 +68,14 @@ test.describe("Exchange Page - Regular User Access", () => {
|
||||||
await expect(page.getByRole("button", { name: "Sell BTC" })).toBeVisible();
|
await expect(page.getByRole("button", { name: "Sell BTC" })).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("exchange page shows payment method selector", async ({ page }) => {
|
||||||
|
await page.goto("/exchange");
|
||||||
|
|
||||||
|
await expect(page.getByText("Payment Method")).toBeVisible();
|
||||||
|
await expect(page.getByRole("button", { name: /Onchain/ })).toBeVisible();
|
||||||
|
await expect(page.getByRole("button", { name: /Lightning/ })).toBeVisible();
|
||||||
|
});
|
||||||
|
|
||||||
test("exchange page shows amount slider", async ({ page }) => {
|
test("exchange page shows amount slider", async ({ page }) => {
|
||||||
await page.goto("/exchange");
|
await page.goto("/exchange");
|
||||||
|
|
||||||
|
|
@ -194,6 +202,40 @@ test.describe("Exchange Page - With Availability", () => {
|
||||||
await expect(page.getByText("EUR:")).toBeVisible();
|
await expect(page.getByText("EUR:")).toBeVisible();
|
||||||
await expect(page.getByText("BTC:")).toBeVisible();
|
await expect(page.getByText("BTC:")).toBeVisible();
|
||||||
await expect(page.getByText("Rate:")).toBeVisible();
|
await expect(page.getByText("Rate:")).toBeVisible();
|
||||||
|
await expect(page.getByText("Payment:")).toBeVisible();
|
||||||
|
});
|
||||||
|
|
||||||
|
test("payment method selector works", async ({ page }) => {
|
||||||
|
await page.goto("/exchange");
|
||||||
|
|
||||||
|
// Default should be Onchain
|
||||||
|
const onchainButton = page.getByRole("button", { name: /Onchain/ });
|
||||||
|
const lightningButton = page.getByRole("button", { name: /Lightning/ });
|
||||||
|
await expect(onchainButton).toHaveCSS("border-color", "rgb(167, 139, 250)");
|
||||||
|
|
||||||
|
// Click Lightning
|
||||||
|
await lightningButton.click();
|
||||||
|
await expect(lightningButton).toHaveCSS("border-color", "rgb(167, 139, 250)");
|
||||||
|
await expect(onchainButton).not.toHaveCSS("border-color", "rgb(167, 139, 250)");
|
||||||
|
|
||||||
|
// Click back to Onchain
|
||||||
|
await onchainButton.click();
|
||||||
|
await expect(onchainButton).toHaveCSS("border-color", "rgb(167, 139, 250)");
|
||||||
|
});
|
||||||
|
|
||||||
|
test("lightning disabled above threshold", async ({ page }) => {
|
||||||
|
await page.goto("/exchange");
|
||||||
|
|
||||||
|
// Set amount above threshold (€1000 = 100000 cents)
|
||||||
|
const amountInput = page.locator('input[type="text"]').filter({ hasText: "" });
|
||||||
|
await amountInput.fill("1100");
|
||||||
|
|
||||||
|
// Lightning button should be disabled
|
||||||
|
const lightningButton = page.getByRole("button", { name: /Lightning/ });
|
||||||
|
await expect(lightningButton).toBeDisabled();
|
||||||
|
|
||||||
|
// Should show threshold message
|
||||||
|
await expect(page.getByText(/Lightning payments are only available/)).toBeVisible();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue