diff --git a/tests/utils/wait-helpers.spec.ts b/tests/utils/wait-helpers.spec.ts index 031a54d8..dd911fdf 100644 --- a/tests/utils/wait-helpers.spec.ts +++ b/tests/utils/wait-helpers.spec.ts @@ -1,5 +1,5 @@ /** - * Unit tests for wait-helpers.ts - Phase 2.1: Semantic Wait Helpers + * Unit tests for wait-helpers.ts - Semantic Wait Helpers * * These tests verify the behavior of deterministic wait utilities * that replace arbitrary `page.waitForTimeout()` calls. @@ -14,7 +14,7 @@ import { waitForNavigation, } from './wait-helpers'; -test.describe('wait-helpers - Phase 2.1 Semantic Wait Functions', () => { +test.describe('wait-helpers - Semantic Wait Functions', () => { test.describe('waitForDialog', () => { test('should wait for dialog to be visible and interactive', async ({ page }) => { // Create a test page with dialog @@ -282,16 +282,24 @@ test.describe('wait-helpers - Phase 2.1 Semantic Wait Functions', () => { test.describe('waitForNavigation', () => { test('should wait for URL change with string match', async ({ page }) => { + await page.route('**/test-page', async (route) => { + await route.fulfill({ + status: 200, + contentType: 'text/html', + body: '

New Page

', + }); + }); + await page.goto('about:blank'); await page.setContent(` - Navigate + Navigate `); const link = page.locator('#nav-link'); await link.click(); // Wait for navigation to complete - await waitForNavigation(page, /data:text\/html/); + await waitForNavigation(page, /\/test-page$/); // Verify new page loaded await expect(page.locator('h1')).toHaveText('New Page'); diff --git a/tests/utils/wait-helpers.ts b/tests/utils/wait-helpers.ts index 62836133..cef8da40 100644 --- a/tests/utils/wait-helpers.ts +++ b/tests/utils/wait-helpers.ts @@ -252,7 +252,6 @@ export async function waitForLoadingComplete( '.loading', '.spinner', '[data-loading="true"]', - 'div.animate-pulse', // Only divs upon animate-pulse (skeletons), excluding spans (badges) '[role="status"][aria-label="Loading"]', '[role="status"][aria-label="Authenticating"]', '[role="status"][aria-label="Security Loading"]'