Desktop boot check: scroll live art tiles one by one and wait for each lazy thumbnail

This commit is contained in:
CRTkafa 2026-10-22 23:58:45 +08:00
parent 011c2698a4
commit 2f25f76377
2 changed files with 3 additions and 1 deletions

View file

@ -1070,7 +1070,7 @@ async function runLiveArtCase(browser: Browser, sidecar: Sidecar): Promise<CaseR
// nothing is read from the stores until asked (auto-read is off in the saved state)
await page.locator('#live-art button', { hasText: 'Read the stores' }).click({ timeout: WAIT_MS }).catch(e => problems.push(`no "Read the stores" button: ${String(e).split('\n')[0]}`));
// thumbnails load lazily when a tile comes into view, so scroll each one in like a person would
await page.evaluate(() => document.querySelectorAll('#live-art [data-live-tile]').forEach(e => e.scrollIntoView({ block: 'center' })));
for (const tile of await page.locator('#live-art [data-live-tile]').all()) { await tile.scrollIntoViewIfNeeded().catch(() => {}); await page.waitForFunction(el => !!el?.querySelector('img[src^="data:image/"]'), await tile.elementHandle(), { timeout: 3000, polling: 50 }).catch(() => {}); }
const drawn = await page.waitForFunction(() => document.querySelectorAll('#live-art [data-live-tile] img[src^="data:image/"]').length >= 2, null, { timeout: WAIT_MS, polling: 50 }).then(() => true, () => false);
if (!drawn) problems.push(`live thumbnails not drawn (${(await text('#live-art')).slice(0, 300)})`);
const live = await text('#live-art');