commit 0fb5a7736cd2f9318f185a4e0a0f2d5b3e73f97d
parent 43fb9fa4943a04511bffd96ccd1ba7e925d1ef15
Author: Brian Graham <brian@buildingbetterteams.de>
Date: Wed, 8 Apr 2026 13:23:55 +0200
Fix page load: use waitUntil commit, try root URL first
Games with blocking JS never fire domcontentloaded.
waitUntil: commit just waits for first bytes.
Try root / before /index.html (serve SPA mode redirect).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Diffstat:
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/tasks/tetris/eval/gameplay-bot/tests.ts b/tasks/tetris/eval/gameplay-bot/tests.ts
@@ -994,7 +994,9 @@ function extractScoreFromText(text: string | null): number[] {
}
async function loadGamePage(page: Page, serverUrl: string): Promise<void> {
+ // Try root first (serve SPA mode redirects /index.html to /)
const candidates = [
+ "",
"index.html",
"dist/index.html",
"public/index.html",
@@ -1003,18 +1005,20 @@ async function loadGamePage(page: Page, serverUrl: string): Promise<void> {
for (const candidate of candidates) {
try {
- const response = await page.goto(`${serverUrl}/${candidate}`, {
- timeout: 5000,
- waitUntil: "domcontentloaded",
+ const url = candidate ? `${serverUrl}/${candidate}` : `${serverUrl}/`;
+ const response = await page.goto(url, {
+ timeout: 15000,
+ waitUntil: "commit",
});
- if (response && response.ok()) return;
+ if (response && response.ok()) {
+ // Give the page a moment to render after commit
+ await page.waitForTimeout(2000);
+ return;
+ }
} catch {
continue;
}
}
-
- // Last resort: try root
- await page.goto(`${serverUrl}/`, { timeout: 5000, waitUntil: "domcontentloaded" });
}
function emptyCalibration(consoleErrors: string[]): CalibrationResult {