// Shared helpers for Playwright tests const BASE_URL = process.env.SX_TEST_URL || 'http://localhost:8013'; /** * Wait for the SX runtime to finish hydration. * boot-init sets data-sx-ready="true" on after all islands are hydrated. */ async function waitForSxReady(page, timeout = 15000) { await page.waitForSelector('html[data-sx-ready]', { timeout }); } /** * Navigate to an SX page and wait for hydration to complete. * Replaces the old pattern of networkidle + arbitrary sleep. */ async function loadPage(page, path, timeout = 15000) { await page.goto(BASE_URL + '/sx/' + path, { waitUntil: 'domcontentloaded', timeout }); await waitForSxReady(page); } module.exports = { BASE_URL, waitForSxReady, loadPage };