Desktop boot check: say why a tab could not be opened
This commit is contained in:
parent
8106d7c9a2
commit
83bb9a621e
1 changed files with 7 additions and 2 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue