42 lines
1.9 KiB
TypeScript
42 lines
1.9 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 - Change Password', 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. Enter a new password (min 4 characters) in the 'Change Password' field.
|
|
await page.getByRole('textbox', { name: 'New Password' }).fill('newpass123');
|
|
|
|
// 4. Click 'OK'.
|
|
await page.getByRole('button', { name: 'OK' }).click();
|
|
|
|
// Expected Results:
|
|
// - Password change is successful.
|
|
// - A success message is displayed.
|
|
await expect(page.getByText('Password changed')).toBeVisible();
|
|
|
|
// - The user can log in with the new password.
|
|
await page.getByRole('button', { name: 'Logout' }).click(); // Log out
|
|
await page.getByRole('textbox', { name: 'user@gymflow.ai' }).fill('admin@gymflow.ai');
|
|
await page.locator('input[type="password"]').fill('newpass123'); // New password
|
|
await page.getByRole('button', { name: 'Login' }).click(); // Login with new password
|
|
await expect(page.getByRole('heading', { name: 'Ready?' })).toBeVisible(); // Verify logged in
|
|
|
|
// Change password back to original for subsequent tests
|
|
await page.getByRole('button', { name: 'Profile' }).click();
|
|
await page.getByRole('textbox', { name: 'New Password' }).fill('admin1234');
|
|
await page.getByRole('button', { name: 'OK' }).click();
|
|
await expect(page.getByText('Password changed')).toBeVisible();
|
|
});
|
|
});
|