Files
ComfyUI_frontend/browser_tests/tests/workflowDeleteSettings.spec.ts
pythongosssss 5fbcea6b27 test: add test for workflow delete confirmation (#11780)
## Summary

Adds tests for the `Comfy.Workflow.ConfirmDelete` setting

## Changes

- **What**: 
- ensures dialog does/doesnt appear based on the setting

┆Issue is synchronized with this [Notion
page](https://app.notion.com/p/PR-11780-test-add-test-for-workflow-delete-confirmation-3526d73d36508134a3cdf0e908b95919)
by [Unito](https://www.unito.io)

Co-authored-by: Christian Byrne <cbyrne@comfy.org>
2026-05-04 21:51:50 +00:00

50 lines
1.5 KiB
TypeScript

import {
comfyExpect as expect,
comfyPageFixture as test
} from '@e2e/fixtures/ComfyPage'
import type { ComfyPage } from '@e2e/fixtures/ComfyPage'
const WORKFLOW_NAME = 'test-confirm-delete'
async function startDeletingFromSidebar(comfyPage: ComfyPage) {
const { workflowsTab } = comfyPage.menu
await workflowsTab.open()
await workflowsTab.getPersistedItem(WORKFLOW_NAME).click({ button: 'right' })
await comfyPage.contextMenu.clickMenuItem('Delete')
}
test.describe('Comfy.Workflow.ConfirmDelete', () => {
test.beforeEach(async ({ comfyPage }) => {
await comfyPage.menu.topbar.saveWorkflowAs(WORKFLOW_NAME)
})
test.afterEach(async ({ comfyPage }) => {
await comfyPage.workflow.setupWorkflowsDirectory({})
})
test('on (default): right-click → Delete prompts the confirm dialog', async ({
comfyPage
}) => {
await comfyPage.settings.setSetting('Comfy.Workflow.ConfirmDelete', true)
await startDeletingFromSidebar(comfyPage)
await expect(comfyPage.confirmDialog.root).toBeVisible()
await expect(comfyPage.confirmDialog.delete).toBeVisible()
})
test('off: right-click → Delete bypasses the confirm dialog', async ({
comfyPage
}) => {
await comfyPage.settings.setSetting('Comfy.Workflow.ConfirmDelete', false)
await startDeletingFromSidebar(comfyPage)
const { workflowsTab } = comfyPage.menu
await expect(comfyPage.confirmDialog.root).toBeHidden()
await expect
.poll(() => workflowsTab.getTopLevelSavedWorkflowNames())
.not.toContain(WORKFLOW_NAME)
})
})