forked from cardosofelipe/fast-next-template
Refactor E2E tests and mock APIs for improved reliability and maintainability
- Updated E2E tests to use specific role-based heading selectors for better robustness. - Enhanced mock routes in `auth.ts` to handle detailed organization endpoints more effectively. - Improved test flow by adding `waitUntil: 'networkidle'` to navigation steps. - Refined `admin-access.spec.ts` interactions to use optimized wait and click implementations for better performance. - Updated dialog texts and field labels to match latest UI changes.
This commit is contained in:
@@ -15,22 +15,18 @@ test.describe('Password Change', () => {
|
||||
await loginViaUI(page);
|
||||
|
||||
// Navigate to password page
|
||||
await page.goto('/settings/password');
|
||||
await page.goto('/settings/password', { waitUntil: 'networkidle' });
|
||||
|
||||
// Wait for page to render
|
||||
await page.waitForTimeout(1000);
|
||||
// Wait for form to be visible
|
||||
await page.getByLabel(/current password/i).waitFor({ state: 'visible', timeout: 10000 });
|
||||
});
|
||||
|
||||
test('should display password change form', async ({ page }) => {
|
||||
// Check page title
|
||||
await expect(page.locator('h2')).toContainText('Password');
|
||||
|
||||
// Wait for form to be visible
|
||||
const currentPasswordInput = page.getByLabel(/current password/i);
|
||||
await currentPasswordInput.waitFor({ state: 'visible', timeout: 10000 });
|
||||
await expect(page.getByRole('heading', { name: 'Password' })).toBeVisible();
|
||||
|
||||
// Verify all password fields are present
|
||||
await expect(currentPasswordInput).toBeVisible();
|
||||
await expect(page.getByLabel(/current password/i)).toBeVisible();
|
||||
await expect(page.getByLabel(/^new password/i)).toBeVisible();
|
||||
await expect(page.getByLabel(/confirm.*password/i)).toBeVisible();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user