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:
@@ -172,7 +172,7 @@ test.describe('Admin Navigation', () => {
|
||||
await page.goto('/admin/organizations');
|
||||
|
||||
await expect(page).toHaveURL('/admin/organizations');
|
||||
await expect(page.locator('h2')).toContainText('All Organizations');
|
||||
await expect(page.getByRole('heading', { name: 'All Organizations' })).toBeVisible();
|
||||
|
||||
// Breadcrumbs should show Admin > Organizations
|
||||
await expect(page.getByTestId('breadcrumb-admin')).toBeVisible();
|
||||
@@ -270,9 +270,12 @@ test.describe('Admin Breadcrumbs', () => {
|
||||
|
||||
// Click 'Admin' breadcrumb to go back to dashboard
|
||||
const adminBreadcrumb = page.getByTestId('breadcrumb-admin');
|
||||
await adminBreadcrumb.click();
|
||||
|
||||
await page.waitForURL('/admin', { timeout: 5000 });
|
||||
await Promise.all([
|
||||
page.waitForURL('/admin', { timeout: 10000 }),
|
||||
adminBreadcrumb.click()
|
||||
]);
|
||||
|
||||
await expect(page).toHaveURL('/admin');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user