diff --git a/ci/surface-test-driver.js b/ci/surface-test-driver.js index 412c568..9509c1d 100644 --- a/ci/surface-test-driver.js +++ b/ci/surface-test-driver.js @@ -54,21 +54,19 @@ if (!TOKEN) { console.log('Navigating to test-runners surface...'); await page.goto(SERVER + '/s/test-runners', { waitUntil: 'networkidle', timeout: 30000 }); - // Wait for runners to load - console.log('Waiting for runners to load...'); - await page.waitForSelector('[data-testid="run-all"], button', { timeout: 30000 }); - - // Wait a bit for all runner scripts to finish loading - await page.waitForTimeout(3000); - - // Click "Run All" button - console.log('Clicking Run All...'); - const runAllBtn = await page.$('button:has-text("Run All")'); + // Wait for the "Run All" button — suites load asynchronously so the + // button only appears once runners have registered their suites. + console.log('Waiting for Run All button...'); + const runAllBtn = await page.waitForSelector('button:has-text("Run All")', { timeout: 60000 }) + .catch(() => null); if (!runAllBtn) { - console.error('ERROR: "Run All" button not found'); + // Dump page content for debugging + const text = await page.textContent('body').catch(() => '(empty)'); + console.error('ERROR: "Run All" button not found. Page text:', text.substring(0, 500)); await browser.close(); process.exit(1); } + console.log('Clicking Run All...'); await runAllBtn.click(); // Wait for results — poll until running state clears