rspace-online/e2e/tests/space-creation.spec.ts

26 lines
982 B
TypeScript

import { test, expect } from "@playwright/test";
test.describe("Space creation", () => {
test("form has name input and create button", async ({ page }) => {
await page.goto("/create-space");
// Should have an input for the space name
const nameInput = page.locator('input[type="text"], input[name*="name"], input[placeholder*="name" i]').first();
await expect(nameInput).toBeVisible();
// Should have a submit/create button
const createBtn = page.locator('button[type="submit"], button:has-text("Create"), button:has-text("create")').first();
await expect(createBtn).toBeVisible();
});
test("/create-space does not crash on load", async ({ page }) => {
const res = await page.goto("/create-space");
expect(res?.status()).toBe(200);
// No uncaught exceptions
let pageError: Error | null = null;
page.on("pageerror", (e) => { pageError = e; });
await page.waitForTimeout(2000);
expect(pageError).toBeNull();
});
});