mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-19 22:09:37 +00:00
## Summary Adds Playwright E2E tests for the QueueClearHistoryDialog component. ## Tests added - Dialog opens from queue panel history actions menu - Dialog shows confirmation message with title, description, and assets note - Cancel button closes dialog without clearing history - Close (X) button closes dialog without clearing history - Confirm clear action triggers queue history clear API call - Dialog state resets properly after close/reopen ## Task Part of Test Coverage Q2 Overhaul (DLG-02). ## Conventions - Uses Vue nodes with new menu enabled (`Comfy.UseNewMenu: 'Top'`) - Tests read as user stories - No full-page screenshots - Proper waits, no sleeps ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-10586-test-add-QueueClearHistoryDialog-E2E-tests-DLG-02-3306d73d36508174a07bd9782340a0f7) by [Unito](https://www.unito.io) --------- Co-authored-by: GitHub Action <action@github.com>
127 lines
3.6 KiB
TypeScript
127 lines
3.6 KiB
TypeScript
import {
|
|
comfyPageFixture as test,
|
|
comfyExpect as expect
|
|
} from '../../fixtures/ComfyPage'
|
|
|
|
test.describe('Queue Clear History Dialog', { tag: '@ui' }, () => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.setup()
|
|
await comfyPage.queuePanel.overlayToggle.click()
|
|
})
|
|
|
|
test('Dialog opens from queue panel history actions menu', async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.queuePanel.openClearHistoryDialog()
|
|
|
|
const dialog = comfyPage.confirmDialog.root
|
|
await expect(dialog).toBeVisible()
|
|
})
|
|
|
|
test('Dialog shows confirmation message with title, description, and assets note', async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.queuePanel.openClearHistoryDialog()
|
|
|
|
const dialog = comfyPage.confirmDialog.root
|
|
await expect(dialog).toBeVisible()
|
|
|
|
await expect(
|
|
dialog.getByText('Clear your job queue history?')
|
|
).toBeVisible()
|
|
|
|
await expect(
|
|
dialog.getByText(
|
|
'All the finished or failed jobs below will be removed from this Job queue panel.'
|
|
)
|
|
).toBeVisible()
|
|
|
|
await expect(
|
|
dialog.getByText(
|
|
'Assets generated by these jobs won\u2019t be deleted and can always be viewed from the assets panel.'
|
|
)
|
|
).toBeVisible()
|
|
})
|
|
|
|
test('Cancel button closes dialog without clearing history', async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.queuePanel.openClearHistoryDialog()
|
|
|
|
const dialog = comfyPage.confirmDialog.root
|
|
await expect(dialog).toBeVisible()
|
|
|
|
let clearCalled = false
|
|
await comfyPage.page.route('**/api/history', (route) => {
|
|
if (route.request().method() === 'POST') {
|
|
clearCalled = true
|
|
}
|
|
return route.continue()
|
|
})
|
|
|
|
await dialog.getByRole('button', { name: 'Cancel' }).click()
|
|
await expect(dialog).not.toBeVisible()
|
|
expect(clearCalled).toBe(false)
|
|
|
|
await comfyPage.page.unroute('**/api/history')
|
|
})
|
|
|
|
test('Close (X) button closes dialog without clearing history', async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.queuePanel.openClearHistoryDialog()
|
|
|
|
const dialog = comfyPage.confirmDialog.root
|
|
await expect(dialog).toBeVisible()
|
|
|
|
let clearCalled = false
|
|
await comfyPage.page.route('**/api/history', (route) => {
|
|
if (route.request().method() === 'POST') {
|
|
clearCalled = true
|
|
}
|
|
return route.continue()
|
|
})
|
|
|
|
await dialog.getByLabel('Close').click()
|
|
await expect(dialog).not.toBeVisible()
|
|
expect(clearCalled).toBe(false)
|
|
|
|
await comfyPage.page.unroute('**/api/history')
|
|
})
|
|
|
|
test('Confirm clears queue history and closes dialog', async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.queuePanel.openClearHistoryDialog()
|
|
|
|
const dialog = comfyPage.confirmDialog.root
|
|
await expect(dialog).toBeVisible()
|
|
|
|
const clearPromise = comfyPage.page.waitForRequest(
|
|
(req) => req.url().includes('/api/history') && req.method() === 'POST'
|
|
)
|
|
|
|
await dialog.getByRole('button', { name: 'Clear' }).click()
|
|
|
|
const request = await clearPromise
|
|
expect(request.postDataJSON()).toEqual({ clear: true })
|
|
|
|
await expect(dialog).not.toBeVisible()
|
|
})
|
|
|
|
test('Dialog state resets after close and reopen', async ({ comfyPage }) => {
|
|
await comfyPage.queuePanel.openClearHistoryDialog()
|
|
const dialog = comfyPage.confirmDialog.root
|
|
await expect(dialog).toBeVisible()
|
|
await dialog.getByRole('button', { name: 'Cancel' }).click()
|
|
await expect(dialog).not.toBeVisible()
|
|
|
|
await comfyPage.queuePanel.openClearHistoryDialog()
|
|
await expect(dialog).toBeVisible()
|
|
|
|
const clearButton = dialog.getByRole('button', { name: 'Clear' })
|
|
await expect(clearButton).toBeVisible()
|
|
await expect(clearButton).toBeEnabled()
|
|
})
|
|
})
|