Bound review image retention and separate CI navigation budgets
creative workspace review checks / verify (pull_request) Successful in 51m4s

This commit is contained in:
2026-10-31 03:21:23 +08:00
parent 0849268232
commit 514e790a78
5 changed files with 115 additions and 3 deletions
@@ -90,6 +90,9 @@ export async function verifyGuidanceWorkspaceUI(base: string, browser: Browser)
);
const page = await context.newPage();
page.setDefaultTimeout(10000);
// Navigation includes document and script loading on the shared runner;
// keep action/readiness checks at 10s and the suite's overall bound unchanged.
page.setDefaultNavigationTimeout(30000);
page.on("pageerror", (error) => errors.push(error.message));
page.on("crash", () => errors.push("Browser renderer crashed"));
const pending = new Set<string>(), network: string[] = [];
@@ -97,12 +100,14 @@ export async function verifyGuidanceWorkspaceUI(base: string, browser: Browser)
page.on("requestfinished", request => pending.delete(request.url()));
page.on("requestfailed", request => {pending.delete(request.url());network.push(new URL(request.url()).pathname+": "+request.failure()?.errorText);});
async function navigate(url: string, reload = false) {
const previousSessionReplies = sessionReplies;
const previousSessionReplies = sessionReplies, started = Date.now();
try {
const navigation = await (reload ? page.reload({waitUntil:"domcontentloaded"}) : page.goto(url,{waitUntil:"domcontentloaded"}));
assert.ok(navigation?.ok(), "Navigation returns a successful document");
const documentMs = Date.now() - started;
await page.getByText(signedIn ? "editor@example.com" : "登录你的账户",{exact:true}).first().waitFor({state:"attached"});
assert.ok(sessionReplies > previousSessionReplies, "The new document requests its account fixture and renders the resulting account state");
console.log("Workspace UI navigation timing", JSON.stringify({path:new URL(url).pathname,documentMs,accountReadyMs:Date.now()-started}));
} catch (error) {
const probeStarted=Date.now();
const server=await fetch(url,{signal:AbortSignal.timeout(3000)}).then(async response=>{await response.body?.cancel();return {status:response.status,elapsedMs:Date.now()-probeStarted}}).catch(error=>({error:error instanceof Error?error.name:"unknown",elapsedMs:Date.now()-probeStarted}));