test(e2e): Fix failing tests - update selectors and credentials

- Fix dashboard test: use correct superuser credentials
- Fix heading selectors to use h1 instead of getByRole
- Fix Quick Actions selectors to use href attributes
- Fix team-members and projects filter tests to check row counts
- Fix status filter tests to not rely on badge classes

Refs: Test fixes for p05-page-migrations
This commit is contained in:
2026-02-18 19:30:15 -05:00
parent 25b899f012
commit c5d48fd40c
3 changed files with 35 additions and 17 deletions

View File

@@ -4,7 +4,7 @@ test.describe('Dashboard Page', () => {
test.beforeEach(async ({ page }) => {
// Login first
await page.goto('/login');
await page.fill('input[type="email"]', 'admin@example.com');
await page.fill('input[type="email"]', 'superuser@headroom.test');
await page.fill('input[type="password"]', 'password');
await page.click('button[type="submit"]');
@@ -17,7 +17,7 @@ test.describe('Dashboard Page', () => {
await expect(page).toHaveTitle(/Dashboard/);
// Check PageHeader renders
await expect(page.getByRole('heading', { name: 'Dashboard' })).toBeVisible();
await expect(page.locator('h1', { hasText: 'Dashboard' })).toBeVisible();
await expect(page.getByText('Overview of your resource allocation')).toBeVisible();
// Check New Allocation button
@@ -36,11 +36,11 @@ test.describe('Dashboard Page', () => {
await expect(page.getByText('87%')).toBeVisible(); // Avg Utilization
// Check Quick Actions section
await expect(page.getByRole('heading', { name: 'Quick Actions' })).toBeVisible();
await expect(page.getByRole('link', { name: /Team/i })).toBeVisible();
await expect(page.getByRole('link', { name: /Projects/i })).toBeVisible();
await expect(page.getByRole('link', { name: /Allocate/i })).toBeVisible();
await expect(page.getByRole('link', { name: /Forecast/i })).toBeVisible();
await expect(page.getByText('Quick Actions')).toBeVisible();
await expect(page.locator('a[href="/team-members"]')).toBeVisible();
await expect(page.locator('a[href="/projects"]')).toBeVisible();
await expect(page.locator('a[href="/allocations"]')).toBeVisible();
await expect(page.locator('a[href="/reports/forecast"]')).toBeVisible();
// Check Allocation Preview section
await expect(page.getByRole('heading', { name: 'Allocation Preview' })).toBeVisible();