mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +00:00
## Summary Simplifies test setup for common settings ## Changes - **What**: - add vue-nodes tag to auto enable nodes 2.0 - remove UseNewMenu Top as this is default ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-11184-test-Simplify-vue-node-menu-test-setup-3416d73d3650815487e0c357d28761fe) by [Unito](https://www.unito.io)
72 lines
2.0 KiB
TypeScript
72 lines
2.0 KiB
TypeScript
import {
|
|
comfyPageFixture as test,
|
|
comfyExpect as expect
|
|
} from '@e2e/fixtures/ComfyPage'
|
|
|
|
test.describe('Toast Notifications', { tag: '@ui' }, () => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.setup()
|
|
})
|
|
|
|
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)
|
|
})
|
|
})
|