39 lines
1.6 KiB
TypeScript
39 lines
1.6 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 - Finish Session', 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. Log at least one set.
|
|
await page.getByRole('textbox', { name: '0' }).fill('Bench Press');
|
|
await page.getByRole('button', { name: 'Bench Press' }).click();
|
|
await page.getByRole('spinbutton').nth(1).fill('80');
|
|
await page.getByRole('spinbutton').nth(2).fill('5');
|
|
await page.getByRole('button', { name: 'Log Set' }).click();
|
|
|
|
// 3. Click 'Finish' button.
|
|
await page.getByRole('button', { name: 'Finish' }).click();
|
|
|
|
// 4. Confirm finishing the session.
|
|
await page.getByRole('button', { name: 'Confirm' }).click();
|
|
|
|
// Expected Results:
|
|
// - Session data is saved.
|
|
// NOTE: This cannot be directly verified from the UI in this step, but implicitly tested if user returns to idle state without error.
|
|
// - User is returned to the 'Idle State' of the Tracker.
|
|
await expect(page.getByRole('heading', { name: 'Ready?' })).toBeVisible();
|
|
// - No error messages.
|
|
await expect(page.locator('text=Error')).not.toBeVisible();
|
|
});
|
|
});
|