46 lines
1.7 KiB
TypeScript
46 lines
1.7 KiB
TypeScript
import { test, expect } from "@playwright/test";
|
|
import { attachNetworkMonitor } from "@suaveplan/testing-e2e/network-monitor";
|
|
|
|
test.describe("Network Baseline", () => {
|
|
test("home page loads without network failures", async ({ page }) => {
|
|
const monitor = attachNetworkMonitor(page);
|
|
await page.goto("/");
|
|
await expect(page.locator('[data-testid="page-title"]')).toBeVisible();
|
|
// Filter out WebSocket attempts (expected to fail in test env)
|
|
const failures = monitor.failures.filter(
|
|
(f) => !f.url.includes("/api/ws") && !f.url.includes("stun:"),
|
|
);
|
|
expect(failures).toHaveLength(0);
|
|
});
|
|
|
|
test("crypto page loads without network failures", async ({ page }) => {
|
|
const monitor = attachNetworkMonitor(page);
|
|
await page.goto("/crypto");
|
|
await expect(page.locator('[data-testid="page-title"]')).toBeVisible();
|
|
const failures = monitor.failures.filter(
|
|
(f) => !f.url.includes("/api/ws"),
|
|
);
|
|
expect(failures).toHaveLength(0);
|
|
});
|
|
|
|
test("storage-s3 status check is made on page load", async ({ page }) => {
|
|
const requests: string[] = [];
|
|
page.on("request", (req) => requests.push(req.url()));
|
|
|
|
await page.goto("/storage-s3");
|
|
await expect(page.locator('[data-testid="demo-card"]')).toBeVisible();
|
|
|
|
expect(requests.some((r) => r.includes("/api/storage/status"))).toBe(true);
|
|
});
|
|
|
|
test("surrealdb status check is made on page load", async ({ page }) => {
|
|
const requests: string[] = [];
|
|
page.on("request", (req) => requests.push(req.url()));
|
|
|
|
await page.goto("/surrealdb");
|
|
await expect(page.locator('[data-testid="demo-card"]')).toBeVisible();
|
|
|
|
expect(requests.some((r) => r.includes("/api/database/status"))).toBe(true);
|
|
});
|
|
});
|