Files
gymflow/tests/active-session-log-strength-set.spec.ts
2025-11-30 19:48:01 +02:00

40 lines
1.7 KiB
TypeScript

// spec: specs/gymflow-test-plan.md
// seed: tests/workout-tracking.spec.ts
import { test, expect } from '@playwright/test';
test.describe('III. Workout Tracking', () => {
test('C. Active Session - Log Strength Set', async ({ page }) => {
// 1. Start a 'Free Workout' session (ensure body weight is set).
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();
await page.getByRole('spinbutton').fill('83');
await page.getByRole('button', { name: 'Free Workout' }).click();
// Ensure Bench Press exercise exists for selection
// (This part would ideally be handled by seed data or a setup step)
// For now, assuming "Bench Press" is available from previous manual creation or seed.
// 2. Select a Strength exercise (e.g., 'Bench Press').
await page.getByRole('textbox', { name: '0' }).fill('Bench Press');
await page.getByRole('button', { name: 'Bench Press' }).click();
// 3. Enter 'Weight' (e.g., '80') and 'Reps' (e.g., '5').
await page.getByPlaceholder('0').nth(1).fill('80');
await page.getByPlaceholder('0').nth(2).fill('5');
// 4. Click 'Log Set'.
await page.getByRole('button', { name: 'Log Set' }).click();
// Expected Results:
// - The set is added to the session history.
await expect(page.locator('div').filter({ hasText: /^1Bench Press80kg x 5$/ }).getByText('Bench Press')).toBeVisible();
// - Input fields are cleared.
// - No error messages are displayed.
await expect(page.locator('text=Error')).not.toBeVisible();
});
});