Playwright re-established. 54 test cases generated.
This commit is contained in:
43
tests/active-session-log-bodyweight-set.spec.ts
Normal file
43
tests/active-session-log-bodyweight-set.spec.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
// 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://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();
|
||||
|
||||
// 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.
|
||||
await expect(page.getByPlaceholder('0').nth(1)).toHaveValue('');
|
||||
await expect(page.getByPlaceholder('0').nth(2)).toHaveValue('');
|
||||
// - 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();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user