← back to Govarbitrage
tests/e2e/smoke.spec.ts
39 lines
import { test, expect } from "@playwright/test";
test("dashboard renders with cards and the listings table", async ({ page }) => {
await page.goto("/");
await expect(page.getByRole("heading", { name: /GovArbitrage/i })).toBeVisible();
await expect(page.getByText("Active Auctions")).toBeVisible();
await expect(page.getByText("Expected Profit")).toBeVisible();
// The table loads listings from the API.
await expect(page.getByText(/listings$/)).toBeVisible();
});
test("listings API returns computed rows", async ({ request }) => {
const res = await request.get("/api/listings?pageSize=5");
expect(res.ok()).toBeTruthy();
const data = await res.json();
expect(data.total).toBeGreaterThan(0);
expect(data.rows[0]).toHaveProperty("netProfit");
expect(data.rows[0]).toHaveProperty("opportunityScore");
});
test("scoring profile switch changes ordering", async ({ request }) => {
const overall = await (await request.get("/api/listings?profile=OVERALL_OPPORTUNITY&pageSize=1&sort=opportunityScore&dir=desc")).json();
const highProfit = await (await request.get("/api/listings?profile=HIGH_PROFIT&pageSize=1&sort=opportunityScore&dir=desc")).json();
expect(overall.rows[0]).toBeTruthy();
expect(highProfit.rows[0]).toBeTruthy();
});
test("selling-avenues page lists real sourcing links", async ({ page }) => {
await page.goto("/selling-avenues");
await expect(page.getByRole("heading", { name: /Sourcing & Selling Avenues/i })).toBeVisible();
await expect(page.getByRole("link", { name: /GovDeals/i }).first()).toBeVisible();
});
test("reports page renders performance tables", async ({ page }) => {
await page.goto("/reports");
await expect(page.getByRole("heading", { name: "Reports" })).toBeVisible();
await expect(page.getByText("Category Performance")).toBeVisible();
});