44 lines
2.0 KiB
TypeScript
44 lines
2.0 KiB
TypeScript
// spec: specs/gymflow-test-plan.md
|
|
// seed: tests/workout-management.spec.ts
|
|
|
|
import { test, expect } from '@playwright/test';
|
|
|
|
test.describe('II. Workout Management', () => {
|
|
test('B. Exercise Library - Filter Exercises by Name', async ({ page }) => {
|
|
// 1. Log in as a regular user.
|
|
await page.goto('http://localhost:3000/');
|
|
await page.getByRole('textbox', { name: 'user@gymflow.ai' }).fill('admin@gymflow.ai');
|
|
await page.locator('input[type="password"]').fill('admin1234');
|
|
await page.getByRole('button', { name: 'Login' }).click();
|
|
|
|
// 2. Navigate to the 'Profile' section.
|
|
await page.getByRole('button', { name: 'Profile' }).click();
|
|
|
|
// 3. Expand 'Exercise Manager'.
|
|
await page.getByRole('button', { name: 'Manage Exercises' }).click();
|
|
|
|
// Create an exercise named "Bicep Curl" for filtering
|
|
await page.getByRole('button', { name: 'New Exercise' }).click();
|
|
await page.getByRole('textbox', { name: '0' }).fill('Bicep Curl');
|
|
await page.getByRole('button', { name: 'Free Weights & Machines' }).click();
|
|
await page.getByRole('button', { name: 'Create' }).nth(1).click();
|
|
|
|
// Create another exercise named "Tricep Extension" to ensure filtering works
|
|
await page.getByRole('button', { name: 'New Exercise' }).click();
|
|
await page.getByRole('textbox', { name: '0' }).fill('Tricep Extension');
|
|
await page.getByRole('button', { name: 'Free Weights & Machines' }).click();
|
|
await page.getByRole('button', { name: 'Create' }).nth(1).click();
|
|
|
|
// 4. Enter a partial exercise name into the filter field.
|
|
await page.getByRole('textbox', { name: 'Type to filter...' }).fill('bicep');
|
|
|
|
// 5. Verify only matching exercises are displayed.
|
|
await expect(page.getByText('Bicep Curl')).toBeVisible();
|
|
await expect(page.getByText('Tricep Extension')).not.toBeVisible();
|
|
await expect(page.getByText('Dips')).not.toBeVisible(); // Assuming Dips is a default exercise
|
|
|
|
// Clear the filter for subsequent tests
|
|
await page.getByRole('textbox', { name: 'Type to filter...' }).fill('');
|
|
});
|
|
});
|