import { expect, test } from "@playwright/test"; import { mockConfig, seedAuthStorage } from "./helpers/e2e"; test("new users with no households see create and join actions instead of a loading dead-end", async ({ page }) => { await seedAuthStorage(page, { username: "new-user" }); await mockConfig(page); await page.route("**/households", async (route) => { await route.fulfill({ status: 200, contentType: "application/json", body: JSON.stringify([]), }); }); await page.goto("/"); await expect(page.getByRole("button", { name: "Create or Join Household" })).toBeVisible(); await expect(page.getByRole("heading", { name: "No household yet" })).toBeVisible(); await expect(page.getByRole("button", { name: "Create Household", exact: true })).toBeVisible(); await expect(page.getByRole("button", { name: "Join Household", exact: true })).toBeVisible(); await page.getByRole("button", { name: "Join Household", exact: true }).click(); await expect(page.getByLabel("Invite Link")).toBeVisible(); await page.getByRole("button", { name: "Close household dialog" }).click(); await page.getByRole("button", { name: "Create Household", exact: true }).click(); await expect(page.getByLabel("Household Name")).toBeVisible(); await page.getByRole("button", { name: "Close household dialog" }).click(); await page.goto("/manage"); await expect(page.getByRole("heading", { name: "Manage" })).toBeVisible(); await expect(page.getByRole("heading", { name: "No household yet" })).toBeVisible(); await expect(page.getByRole("button", { name: "Create Household", exact: true })).toBeVisible(); await expect(page.getByRole("button", { name: "Join Household", exact: true })).toBeVisible(); });