Files
gymflow/tests/active-session-delete-logged-set.spec.ts

37 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 - Delete Logged Set', async ({ page }) => {
// 1. Start a 'Free Workout' session.
await page.goto('http://localhost: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. Log at least one set.
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();
// 3. Click the 'Delete' icon for a logged set.
await page.locator('div').filter({ hasText: /^1Bench Press80kg x 5$/ }).getByRole('button').nth(1).click();
// 4. Confirm deletion.
// NOTE: There is no explicit confirmation dialog in the UI. The set is deleted directly.
// Expected Results:
// - The set is removed from the session history.
await expect(page.locator('div').filter({ hasText: /^1Bench Press80kg x 5$/ })).toHaveCount(0);
// - No error messages.
await expect(page.locator('text=Error')).not.toBeVisible();
});
});