export default async function caserunNativeSmoke({ page, goto, wait, screenshot, recordStep }) { await goto("/workbench"); const panel = page.locator("#caserun-panel"); await panel.waitFor({ state: "visible", timeout: 20000 }); await page.locator("#caserun-case-select").selectOption("native-completed"); await page.locator("#caserun-start").click(); await page.locator("#caserun-refresh").click(); await wait(300); const state = await page.locator("#caserun-status").evaluate((element) => element.textContent || ""); const runId = (await page.locator("#caserun-run-id").textContent())?.trim() || ""; const events = await page.locator("#caserun-event-text").textContent(); const aggregateStatus = (await page.locator("#caserun-aggregate-status").textContent())?.trim() || ""; const aggregateRunId = (await page.locator("#caserun-aggregate-run-id").textContent())?.trim() || ""; const aggregateSha = (await page.locator("#caserun-aggregate-sha").textContent())?.trim() || ""; const conditions = { mode: state.includes("native-test"), terminal: state.includes("true"), aggregateStatus: aggregateStatus === "completed", aggregateRunId: aggregateRunId === runId && runId.startsWith("native-completed-"), aggregateSha: /^[a-f0-9]{64}$/.test(aggregateSha), queuedEvent: events?.includes("queued") === true, runningEvent: events?.includes("running") === true, completedEvent: events?.includes("completed") === true }; const image = await screenshot("caserun-native-completed.png"); recordStep("caserun-native-completed", { ok: Object.values(conditions).every(Boolean), conditions }); return { ok: Object.values(conditions).every(Boolean), mode: "native-test", conditions, screenshot: image, finalUrl: page.url(), valuesRedacted: true }; }