Files
gymflow/tests/idle-state-start-free-workout.spec.ts
2025-12-06 20:21:41 +02:00

31 lines
1.2 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('B. Idle State - Start Free Workout', 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. Ensure the tracker is in the idle state. (This is the default view after login)
// 3. Enter a body weight in the input field (e.g., '75.5').
await page.getByRole('spinbutton').fill('75.5');
// 4. Click 'Free Workout' button.
await page.getByRole('button', { name: 'Free Workout' }).click();
// Expected Results:
// - The application transitions to 'Active Session' view.
await expect(page.getByRole('heading', { name: 'Free Workout' })).toBeVisible();
// - The timer starts.
await expect(page.getByText(/(\d{2}:){2}\d{2}/)).toBeVisible();
// - The entered body weight is displayed in the active session header.
await expect(page.getByText('• 75.5kg')).toBeVisible();
});
});