From 83bb9a621e58736f96e02b62eca10166a88eb9e2 Mon Sep 17 00:00:00 2001 From: CRT Date: Fri, 23 Oct 2026 10:36:38 +0800 Subject: [PATCH] Desktop boot check: say why a tab could not be opened --- tools/desktop-boot-check.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/desktop-boot-check.ts b/tools/desktop-boot-check.ts index ece6e97..d17deac 100644 --- a/tools/desktop-boot-check.ts +++ b/tools/desktop-boot-check.ts @@ -249,8 +249,13 @@ async function clickTab(page: Page, id: string, o: { timeout?: number } = {}): P await tab.waitFor({ state: 'attached', timeout: o.timeout }); if (await tab.isVisible()) { await tab.click(o); return; } const label = ((await tab.textContent()) ?? '').replace(/\d+$/, '').trim(); - await page.locator('.ds-tab-more').click(o); - await page.locator('.ds-menu [role="menuitem"]', { hasText: label }).first().click(o); + try { + await page.locator('.ds-tab-more').click(o); + await page.locator('.ds-menu [role="menuitem"]', { hasText: label }).first().click(o); + } catch (e) { + const why = await page.evaluate(() => JSON.stringify({ more: document.querySelectorAll('.ds-tab-more').length, menu: [...document.querySelectorAll('.ds-menu [role^="menuitem"]')].map(x => x.textContent), w: innerWidth })); + throw new Error(`${String(e).split('\n')[0]} (${label}; ${why})`); + } } async function state(page: Page) {