fix: dashboard edit mode renders live widgets
This commit is contained in:
@@ -1,7 +1,17 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
import { expect, test, type Page } from "@playwright/test";
|
||||
|
||||
async function ensureSignedIn(page: Page) {
|
||||
await page.goto("/");
|
||||
const devLogin = page.getByRole("button", { name: "Dev login" });
|
||||
if (await devLogin.isVisible().catch(() => false)) {
|
||||
await devLogin.click();
|
||||
await page.waitForURL((url) => !url.pathname.startsWith("/login"));
|
||||
}
|
||||
await expect(page.getByText("Upcoming events", { exact: true })).toBeVisible();
|
||||
}
|
||||
|
||||
test("dashboard happy path", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
await ensureSignedIn(page);
|
||||
|
||||
// Page title is present
|
||||
await expect(page.getByRole("heading", { name: "Dashboard" })).toBeVisible();
|
||||
@@ -24,3 +34,20 @@ test("dashboard happy path", async ({ page }) => {
|
||||
const viewportWidth = await page.evaluate(() => window.innerWidth);
|
||||
expect(bodyWidth).toBeLessThanOrEqual(viewportWidth + 2); // 2px tolerance for sub-pixel rendering
|
||||
});
|
||||
|
||||
test("dashboard edit mode shows live widget content", async ({ page }) => {
|
||||
await ensureSignedIn(page);
|
||||
await page.goto("/d/home?edit=1");
|
||||
|
||||
await expect(page.getByText("Drag to reorder")).toBeVisible();
|
||||
await expect(page.getByRole("button", { name: "Save" })).toBeVisible();
|
||||
|
||||
const main = page.getByRole("main");
|
||||
await expect(main.getByText("Recent activity", { exact: true })).toBeVisible();
|
||||
|
||||
// Server-rendered widget body (empty-state copy), not the meta description placeholder
|
||||
await expect(
|
||||
main.getByText(/No recent activity|No events in the next|No pinned notes|No notes/i).first(),
|
||||
).toBeVisible();
|
||||
await expect(main.getByText("Latest changes across your household.")).not.toBeVisible();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user