Files
gymflow/tests/user-profile-change-password-too-short.spec.ts

35 lines
1.5 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 (Too Short)', 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. Navigate to the 'Profile' section.
await page.getByRole('button', { name: 'Profile' }).click();
// 3. Enter a password less than 4 characters in the 'Change Password' field.
await page.getByRole('textbox', { name: 'New Password' }).fill('123');
// 4. Click 'OK'.
await page.getByRole('button', { name: 'OK' }).click();
// Expected Results:
// - An error message 'Password too short' is displayed.
await expect(page.getByText('Password too short')).toBeVisible();
// - Password is not changed.
// (Implicitly tested by the fact that the error message is displayed and no success message)
// Reset password to original for subsequent tests
await page.getByRole('textbox', { name: 'New Password' }).fill('admin1234');
await page.getByRole('button', { name: 'OK' }).click();
await expect(page.getByText('Password changed')).toBeVisible();
});
});