mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-30 11:11:53 +00:00
test: use polling pattern to wait for async terminal tab registration
Amp-Thread-ID: https://ampcode.com/threads/T-019c217a-e7e3-7209-a479-7f5e779fe7f9
This commit is contained in:
@@ -147,9 +147,14 @@ test.describe('Bottom Panel Shortcuts', { tag: '@ui' }, () => {
|
|||||||
test('should maintain panel state when switching to terminal', async ({
|
test('should maintain panel state when switching to terminal', async ({
|
||||||
comfyPage
|
comfyPage
|
||||||
}) => {
|
}) => {
|
||||||
const logsTab = comfyPage.page.getByRole('tab', { name: /Logs/i })
|
// Terminal tabs load asynchronously via dynamic import - wait for registration
|
||||||
await logsTab.waitFor({ state: 'attached', timeout: 5000 })
|
// Use expect().toPass() for auto-retry polling pattern
|
||||||
|
await expect(async () => {
|
||||||
|
const logsTab = comfyPage.page.getByRole('tab', { name: /Logs/i })
|
||||||
|
await expect(logsTab).toBeAttached()
|
||||||
|
}).toPass({ timeout: 10_000 })
|
||||||
|
|
||||||
|
// Open shortcuts panel
|
||||||
await comfyPage.page
|
await comfyPage.page
|
||||||
.locator('button[aria-label*="Keyboard Shortcuts"]')
|
.locator('button[aria-label*="Keyboard Shortcuts"]')
|
||||||
.click()
|
.click()
|
||||||
@@ -158,11 +163,15 @@ test.describe('Bottom Panel Shortcuts', { tag: '@ui' }, () => {
|
|||||||
comfyPage.page.locator('[id*="tab_shortcuts-essentials"]')
|
comfyPage.page.locator('[id*="tab_shortcuts-essentials"]')
|
||||||
).toBeVisible()
|
).toBeVisible()
|
||||||
|
|
||||||
|
// Switch to terminal panel
|
||||||
await comfyPage.page
|
await comfyPage.page
|
||||||
.locator('button[aria-label*="Toggle Bottom Panel"]')
|
.locator('button[aria-label*="Toggle Bottom Panel"]')
|
||||||
.click()
|
.click()
|
||||||
await expect(logsTab).toBeVisible()
|
await expect(
|
||||||
|
comfyPage.page.getByRole('tab', { name: /Logs/i })
|
||||||
|
).toBeVisible()
|
||||||
|
|
||||||
|
// Switch back to shortcuts panel - should remember essentials was active
|
||||||
await comfyPage.page
|
await comfyPage.page
|
||||||
.locator('button[aria-label*="Keyboard Shortcuts"]')
|
.locator('button[aria-label*="Keyboard Shortcuts"]')
|
||||||
.click()
|
.click()
|
||||||
|
|||||||
Reference in New Issue
Block a user