fix: update navigation tests to use explicit locators and improve user management modal handling
This commit is contained in:
@@ -155,9 +155,10 @@ test.describe('Navigation', () => {
|
||||
await page.goto('/');
|
||||
|
||||
await test.step('Click Settings navigation', async () => {
|
||||
const settingsNav = page
|
||||
const explicitSettingsNav = page.locator('a[href^="/settings"]').first();
|
||||
const settingsNav = explicitSettingsNav.or(page
|
||||
.getByRole('link', { name: /settings?/i })
|
||||
.or(page.getByRole('button', { name: /settings?/i }))
|
||||
.or(page.getByRole('button', { name: /settings?/i })))
|
||||
.first();
|
||||
|
||||
if (await settingsNav.isVisible().catch(() => false)) {
|
||||
|
||||
@@ -165,7 +165,7 @@ test.describe('User Management', () => {
|
||||
.getByRole('button', { name: /send.*invite/i })
|
||||
.first();
|
||||
await sendButton.click();
|
||||
await waitForToast(page, /invite.*sent|invite.*created|success/i, { type: 'success', timeout: 10000 });
|
||||
await expect(page.getByRole('dialog').getByRole('button', { name: /done/i }).first()).toBeVisible({ timeout: 10000 });
|
||||
|
||||
// Close the modal - scope to dialog to avoid strict mode violation with Toast close buttons
|
||||
const closeButton = page.getByRole('dialog')
|
||||
@@ -1024,7 +1024,7 @@ test.describe('User Management', () => {
|
||||
await sendButton.click();
|
||||
|
||||
// Wait for success and close modal
|
||||
await waitForToast(page, /invite.*sent|invite.*created|success/i, { type: 'success', timeout: 10000 });
|
||||
await expect(page.getByRole('dialog').getByRole('button', { name: /done/i }).first()).toBeVisible({ timeout: 10000 });
|
||||
const closeButton = page.getByRole('button', { name: /done|close|×/i }).first();
|
||||
if (await closeButton.isVisible()) {
|
||||
await closeButton.click();
|
||||
|
||||
@@ -247,8 +247,6 @@ export async function waitForLoadingComplete(
|
||||
// Avoid broad class-based selectors (e.g. .loading, .spinner) to prevent
|
||||
// false positives from persistent layout/status elements.
|
||||
const loader = page.locator([
|
||||
'[role="progressbar"]:not([aria-label*="Challenge timeout progress"])',
|
||||
'[aria-busy="true"]',
|
||||
'[data-loading="true"]',
|
||||
'[data-testid="config-reload-overlay"]',
|
||||
'[data-testid="loading-spinner"]',
|
||||
|
||||
Reference in New Issue
Block a user