42 lines
1.8 KiB
TypeScript
42 lines
1.8 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 Bodyweight Set', async ({ page }) => {
|
|
// 1. Start a 'Free Workout' session.
|
|
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();
|
|
|
|
await page.getByRole('spinbutton').fill('83');
|
|
await page.getByRole('button', { name: 'Free Workout' }).click();
|
|
|
|
// 2. Select a Bodyweight exercise (e.g., 'Pull-up').
|
|
await page.getByRole('textbox', { name: '0' }).fill('Pull-up');
|
|
await page.getByRole('button', { name: 'Pull-Ups' }).click();
|
|
|
|
// 3. Enter 'Weight' (e.g., '10') and 'Reps' (e.g., '8').
|
|
await page.getByPlaceholder('0').nth(1).fill('10');
|
|
await page.getByPlaceholder('0').nth(2).fill('8');
|
|
|
|
// 4. Verify 'Body Weight Percentage' defaults to '100'.
|
|
// NOTE: This field is not directly visible in the UI. Assuming it's handled internally.
|
|
// To properly test this, an API call or a different UI element would be needed.
|
|
|
|
// 5. 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: /^1Pull-Ups10kg x 8$/ }).getByText('Pull-Ups')).toBeVisible();
|
|
// - Input fields are cleared.
|
|
// - Body weight percentage is used in calculations.
|
|
// NOTE: Cannot directly verify this from UI. Implicitly covered if the set is logged correctly.
|
|
// - No error messages are displayed.
|
|
await expect(page.locator('text=Error')).not.toBeVisible();
|
|
});
|
|
});
|