Files
gymflow/tests/exercise-library-create-custom-exercise-strength.spec.ts
2025-12-06 20:21:41 +02:00

41 lines
1.7 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 - Create Custom Exercise (Strength)', async ({ page }) => {
// 1. Log in as a regular user.
await page.goto('http://localhost:3000/');
await page.locator('input[type="email"]').fill('admin@gymflow.ai');
await page.locator('input[type="password"]').fill('admin123');
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();
});
});