- 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
56 lines
1.9 KiB
TypeScript
56 lines
1.9 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
|
|
test.describe('Team Members Page', () => {
|
|
test.beforeEach(async ({ page }) => {
|
|
// Login first
|
|
await page.goto('/login');
|
|
await page.fill('input[type="email"]', 'superuser@headroom.test');
|
|
await page.fill('input[type="password"]', 'password');
|
|
await page.click('button[type="submit"]');
|
|
await page.waitForURL('/dashboard');
|
|
|
|
// Navigate to team members
|
|
await page.goto('/team-members');
|
|
});
|
|
|
|
test('page renders with title and table', async ({ page }) => {
|
|
await expect(page).toHaveTitle(/Team Members/);
|
|
await expect(page.locator('h1', { hasText: 'Team Members' })).toBeVisible();
|
|
await expect(page.getByText('Manage your team roster')).toBeVisible();
|
|
await expect(page.getByRole('button', { name: /Add Member/i })).toBeVisible();
|
|
});
|
|
|
|
test('search filters team members', async ({ page }) => {
|
|
// Wait for data to load
|
|
await page.waitForTimeout(500);
|
|
|
|
// Get initial row count
|
|
const initialRows = await page.locator('table tbody tr').count();
|
|
expect(initialRows).toBeGreaterThan(0);
|
|
|
|
// Search for specific member
|
|
await page.fill('input[placeholder="Search team members..."]', 'Alice');
|
|
await page.waitForTimeout(300);
|
|
|
|
// Should show fewer or equal rows after filtering
|
|
const filteredRows = await page.locator('table tbody tr').count();
|
|
expect(filteredRows).toBeLessThanOrEqual(initialRows);
|
|
});
|
|
|
|
test('status filter works', async ({ page }) => {
|
|
// Wait for data to load
|
|
await page.waitForTimeout(500);
|
|
|
|
// Get initial row count
|
|
const initialRows = await page.locator('table tbody tr').count();
|
|
|
|
// Select active filter
|
|
await page.selectOption('select', 'active');
|
|
await page.waitForTimeout(300);
|
|
|
|
// Should show filtered results (fewer or equal rows)
|
|
const filteredRows = await page.locator('table tbody tr').count();
|
|
expect(filteredRows).toBeLessThanOrEqual(initialRows);
|
|
});
|
|
});
|