Playwright re-established. 54 test cases generated.
This commit is contained in:
45
tests/session-history-edit-past-session-details.spec.ts
Normal file
45
tests/session-history-edit-past-session-details.spec.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
// spec: specs/gymflow-test-plan.md
|
||||
// seed: tests/data-progress.spec.ts
|
||||
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
test.describe('IV. Data & Progress', () => {
|
||||
test('A. Session History - Edit Past Session Details', async ({ page }) => {
|
||||
// 1. Log in as a regular user.
|
||||
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();
|
||||
|
||||
// 2. Complete a workout session.
|
||||
// Start a Free Workout session, log a set, and finish it.
|
||||
await page.getByRole('spinbutton').fill('83');
|
||||
await page.getByRole('button', { name: 'Free Workout' }).click();
|
||||
await page.getByRole('textbox', { name: '0' }).fill('Bench Press');
|
||||
await page.getByRole('button', { name: 'Bench Press' }).click();
|
||||
await page.getByPlaceholder('0').nth(1).fill('80');
|
||||
await page.getByPlaceholder('0').nth(2).fill('5');
|
||||
await page.getByRole('button', { name: 'Log Set' }).click();
|
||||
await page.getByRole('button', { name: 'Finish' }).click();
|
||||
await page.getByRole('button', { name: 'Confirm' }).click();
|
||||
|
||||
// 3. Navigate to the 'History' section.
|
||||
await page.getByRole('button', { name: 'History' }).click();
|
||||
|
||||
// 4. Open the detailed view of a session.
|
||||
// Click on the most recent workout session.
|
||||
await page.locator('div').filter({ hasText: /^2025-11-30/ }).filter({ hasText: '1m No plan 83kg' }).filter({ hasText: 'Sets: 1' }).filter({ hasText: '0.4t' }).first().click();
|
||||
|
||||
// 5. Modify the 'Start Time', 'End Time', or 'Body Weight'.
|
||||
await page.getByRole('spinbutton').first().fill('85'); // Change body weight
|
||||
|
||||
// 6. Click 'Save'.
|
||||
await page.getByRole('button', { name: 'Save' }).click();
|
||||
|
||||
// Expected Results:
|
||||
// - Session details are updated successfully.
|
||||
// - The changes are reflected in the history view.
|
||||
await expect(page.locator('div').filter({ hasText: /^2025-11-30/ }).filter({ hasText: '85kg' })).toBeVisible();
|
||||
await expect(page.locator('text=Error')).not.toBeVisible();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user