// 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 - Create Custom Exercise (Strength)', async ({ page }) => { // 1. Log in as a regular user. await page.goto('http://192.168.50.234: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(); // 4. Click 'Create Exercise'. await page.getByRole('button', { name: 'New Exercise' }).click(); // 5. Enter an exercise name (e.g., 'Custom Bicep Curl'). await page.getByRole('textbox', { name: '0' }).fill('Custom Bicep Curl'); // 6. Select 'Strength' as the type. await page.getByRole('button', { name: 'Free Weights & Machines' }).click(); // 7. Click 'Create'. await page.getByRole('button', { name: 'Create' }).nth(1).click(); // Expected Results: // - The new exercise appears in the exercise list. await expect(page.getByText('Custom Bicep Curl')).toBeVisible(); // - The exercise type is correctly displayed as Strength. await expect(page.locator('div').filter({ hasText: /^Custom Bicep CurlFree Weights & Machines$/ }).getByText('Free Weights & Machines')).toBeVisible(); // - No error messages. await expect(page.locator('text=Error')).not.toBeVisible(); }); });