rspace-online/e2e/tests/landing.spec.ts

43 lines
1.4 KiB
TypeScript

import { test, expect } from "@playwright/test";
test.describe("Landing pages", () => {
test("/ renders hero and module grid", async ({ page }) => {
await page.goto("/");
await expect(page).toHaveTitle(/rSpace/i);
// Hero section or main heading
await expect(page.locator("h1, .hero, .landing-hero").first()).toBeVisible();
// "Try Demo" or demo link somewhere on the page
const demoLink = page.locator('a[href*="demo"]').first();
await expect(demoLink).toBeVisible();
});
test("/about returns 200", async ({ page }) => {
const res = await page.goto("/about");
expect(res?.status()).toBe(200);
});
test("/create-space renders form", async ({ page }) => {
const res = await page.goto("/create-space");
expect(res?.status()).toBe(200);
await expect(page.locator("input, [type=text]").first()).toBeVisible();
});
test("/demo loads space dashboard", async ({ page }) => {
const res = await page.goto("/demo");
expect(res?.status()).toBe(200);
await expect(page.locator("header.rstack-header")).toBeVisible();
});
test("favicon is accessible", async ({ request }) => {
const res = await request.get("/favicon.png");
expect(res.status()).toBe(200);
});
test("manifest.json is accessible", async ({ request }) => {
const res = await request.get("/manifest.json");
expect(res.status()).toBe(200);
const json = await res.json();
expect(json).toHaveProperty("name");
});
});