Playwright re-established. 54 test cases generated.
This commit is contained in:
43
tests/user-profile-delete-own-account.spec.ts
Normal file
43
tests/user-profile-delete-own-account.spec.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
// 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 - Delete Own Account', async ({ page }) => {
|
||||
// Prerequisite: Create a regular user for this test.
|
||||
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();
|
||||
await page.getByRole('button', { name: 'Profile' }).click();
|
||||
await page.getByRole('textbox', { name: 'Email' }).fill('deleteuser@gymflow.ai');
|
||||
await page.getByRole('textbox', { name: 'Password', exact: true }).fill('deletepass123');
|
||||
await page.getByRole('button', { name: 'Create' }).click();
|
||||
await page.getByRole('button', { name: 'Logout' }).click();
|
||||
|
||||
// 1. Log in as a regular user (not admin).
|
||||
await page.getByRole('textbox', { name: 'user@gymflow.ai' }).fill('deleteuser@gymflow.ai');
|
||||
await page.locator('input[type="password"]').fill('deletepass123');
|
||||
await page.getByRole('button', { name: 'Login' }).click();
|
||||
// Handle first time login password change
|
||||
await page.getByRole('textbox').fill('newdeletepass');
|
||||
await page.getByRole('button', { name: 'Save & Login' }).click();
|
||||
|
||||
// 2. Navigate to the 'Profile' section.
|
||||
await page.getByRole('button', { name: 'Profile' }).click();
|
||||
|
||||
// 3. Locate 'Delete Account' section. (It's visible on the Profile page)
|
||||
|
||||
// 4. Click 'Delete' button.
|
||||
await page.getByRole('button', { name: 'Delete' }).click();
|
||||
|
||||
// 5. Confirm deletion when prompted.
|
||||
await page.getByRole('button', { name: 'Delete' }).click(); // The Delete button in the confirmation dialog
|
||||
|
||||
// Expected Results:
|
||||
// - User account is deleted.
|
||||
// - User is logged out and redirected to the login page.
|
||||
await expect(page).toHaveURL('http://192.168.50.234:3000/#/login');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user