performance-optimizations-testing #171

Open
anomalist wants to merge 27 commits from performance-optimizations-testing into master
Showing only changes of commit d33d423b7e - Show all commits

View File

@@ -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 });
});
}