Skip to content

Commit 84e1acf

Browse files
YourGitHubUsernameclaude
andcommitted
fix(e2e): replace networkidle in messaging tests + auth-helpers
Same root cause as the BasePage fix (ca6e013): networkidle never fires on pages with Supabase Realtime subscriptions. The /messages page has active WebSocket channels that prevent the 500ms idle window from closing. Run 24221957976: 13/18 green (all gen shards), 5/18 red (all msg shards). Every msg failure traced back to networkidle timeouts in loginAndVerify() fallback or direct calls in test files. Replaced 9 occurrences across 5 files: - auth-helpers.ts:90 — loginAndVerify() WebKit fallback (highest impact: used by every messaging test) - complete-user-workflow.spec.ts — 3 calls (lines 439, 491, 680) - group-chat-multiuser.spec.ts — 2 calls (lines 52, 176) - offline-queue.spec.ts — 2 calls (lines 364, 365) - friend-requests.spec.ts — 1 call (line 747) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent cbec7a9 commit 84e1acf

5 files changed

Lines changed: 9 additions & 9 deletions

File tree

tests/e2e/messaging/complete-user-workflow.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ test.describe('Complete User Messaging Workflow (Feature 024)', () => {
436436
name: /pending received|received/i,
437437
});
438438
await receivedTab.click({ force: true });
439-
await pageB.waitForLoadState('networkidle');
439+
await pageB.waitForLoadState('domcontentloaded');
440440
requestVisible = await pageB
441441
.locator('[data-testid="connection-request"]')
442442
.isVisible({ timeout: 8000 })
@@ -488,7 +488,7 @@ test.describe('Complete User Messaging Workflow (Feature 024)', () => {
488488
'Step 7: connection-request not visible, reloading pageB...'
489489
);
490490
await pageB.reload();
491-
await pageB.waitForLoadState('networkidle');
491+
await pageB.waitForLoadState('domcontentloaded');
492492
await dismissCookieBanner(pageB);
493493
await dismissReAuthModal(pageB, USER_B.password, true);
494494

@@ -677,7 +677,7 @@ test.describe('Conversations Page Loading (Feature 029)', () => {
677677
await page.goto('/messages?tab=chats');
678678
await dismissCookieBanner(page);
679679
await completeEncryptionSetup(page);
680-
await page.waitForLoadState('networkidle');
680+
await page.waitForLoadState('domcontentloaded');
681681
await dismissReAuthModal(page);
682682

683683
// If error is shown, verify retry button exists

tests/e2e/messaging/friend-requests.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ test.describe('Accessibility', () => {
744744
await dismissCookieBanner(page);
745745
await completeEncryptionSetup(page);
746746
await dismissReAuthModal(page);
747-
await page.waitForLoadState('networkidle');
747+
await page.waitForLoadState('domcontentloaded');
748748

749749
// Verify all tabs exist with correct roles and are clickable
750750
const sentTab = page.getByRole('tab', { name: /pending sent|sent/i });

tests/e2e/messaging/group-chat-multiuser.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ async function signInAndNavigateToMessages(page: Page) {
4949
await page.goto(BASE_URL + '/messages');
5050
await dismissCookieBanner(page);
5151
await completeEncryptionSetup(page);
52-
await page.waitForLoadState('networkidle');
52+
await page.waitForLoadState('domcontentloaded');
5353
await dismissReAuthModal(page);
5454
}
5555

@@ -173,7 +173,7 @@ test.describe('Group Chat E2E', () => {
173173
// Wait for new-group page
174174
await page.waitForURL(/.*\/messages\/new-group/, { timeout: 10000 });
175175
await dismissCookieBanner(page);
176-
await page.waitForLoadState('networkidle');
176+
await page.waitForLoadState('domcontentloaded');
177177

178178
// Enter group name
179179
const groupNameInput = page.locator('#group-name');

tests/e2e/messaging/offline-queue.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,8 @@ test.describe('Offline Message Queue', () => {
361361
await completeEncryptionSetup(pageB, USER_B.password);
362362
await dismissReAuthModal(pageB, USER_B.password);
363363

364-
await pageA.waitForLoadState('networkidle');
365-
await pageB.waitForLoadState('networkidle');
364+
await pageA.waitForLoadState('domcontentloaded');
365+
await pageB.waitForLoadState('domcontentloaded');
366366

367367
const threadLocator =
368368
'[data-testid*="message"], textarea[aria-label="Message input"]';

tests/e2e/utils/auth-helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export async function loginAndVerify(
8787
});
8888
break; // Success — URL changed
8989
} catch {
90-
await page.waitForLoadState('networkidle');
90+
await page.waitForLoadState('domcontentloaded');
9191
if (!page.url().includes('/sign-in')) {
9292
break; // WebKit fallback — URL did change
9393
}

0 commit comments

Comments
 (0)