mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-06-06 07:51:57 +00:00
## Summary Preserve validation node errors and their overlay when a valid active root starts execution, so partial workflow runs no longer hide validation failures. ## Changes - **What**: Split execution-start clearing from full error clearing; `execution_start` now clears transient execution/prompt state without clearing validation `lastNodeErrors`. - **What**: Keep the ErrorOverlay open when validation errors are still present, and show it for successful prompt responses that include `node_errors`. - **Dependencies**: None. ## Review Focus Please check the error-clearing boundary between prompt submission/workflow changes and WebSocket `execution_start`. Full clearing still happens through `clearAllErrors`; execution start now uses the narrower clearing path and only dismisses the overlay when there are no validation node errors to show. Linear: FE-851 ## Red-Green Verification - Red: `76bcf34c4 test: add failing validation error preservation e2e` - Green: `9766172ea fix: preserve validation errors on execution start` - Follow-up: `321c95aba fix: keep validation error overlay during execution start` - Coverage: `7b5fab577 test: cover prompt node error overlay` ## Test Plan - `pnpm exec vitest run src/scripts/app.test.ts` - `pnpm exec vitest run src/stores/executionStore.test.ts` - `pnpm exec vitest run src/scripts/app.test.ts src/stores/executionStore.test.ts --coverage` - `pnpm format:check -- src/stores/executionErrorStore.ts src/stores/executionStore.ts src/stores/executionStore.test.ts src/scripts/app.ts src/scripts/app.test.ts browser_tests/fixtures/helpers/ExecutionHelper.ts browser_tests/tests/execution.spec.ts` - `pnpm exec oxlint src/stores/executionErrorStore.ts src/stores/executionStore.ts src/stores/executionStore.test.ts src/scripts/app.ts src/scripts/app.test.ts browser_tests/tests/execution.spec.ts --type-aware` - `pnpm typecheck` - `PLAYWRIGHT_LOCAL=1 PLAYWRIGHT_TEST_URL=http://127.0.0.1:5175 pnpm exec playwright test browser_tests/tests/execution.spec.ts:132` ## Screenshots (Before/After) Before https://github.com/user-attachments/assets/04a212b6-66f9-4c77-9056-58bdc642d96e After https://github.com/user-attachments/assets/db7813c7-bf8a-4e19-9b66-7f49fd01c305
175 lines
5.2 KiB
TypeScript
175 lines
5.2 KiB
TypeScript
import { mergeTests } from '@playwright/test'
|
|
|
|
import type { NodeError } from '@/schemas/apiSchema'
|
|
import {
|
|
comfyExpect as expect,
|
|
comfyPageFixture
|
|
} from '@e2e/fixtures/ComfyPage'
|
|
import type { ComfyPage } from '@e2e/fixtures/ComfyPage'
|
|
import { ExecutionHelper } from '@e2e/fixtures/helpers/ExecutionHelper'
|
|
import { TestIds } from '@e2e/fixtures/selectors'
|
|
import { webSocketFixture } from '@e2e/fixtures/ws'
|
|
|
|
const test = mergeTests(comfyPageFixture, webSocketFixture)
|
|
|
|
const VALIDATION_ERROR_NODE_ID = '1'
|
|
const VALIDATION_ERROR_MESSAGE = 'Required input is missing: source'
|
|
const PARTIAL_EXECUTION_ROOT_NODE_IDS = ['1', '4']
|
|
|
|
type PromptRequestNode = {
|
|
class_type?: string
|
|
}
|
|
|
|
type PromptRequestBody = {
|
|
prompt?: Record<string, PromptRequestNode>
|
|
}
|
|
|
|
function buildPreviewAnyValidationError(): NodeError {
|
|
return {
|
|
class_type: 'PreviewAny',
|
|
dependent_outputs: [VALIDATION_ERROR_NODE_ID],
|
|
errors: [
|
|
{
|
|
type: 'required_input_missing',
|
|
message: VALIDATION_ERROR_MESSAGE,
|
|
details: '',
|
|
extra_info: { input_name: 'source' }
|
|
}
|
|
]
|
|
}
|
|
}
|
|
|
|
function expectPartialExecutionRootNodes(requestBody: unknown): void {
|
|
const prompt = (requestBody as PromptRequestBody).prompt ?? {}
|
|
|
|
for (const nodeId of PARTIAL_EXECUTION_ROOT_NODE_IDS) {
|
|
expect(prompt[nodeId]).toMatchObject({ class_type: 'PreviewAny' })
|
|
}
|
|
}
|
|
|
|
async function getValidationErrorMessage(comfyPage: ComfyPage) {
|
|
return await comfyPage.page.evaluate(
|
|
(nodeId) =>
|
|
window.app!.extensionManager.lastNodeErrors?.[nodeId]?.errors[0]
|
|
?.message ?? null,
|
|
VALIDATION_ERROR_NODE_ID
|
|
)
|
|
}
|
|
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting('Comfy.UseNewMenu', 'Disabled')
|
|
})
|
|
|
|
test.describe('Execution', { tag: ['@smoke', '@workflow'] }, () => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting('Comfy.UseNewMenu', 'Top')
|
|
await comfyPage.settings.setSetting(
|
|
'Comfy.RightSidePanel.ShowErrorsTab',
|
|
true
|
|
)
|
|
await comfyPage.setup()
|
|
})
|
|
|
|
test(
|
|
'Report error on unconnected slot',
|
|
{ tag: '@screenshot' },
|
|
async ({ comfyPage }) => {
|
|
await comfyPage.canvasOps.disconnectEdge()
|
|
await comfyPage.page.keyboard.press('Escape')
|
|
|
|
await comfyPage.command.executeCommand('Comfy.QueuePrompt')
|
|
const errorOverlay = comfyPage.page.getByTestId(
|
|
TestIds.dialogs.errorOverlay
|
|
)
|
|
await expect(errorOverlay).toBeVisible()
|
|
await errorOverlay
|
|
.getByTestId(TestIds.dialogs.errorOverlayDismiss)
|
|
.click()
|
|
await errorOverlay.waitFor({ state: 'hidden' })
|
|
await expect(comfyPage.canvas).toHaveScreenshot(
|
|
'execution-error-unconnected-slot.png'
|
|
)
|
|
}
|
|
)
|
|
})
|
|
|
|
test.describe(
|
|
'Execute to selected output nodes',
|
|
{ tag: ['@smoke', '@workflow'] },
|
|
() => {
|
|
test('Execute to selected output nodes', async ({ comfyPage }) => {
|
|
await comfyPage.workflow.loadWorkflow('execution/partial_execution')
|
|
const input = await comfyPage.nodeOps.getNodeRefById(3)
|
|
const output1 = await comfyPage.nodeOps.getNodeRefById(1)
|
|
const output2 = await comfyPage.nodeOps.getNodeRefById(4)
|
|
await expect
|
|
.poll(async () => (await input.getWidget(0)).getValue())
|
|
.toBe('foo')
|
|
await expect
|
|
.poll(async () => (await output1.getWidget(0)).getValue())
|
|
.toBe('')
|
|
await expect
|
|
.poll(async () => (await output2.getWidget(0)).getValue())
|
|
.toBe('')
|
|
|
|
await output1.click('title')
|
|
|
|
await comfyPage.command.executeCommand('Comfy.QueueSelectedOutputNodes')
|
|
await expect
|
|
.poll(async () => (await input.getWidget(0)).getValue())
|
|
.toBe('foo')
|
|
await expect
|
|
.poll(async () => (await output1.getWidget(0)).getValue())
|
|
.toBe('foo')
|
|
await expect
|
|
.poll(async () => (await output2.getWidget(0)).getValue())
|
|
.toBe('')
|
|
})
|
|
}
|
|
)
|
|
|
|
test.describe('Execution validation errors', { tag: '@workflow' }, () => {
|
|
test('preserves validation errors when another active root starts execution', async ({
|
|
comfyPage,
|
|
getWebSocket
|
|
}) => {
|
|
await comfyPage.settings.setSetting('Comfy.UseNewMenu', 'Top')
|
|
await comfyPage.settings.setSetting(
|
|
'Comfy.RightSidePanel.ShowErrorsTab',
|
|
true
|
|
)
|
|
await comfyPage.setup()
|
|
await comfyPage.workflow.loadWorkflow('execution/partial_execution')
|
|
|
|
const ws = await getWebSocket()
|
|
const exec = new ExecutionHelper(comfyPage, ws)
|
|
const nodeErrors = {
|
|
[VALIDATION_ERROR_NODE_ID]: buildPreviewAnyValidationError()
|
|
}
|
|
let promptRequestBody: unknown
|
|
|
|
const jobId = await exec.run({
|
|
nodeErrors,
|
|
onPromptRequest: (requestBody) => {
|
|
promptRequestBody = requestBody
|
|
}
|
|
})
|
|
expectPartialExecutionRootNodes(promptRequestBody)
|
|
await expect
|
|
.poll(() => getValidationErrorMessage(comfyPage))
|
|
.toBe(VALIDATION_ERROR_MESSAGE)
|
|
const errorOverlay = comfyPage.page.getByTestId(
|
|
TestIds.dialogs.errorOverlay
|
|
)
|
|
await expect(errorOverlay).toBeVisible()
|
|
|
|
await comfyPage.nextFrame()
|
|
exec.executionStart(jobId)
|
|
|
|
await expect
|
|
.poll(() => getValidationErrorMessage(comfyPage))
|
|
.toBe(VALIDATION_ERROR_MESSAGE)
|
|
await expect(errorOverlay).toBeVisible()
|
|
})
|
|
})
|