mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-22 15:29:44 +00:00
fix: correct toast notification test setup for wave 3
This commit is contained in:
@@ -9,74 +9,65 @@ test.describe('Queue Notification Banners', { tag: '@ui' }, () => {
|
||||
await comfyPage.setup()
|
||||
})
|
||||
|
||||
async function triggerExecutionError(comfyPage: {
|
||||
canvasOps: { disconnectEdge(): Promise<void> }
|
||||
page: { keyboard: { press(key: string): Promise<void> } }
|
||||
command: { executeCommand(cmd: string): Promise<void> }
|
||||
nextFrame(): Promise<void>
|
||||
}) {
|
||||
test('Banner appears when prompt is queued', async ({ comfyPage }) => {
|
||||
await comfyPage.command.executeCommand('Comfy.QueuePrompt')
|
||||
|
||||
const banner = comfyPage.page.locator('[role="status"][aria-live="polite"]')
|
||||
await expect(banner).toBeVisible()
|
||||
})
|
||||
|
||||
test('Banner shows queuing text initially', async ({ comfyPage }) => {
|
||||
await comfyPage.command.executeCommand('Comfy.QueuePrompt')
|
||||
|
||||
const banner = comfyPage.page.locator('[role="status"][aria-live="polite"]')
|
||||
await expect(banner).toBeVisible()
|
||||
await expect(banner).toContainText(/Job queuing|Job queued/)
|
||||
})
|
||||
|
||||
test('Error overlay appears on failed execution', async ({ comfyPage }) => {
|
||||
await comfyPage.canvasOps.disconnectEdge()
|
||||
await comfyPage.nextFrame()
|
||||
await comfyPage.page.keyboard.press('Escape')
|
||||
await comfyPage.command.executeCommand('Comfy.QueuePrompt')
|
||||
}
|
||||
|
||||
test('Toast appears when prompt is queued', async ({ comfyPage }) => {
|
||||
const errorOverlay = comfyPage.page.locator(
|
||||
'[data-testid="error-overlay"]'
|
||||
)
|
||||
await expect(errorOverlay).toBeVisible()
|
||||
})
|
||||
|
||||
test('Error overlay contains error description', async ({ comfyPage }) => {
|
||||
await comfyPage.canvasOps.disconnectEdge()
|
||||
await comfyPage.page.keyboard.press('Escape')
|
||||
await comfyPage.command.executeCommand('Comfy.QueuePrompt')
|
||||
|
||||
await expect(comfyPage.toast.visibleToasts.first()).toBeVisible()
|
||||
})
|
||||
|
||||
test('Error toast appears on failed execution', async ({ comfyPage }) => {
|
||||
await triggerExecutionError(comfyPage)
|
||||
|
||||
const errorToast = comfyPage.page.locator(
|
||||
'.p-toast-message.p-toast-message-error'
|
||||
const errorOverlay = comfyPage.page.locator(
|
||||
'[data-testid="error-overlay"]'
|
||||
)
|
||||
await expect(errorToast.first()).toBeVisible()
|
||||
await expect(errorOverlay).toBeVisible()
|
||||
await expect(errorOverlay).not.toHaveText('')
|
||||
})
|
||||
|
||||
test('Error toast contains error description', async ({ comfyPage }) => {
|
||||
await triggerExecutionError(comfyPage)
|
||||
test('Error overlay can be dismissed', async ({ comfyPage }) => {
|
||||
await comfyPage.canvasOps.disconnectEdge()
|
||||
await comfyPage.page.keyboard.press('Escape')
|
||||
await comfyPage.command.executeCommand('Comfy.QueuePrompt')
|
||||
|
||||
const errorToast = comfyPage.page.locator(
|
||||
'.p-toast-message.p-toast-message-error'
|
||||
const errorOverlay = comfyPage.page.locator(
|
||||
'[data-testid="error-overlay"]'
|
||||
)
|
||||
await expect(errorToast.first()).toBeVisible()
|
||||
await expect(errorToast.first()).not.toHaveText('')
|
||||
await expect(errorOverlay).toBeVisible()
|
||||
|
||||
await errorOverlay.getByRole('button', { name: /Dismiss/i }).click()
|
||||
await expect(errorOverlay).toBeHidden()
|
||||
})
|
||||
|
||||
test('Toast close button dismisses individual toast', async ({
|
||||
comfyPage
|
||||
}) => {
|
||||
await triggerExecutionError(comfyPage)
|
||||
test('Banner auto-dismisses after display', async ({ comfyPage }) => {
|
||||
await comfyPage.command.executeCommand('Comfy.QueuePrompt')
|
||||
|
||||
await expect(comfyPage.toast.visibleToasts.first()).toBeVisible()
|
||||
const banner = comfyPage.page.locator('[role="status"][aria-live="polite"]')
|
||||
await expect(banner).toBeVisible()
|
||||
|
||||
const closeButton = comfyPage.page.locator('.p-toast-close-button').first()
|
||||
await closeButton.click()
|
||||
|
||||
await expect(comfyPage.toast.visibleToasts).toHaveCount(0)
|
||||
})
|
||||
|
||||
test('Multiple toasts can stack', async ({ comfyPage }) => {
|
||||
await triggerExecutionError(comfyPage)
|
||||
await expect(comfyPage.toast.visibleToasts.first()).toBeVisible()
|
||||
|
||||
await triggerExecutionError(comfyPage)
|
||||
await expect(comfyPage.toast.visibleToasts).not.toHaveCount(0)
|
||||
|
||||
const count = await comfyPage.toast.getVisibleToastCount()
|
||||
expect(count).toBeGreaterThanOrEqual(2)
|
||||
})
|
||||
|
||||
test('All toasts can be cleared', async ({ comfyPage }) => {
|
||||
await triggerExecutionError(comfyPage)
|
||||
|
||||
await expect(comfyPage.toast.visibleToasts.first()).toBeVisible()
|
||||
|
||||
await comfyPage.toast.closeToasts()
|
||||
|
||||
expect(await comfyPage.toast.getVisibleToastCount()).toBe(0)
|
||||
// Banner auto-dismisses after ~4 seconds
|
||||
await expect(banner).toBeHidden({ timeout: 10000 })
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user