2026-07-16 06:19:58 -04:00
|
|
|
import { test, expect } from '@playwright/test';
|
|
|
|
|
import { login } from './helpers/auth';
|
|
|
|
|
|
|
|
|
|
test.describe('Dashboard', () => {
|
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
|
|
|
await login(page);
|
|
|
|
|
});
|
|
|
|
|
|
2026-08-10 08:53:18 +00:00
|
|
|
test('renders the dashboard with the widget area', async ({ page }) => {
|
|
|
|
|
await expect(page.getByRole('heading', { name: /dashboard/i })).toBeVisible();
|
2026-07-16 06:19:58 -04:00
|
|
|
|
2026-08-10 08:53:18 +00:00
|
|
|
// Either the widget grid renders or the "add widget" entry point shows.
|
|
|
|
|
await expect(page.getByRole('button', { name: /add widget/i })).toBeVisible();
|
2026-07-16 06:19:58 -04:00
|
|
|
});
|
|
|
|
|
|
2026-08-10 08:53:18 +00:00
|
|
|
test('adds the default widget set from an empty dashboard', async ({ page }) => {
|
|
|
|
|
const addDefaults = page.getByRole('button', { name: /add default widgets/i });
|
|
|
|
|
|
|
|
|
|
// Only the empty dashboard offers the default set; a dashboard that already
|
|
|
|
|
// has widgets (from earlier runs) skips this.
|
|
|
|
|
if (await addDefaults.isVisible().catch(() => false)) {
|
|
|
|
|
await addDefaults.click();
|
|
|
|
|
await expect(page.getByText(/tasks due today/i)).toBeVisible({ timeout: 10_000 });
|
|
|
|
|
}
|
2026-07-16 06:19:58 -04:00
|
|
|
});
|
|
|
|
|
});
|