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,52 @@
// 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 - Archive/Unarchive Exercise', 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();
// Create a new exercise to archive/unarchive if it doesn't exist
await page.getByRole('button', { name: 'New Exercise' }).click();
await page.getByRole('textbox', { name: '0' }).fill('Exercise to Archive');
await page.getByRole('button', { name: 'Free Weights & Machines' }).click();
await page.getByRole('button', { name: 'Create' }).nth(1).click();
// 4. Click the 'Archive' icon for an existing exercise.
await page.locator('div').filter({ hasText: /^Exercise to ArchiveFree Weights & Machines$/ }).getByRole('button', { name: 'Archive' }).click();
// 5. Verify the exercise is marked as archived (or disappears if filtered).
await expect(page.getByText('Exercise to Archive')).not.toBeVisible();
// 6. Toggle 'Show Archived' checkbox.
await page.getByRole('checkbox').click();
// Verify the archived exercise is now visible
await expect(page.getByText('Exercise to Archive')).toBeVisible();
// 7. Click the 'Unarchive' icon for the same exercise.
await page.locator('div').filter({ hasText: /^Exercise to ArchiveFree Weights & Machines$/ }).getByRole('button', { name: 'Unarchive' }).click();
// Expected Results:
// - Exercise is archived and unarchived successfully.
await expect(page.getByText('Exercise to Archive')).toBeVisible();
// - Visibility changes correctly based on 'Show Archived' filter.
// Untoggle 'Show Archived' checkbox and verify it disappears again
await page.getByRole('checkbox').click();
await expect(page.getByText('Exercise to Archive')).not.toBeVisible();
// Turn it back on for subsequent tests
await page.getByRole('checkbox').click();
});
});