Merge pull request #1413 from pikasTech/fix/1400-dashboard-trigger-wait-button

fix(web-sentinel): wait for dashboard trigger button
This commit is contained in:
Lyon
2026-07-01 20:17:55 +08:00
committed by GitHub
@@ -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']");