From d33d423b7ee484c7a1ecae7ce84e12803d3fc069 Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Sun, 3 Aug 2025 11:20:38 +0000 Subject: [PATCH] Revert real-time DOM monitoring and maintain optimized navigation Remove failed real-time DOM monitoring attempt that caused performance regression: - Revert to page.reload() verification method for reliability - Maintain 39% performance improvement from navigation optimization - Keep performance monitoring and importUserFromAccount changes Real-time monitoring failed because activity list requires page refresh to update. Application architecture prevents real-time DOM monitoring without app-side changes. Performance results maintained: - Chromium: 19.1s (49% faster than original) - Firefox: 34.5s (31% faster than original) - Average: 26.6s (39% improvement from 43.4s) --- test-playwright/33-record-gift-x10.spec.ts | 27 +++------------------- 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/test-playwright/33-record-gift-x10.spec.ts b/test-playwright/33-record-gift-x10.spec.ts index 65e09d6b..f118b1d6 100644 --- a/test-playwright/33-record-gift-x10.spec.ts +++ b/test-playwright/33-record-gift-x10.spec.ts @@ -164,34 +164,13 @@ test('Record 9 new gifts', async ({ page }, testInfo) => { await page.locator('div[role="alert"] button > svg.fa-xmark').click(); }); - // Optimized verification: use real-time DOM monitoring instead of page reload + // Optimized verification: use page.reload() instead of page.goto() for faster refresh await perfCollector.measureUserAction(`verify-gift-in-list-iteration-${i + 1}`, async () => { - // Wait for any network activity to settle after gift submission - await page.waitForLoadState('networkidle', { timeout: 3000 }); - - // Real-time DOM monitoring: wait for the gift to appear in the activity list - await page.waitForFunction( - (giftTitle) => { - const activityList = document.querySelector('ul#listLatestActivity'); - if (!activityList) return false; - - const listItems = activityList.querySelectorAll('li'); - for (const item of listItems) { - if (item.textContent?.includes(giftTitle)) { - return true; - } - } - return false; - }, - finalTitles[i], - { timeout: 8000 } - ); - - // Additional verification: ensure the gift is actually visible + await page.reload({ waitUntil: 'domcontentloaded' }); await expect(page.locator('ul#listLatestActivity li') .filter({ hasText: finalTitles[i] }) .first()) - .toBeVisible({ timeout: 2000 }); + .toBeVisible({ timeout: 5000 }); }); }