debug: add console logs for terminal tab loading and increase test timeout

Amp-Thread-ID: https://ampcode.com/threads/T-019c21eb-bc34-763e-a553-17ff79018dcf
This commit is contained in:
bymyself
2026-02-02 21:23:43 -08:00
parent 048750599d
commit 85b56f1323
2 changed files with 41 additions and 6 deletions

View File

@@ -147,16 +147,46 @@ test.describe('Bottom Panel Shortcuts', { tag: '@ui' }, () => {
test('should maintain panel state when switching to terminal', async ({
comfyPage
}) => {
// Terminal tabs load asynchronously via dynamic import - wait for registration
// Open terminal panel first to make tabs visible, then poll for Logs tab
// Terminal tabs load asynchronously via dynamic import - wait longer for CI
// Check console for debug messages about terminal tab loading
const consoleLogs: string[] = []
comfyPage.page.on('console', (msg) => {
if (msg.text().includes('BottomPanel')) {
consoleLogs.push(msg.text())
}
})
// Wait for terminal tabs to load by polling the toggle panel button behavior
// When terminal tabs are loaded, "Toggle Bottom Panel" opens terminal panel (shows Logs tab)
// When not loaded, it falls back to shortcuts panel (shows Essential tab)
await expect(async () => {
// Toggle panel open
await comfyPage.page
.locator('button[aria-label*="Toggle Bottom Panel"]')
.click()
await expect(
comfyPage.page.getByRole('tab', { name: /Logs/i })
).toBeVisible({ timeout: 1000 })
}).toPass({ timeout: 15_000 })
await expect(comfyPage.page.locator('.bottom-panel')).toBeVisible({
timeout: 1000
})
// Check if Logs tab appeared (terminal panel) vs Essential tab (shortcuts fallback)
const logsTab = comfyPage.page.getByRole('tab', { name: /Logs/i })
const isLogsVisible = await logsTab.isVisible().catch(() => false)
if (!isLogsVisible) {
// Close panel and retry - terminal tabs not loaded yet
await comfyPage.page
.locator('button[aria-label*="Toggle Bottom Panel"]')
.click()
throw new Error(
`Logs tab not visible yet. Console: ${consoleLogs.join('; ')}`
)
}
}).toPass({ timeout: 30_000, intervals: [500, 1000, 2000] })
// Terminal panel is now open with Logs tab visible
await expect(
comfyPage.page.getByRole('tab', { name: /Logs/i })
).toBeVisible()
// Close the terminal panel
await comfyPage.page

View File

@@ -132,15 +132,20 @@ export const useBottomPanelStore = defineStore('bottomPanel', () => {
// Use __DISTRIBUTION__ directly for proper dead code elimination
if (__DISTRIBUTION__ !== 'cloud') {
try {
console.debug('[BottomPanel] Loading terminal tabs...')
const { useLogsTerminalTab, useCommandTerminalTab } =
await import('@/composables/bottomPanelTabs/useTerminalTabs')
console.debug('[BottomPanel] Terminal tabs loaded, registering...')
registerBottomPanelTab(useLogsTerminalTab())
if (isElectron()) {
registerBottomPanelTab(useCommandTerminalTab())
}
console.debug('[BottomPanel] Terminal tabs registered')
} catch (error) {
console.error('Failed to load terminal tabs:', error)
}
} else {
console.debug('[BottomPanel] Skipping terminal tabs (cloud distribution)')
}
}