From 5b7b16ac0835cccafc6d39e8cd7b8414c257ede4 Mon Sep 17 00:00:00 2001 From: CRT Date: Fri, 23 Oct 2026 10:25:26 +0800 Subject: [PATCH] Desktop boot check: accept the in-app dry-run preview before the native confirm --- tools/desktop-boot-check.ts | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/tools/desktop-boot-check.ts b/tools/desktop-boot-check.ts index 5811a78..f40b1c4 100644 --- a/tools/desktop-boot-check.ts +++ b/tools/desktop-boot-check.ts @@ -230,6 +230,16 @@ function serve(dist: string, csp: string, breakBundle: boolean) { interface CaseResult { name: string; ok: boolean; problems: string[]; visited: number; notes: string[] } +/** A page that accepts the in-app dry-run preview of a write (Continue) whenever it shows, like a person reading it and + * going on: the native confirm dialog after it is what each case checks. */ +async function newPage(ctx: { newPage(): Promise }): Promise { + const page = await ctx.newPage(); + await page.addLocatorHandler(page.locator('.ds-scrim:has(.dr-cmd)'), async () => { + await page.locator('.ds-scrim:has(.dr-cmd) .btn-primary').click(); + }); + return page; +} + async function state(page: Page) { return page.evaluate(() => ({ booted: document.documentElement.dataset.booted === '1', @@ -272,7 +282,7 @@ async function runCase(browser: Browser, name: string, sidecar: Sidecar, o: { br const freeze = conf.app.security.freezePrototype === true; const server = serve(DIST, cspHeader(conf.app.security.csp), !!o.breakBundle); const ctx = await browser.newContext({ viewport: { width: 1280, height: 800 }, reducedMotion: 'reduce' }); - const page = await ctx.newPage(); + const page = await newPage(ctx); const problems: string[] = []; const notes: string[] = []; const unmocked = new Set(); @@ -397,7 +407,7 @@ async function runSubmitCase(browser: Browser, sidecar: Sidecar, base: 'd3-full' const freeze = conf.app.security.freezePrototype === true; const server = serve(DIST, cspHeader(conf.app.security.csp), false); const ctx = await browser.newContext({ viewport: { width: 1360, height: 900 }, reducedMotion: 'reduce' }); - const page = await ctx.newPage(); + const page = await newPage(ctx); const problems: string[] = []; const notes: string[] = []; const unmocked = new Set(); @@ -524,7 +534,7 @@ async function runReleaseStateCase(browser: Browser, sidecar: Sidecar, page404: const freeze = conf.app.security.freezePrototype === true; const server = serve(DIST, cspHeader(conf.app.security.csp), false); const ctx = await browser.newContext({ viewport: { width: 1360, height: 900 }, reducedMotion: 'reduce' }); - const page = await ctx.newPage(); + const page = await newPage(ctx); const problems: string[] = []; const notes: string[] = []; const unmocked = new Set(); @@ -615,7 +625,7 @@ async function runAutoReadCase(browser: Browser): Promise { const freeze = conf.app.security.freezePrototype === true; const server = serve(DIST, cspHeader(conf.app.security.csp), false); const ctx = await browser.newContext({ viewport: { width: 1360, height: 900 }, reducedMotion: 'reduce' }); - const page = await ctx.newPage(); + const page = await newPage(ctx); const problems: string[] = []; const notes: string[] = []; const logged: string[] = []; @@ -740,7 +750,7 @@ async function runErrorCase(browser: Browser, sidecar: Sidecar, variant: 'api-di const freeze = conf.app.security.freezePrototype === true; const server = serve(DIST, cspHeader(conf.app.security.csp), false); const ctx = await browser.newContext({ viewport: { width: 1360, height: 900 }, reducedMotion: 'reduce' }); - const page = await ctx.newPage(); + const page = await newPage(ctx); const problems: string[] = []; const notes: string[] = []; const unmocked = new Set(); @@ -858,7 +868,7 @@ async function runEditorCase(browser: Browser, sidecar: Sidecar): Promise(); @@ -1013,7 +1023,7 @@ async function runLiveArtCase(browser: Browser, sidecar: Sidecar): Promise();