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,44 @@
// spec: specs/gymflow-test-plan.md
// seed: tests/data-progress.spec.ts
import { test, expect } from '@playwright/test';
test.describe('IV. Data & Progress', () => {
test('A. Session History - View Detailed Session', 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. Complete at least one workout session.
// Start a Free Workout session, log a set, and finish it.
await page.getByRole('spinbutton').fill('83');
await page.getByRole('button', { name: 'Free Workout' }).click();
await page.getByRole('textbox', { name: '0' }).fill('Bench Press');
await page.getByRole('button', { name: 'Bench Press' }).click();
await page.getByPlaceholder('0').nth(1).fill('80');
await page.getByPlaceholder('0').nth(2).fill('5');
await page.getByRole('button', { name: 'Log Set' }).click();
await page.getByRole('button', { name: 'Finish' }).click();
await page.getByRole('button', { name: 'Confirm' }).click();
// 3. Navigate to the 'History' section.
await page.getByRole('button', { name: 'History' }).click();
// 4. Click on a workout session entry.
// Click on the most recent workout session.
await page.locator('div').filter({ hasText: /^2025-11-30/ }).filter({ hasText: '1m No plan 83kg' }).filter({ hasText: 'Sets: 1' }).filter({ hasText: '0.4t' }).first().click();
// Expected Results:
// - A detailed view of the session opens, showing all individual sets with their metrics.
await expect(page.getByRole('heading', { name: 'Edit' })).toBeVisible();
await expect(page.locator('div').filter({ hasText: 'Bench Press' }).nth(2)).toBeVisible(); // Check if exercise name is visible
await expect(page.locator('div').filter({ hasText: 'Weight (kg)80' })).toBeVisible(); // Check if weight is visible
await expect(page.locator('div').filter({ hasText: 'Reps5' })).toBeVisible(); // Check if reps are visible
// - Session start/end times and body weight are displayed.
await expect(page.getByLabel('Start')).toBeVisible(); // Check for start time
await expect(page.getByLabel('End')).toBeVisible(); // Check for end time
await expect(page.getByRole('spinbutton', { name: 'Weight (kg)' })).toHaveValue('83'); // Check for body weight
});
});