mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +00:00
## Summary More simplification ## Changes - **What**: - Remove more UseNewMenu settings calls - Remove `await comfyPage.setup()` - Remove `waitForNodes` in vue node tagged tests ┆Issue is synchronized with this [Notion page](https://app.notion.com/p/PR-11237-test-Remove-unnecessary-setup-UseNewMenu-and-waitForNodes-calls-3426d73d36508198a100c218420d479c) by [Unito](https://www.unito.io)
68 lines
1.9 KiB
TypeScript
68 lines
1.9 KiB
TypeScript
import {
|
|
comfyPageFixture as test,
|
|
comfyExpect as expect
|
|
} from '@e2e/fixtures/ComfyPage'
|
|
|
|
test.describe('Toast Notifications', { tag: '@ui' }, () => {
|
|
async function triggerErrorToast(comfyPage: {
|
|
page: { evaluate: (fn: () => void) => Promise<void> }
|
|
nextFrame: () => Promise<void>
|
|
}) {
|
|
await comfyPage.page.evaluate(() => {
|
|
window.app!.extensionManager.toast.add({
|
|
severity: 'error',
|
|
summary: 'Error',
|
|
detail: 'Test execution error',
|
|
life: 30000
|
|
})
|
|
})
|
|
await comfyPage.nextFrame()
|
|
}
|
|
|
|
test('Error toast appears when triggered', async ({ comfyPage }) => {
|
|
await triggerErrorToast(comfyPage)
|
|
|
|
await expect(comfyPage.toast.visibleToasts.first()).toBeVisible()
|
|
})
|
|
|
|
test('Toast shows correct error severity class', async ({ comfyPage }) => {
|
|
await triggerErrorToast(comfyPage)
|
|
|
|
const errorToast = comfyPage.page.locator(
|
|
'.p-toast-message.p-toast-message-error'
|
|
)
|
|
await expect(errorToast.first()).toBeVisible()
|
|
})
|
|
|
|
test('Toast can be dismissed via close button', async ({ comfyPage }) => {
|
|
await triggerErrorToast(comfyPage)
|
|
|
|
await expect(comfyPage.toast.visibleToasts.first()).toBeVisible()
|
|
|
|
const closeButton = comfyPage.page.locator('.p-toast-close-button').first()
|
|
await closeButton.click()
|
|
|
|
await expect(comfyPage.toast.visibleToasts).toHaveCount(0)
|
|
})
|
|
|
|
test('All toasts cleared via closeToasts helper', async ({ comfyPage }) => {
|
|
await triggerErrorToast(comfyPage)
|
|
|
|
await expect(comfyPage.toast.visibleToasts.first()).toBeVisible()
|
|
|
|
await comfyPage.toast.closeToasts()
|
|
|
|
await expect(comfyPage.toast.visibleToasts).toHaveCount(0)
|
|
})
|
|
|
|
test('Toast error count is accurate', async ({ comfyPage }) => {
|
|
await triggerErrorToast(comfyPage)
|
|
|
|
await expect(
|
|
comfyPage.page.locator('.p-toast-message.p-toast-message-error').first()
|
|
).toBeVisible()
|
|
|
|
await expect(comfyPage.toast.toastErrors).not.toHaveCount(0)
|
|
})
|
|
})
|