tests: wait for the game overlay's media rows instead of racing them

test_games_page_in_a_browser failed once in a full tools/verify.sh run ("downloaded
artwork is visible without reloading") and passed three times alone. The overlay's
title appears first and its media rows come from a second request; the assertion
counted the rows the moment the title showed. It now waits up to 10 s for the first
present row, then asserts as before.

Evidence: the test alone 3/3 before the change; tools/verify.sh: PASS (format unit
build integration evidence) after it.
This commit is contained in:
Mihawk committed 2026-10-09 22:29:13 -04:00
1 parent bb709b5bfb
commit aa6a35e555
1 file changed
+2
+2
View File
@@ -238,6 +238,8 @@ const { chromium } = require(process.env.PLAYWRIGHT_PATH || 'playwright');
await page.locator('#add-submit').click();
await page.locator('#add-game').waitFor({state:'hidden'});
await page.locator('#sheet-title').filter({hasText:'Super Metroid'}).waitFor();
// The overlay draws its rows from a second request after the title: waited for, not raced.
await page.locator('.media-row-item:not(.missing)').first().waitFor({timeout:10000}).catch(() => {});
assert.ok(await page.locator('.media-row-item:not(.missing)').count() > 0,'downloaded artwork is visible without reloading');
await page.locator('#sheet-close').click();
await page.unroute('**/api/scraper/job?id=*');