From 9ede5be388bd33cf72e2b545729d2ead61dc8837 Mon Sep 17 00:00:00 2001 From: bymyself Date: Mon, 2 Feb 2026 11:11:31 -0800 Subject: [PATCH] test: wait for terminal tab registration before testing panel switch Use waitFor to deterministically wait for the Logs tab to be attached after the dynamic import completes, then test the panel switching behavior. Amp-Thread-ID: https://ampcode.com/threads/T-019c1d90-5991-74b1-8c1c-5bcbcc7598f7 --- .../tests/bottomPanelShortcuts.spec.ts | 33 +++++-------------- 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/browser_tests/tests/bottomPanelShortcuts.spec.ts b/browser_tests/tests/bottomPanelShortcuts.spec.ts index c38f5645d..987003e26 100644 --- a/browser_tests/tests/bottomPanelShortcuts.spec.ts +++ b/browser_tests/tests/bottomPanelShortcuts.spec.ts @@ -147,40 +147,25 @@ test.describe('Bottom Panel Shortcuts', { tag: '@ui' }, () => { test('should maintain panel state when switching to terminal', async ({ comfyPage }) => { + const logsTab = comfyPage.page.getByRole('tab', { name: /Logs/i }) + await logsTab.waitFor({ state: 'attached', timeout: 5000 }) + await comfyPage.page .locator('button[aria-label*="Keyboard Shortcuts"]') .click() await expect(comfyPage.page.locator('.bottom-panel')).toBeVisible() + await expect( + comfyPage.page.locator('[id*="tab_shortcuts-essentials"]') + ).toBeVisible() - const terminalButton = comfyPage.page.locator( - 'button[aria-label*="Toggle Bottom Panel"]' - ) - - // Terminal tabs load via dynamic import - wait for them or skip if unavailable - const logsTab = comfyPage.page.locator('.bottom-panel').getByRole('tab', { - name: /Logs/i - }) - const terminalAvailable = await logsTab - .waitFor({ state: 'attached', timeout: 3000 }) - .then(() => true) - .catch(() => false) - - if (!terminalAvailable) { - await comfyPage.page - .locator('button[aria-label*="Keyboard Shortcuts"]') - .click() - test.skip() - return - } - - await terminalButton.click() + await comfyPage.page + .locator('button[aria-label*="Toggle Bottom Panel"]') + .click() await expect(logsTab).toBeVisible() - await expect(comfyPage.page.locator('.bottom-panel')).toBeVisible() await comfyPage.page .locator('button[aria-label*="Keyboard Shortcuts"]') .click() - await expect( comfyPage.page.locator('[id*="tab_shortcuts-essentials"]') ).toBeVisible()