fix(web-sentinel): wait for dashboard trigger button

This commit is contained in:
Codex
2026-07-01 12:17:07 +00:00
parent 0ae78ecc85
commit d462a48ed7
@@ -713,6 +713,14 @@ if (requestedRunId) {
let manualTrigger = { requested: triggerManual, ok: !triggerManual, status: triggerManual ? "not-attempted" : "not-requested", jobName: null, statusText: "" };
if (triggerManual) {
for (let attempt = 1; attempt <= 2; attempt += 1) {
const buttonReady = await page.waitForSelector("[data-monitor-manual-trigger='true']", { timeout: Math.min(20000, timeout) }).then(() => true).catch(() => false);
if (buttonReady) break;
if (attempt === 1) {
await page.reload({ timeout: perAttemptTimeout, waitUntil: "domcontentloaded" }).catch(() => null);
await page.waitForFunction(() => document.querySelector("#monitor-web-root")?.getAttribute("data-monitor-ready") === "true", null, { timeout: Math.min(12000, perAttemptTimeout) }).catch(() => {});
}
}
manualTrigger = await page.evaluate(async () => {
const wait = (ms) => new Promise((resolve) => window.setTimeout(resolve, ms));
const root = document.querySelector("[data-monitor-shell='true']");