34 lines
1.4 KiB
TypeScript
34 lines
1.4 KiB
TypeScript
// spec: specs/gymflow-test-plan.md
|
|
// seed: tests/user-system-management.spec.ts
|
|
|
|
import { test, expect } from '@playwright/test';
|
|
|
|
test.describe('V. User & System Management', () => {
|
|
test('A. User Profile - Dedicated Daily Weight Logging', async ({ page }) => {
|
|
// 1. Log in as a regular user.
|
|
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();
|
|
|
|
// 2. Navigate to the 'Profile' section.
|
|
await page.getByRole('button', { name: 'Profile' }).click();
|
|
|
|
// 3. Expand 'Weight Tracker'.
|
|
await page.getByRole('button', { name: 'Weight Tracker' }).click();
|
|
|
|
// 4. Enter today's weight (e.g., '72.3').
|
|
await page.getByPlaceholder('Enter weight...').fill('72.3');
|
|
|
|
// 5. Click 'Log' button.
|
|
await page.getByRole('button', { name: 'Log', exact: true }).click();
|
|
|
|
// Expected Results:
|
|
// - The weight is logged for the current day.
|
|
// - The new record appears in the weight history list.
|
|
await expect(page.locator('div').filter({ hasText: /^11\/30\/202572\.3 kg$/ })).toBeVisible();
|
|
// - A success snackbar message is displayed.
|
|
await expect(page.getByText('Weight logged successfully')).toBeVisible();
|
|
});
|
|
});
|