Playwright re-established. 54 test cases generated.

This commit is contained in:
AG
2025-11-30 14:35:47 +02:00
parent 683f80dfea
commit eef65251d7
63 changed files with 5752 additions and 157 deletions

View File

@@ -0,0 +1,45 @@
// spec: specs/gymflow-test-plan.md
// seed: tests/workout-management.spec.ts
import { test, expect } from '@playwright/test';
test.describe('II. Workout Management', () => {
test('A. Workout Plans - Edit Existing Plan', 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 'Plans' section.
await page.getByRole('button', { name: 'Plans' }).click();
// 3. Create a new plan (if none exist).
// This part is handled by the previous test, but we need to ensure a plan exists for this test.
// Assuming 'My New Strength Plan' exists from previous test run or seed data.
// 4. Click the 'Edit' icon for an existing plan.
// The edit button for "My New Strength Plan" is the second one.
await page.getByRole('button').filter({ hasText: /^$/ }).nth(3).click();
// 5. Modify the 'Plan Name' and 'Description'.
await page.getByRole('textbox', { name: 'E.g. Full-body Routine' }).fill('My Edited Strength Plan');
await page.getByRole('textbox', { name: 'Describe preparation...' }).fill('Focus on compound lifts and endurance');
// 6. Add/remove exercises, or reorder them.
await page.getByRole('button', { name: 'Add Exercise' }).click();
await page.getByRole('button', { name: 'Pull-Ups BODYWEIGHT' }).click();
// 7. Click 'Save'.
await page.getByRole('button', { name: 'Save' }).click();
// Expected Results:
// - The plan is updated with the new name, description, and exercise list.
await expect(page.getByRole('heading', { name: 'My Edited Strength Plan' })).toBeVisible();
await expect(page.getByText('Focus on compound lifts and endurance')).toBeVisible();
await expect(page.locator('div').filter({ hasText: /^2 exercises$/ })).toBeVisible();
// - No error messages are displayed.
await expect(page.locator('text=Error')).not.toBeVisible();
});
});