mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-06-07 00:05:11 +00:00
## Summary Resolve missing resource error groups through the error catalog so missing nodes, replaceable nodes, missing models, and missing media use consistent panel and single-error overlay copy. ## Changes - **What**: Adds missing-resource resolvers for `missing_node`, `swap_nodes`, `missing_model`, and `missing_media` that provide `displayMessage`, `toastTitle`, and `toastMessage` alongside the existing group titles. The Errors tab now renders a group-level `displayMessage` under non-execution group headers, which gives grouped missing-resource cards the same explanatory message path used by validation/runtime errors without adding per-row detail fields that these grouped cards do not need. - **What**: Moves missing node and swap node explanatory copy out of card-local hardcoded text and into `errorCatalog.missingErrors.*` keys. `MissingNodeCard` and `SwapNodesCard` now focus on rendering their grouped rows and actions, while the shared error group header owns the explanatory copy. - **What**: Adds environment-aware copy for missing node packs and missing models. Cloud messages explain unsupported resources and replacement/import paths without suggesting local execution, while OSS messages point users toward installing or downloading the missing resources. - **What**: Adds single-error overlay/toast copy for missing resources. Missing media uses a concise input-focused title/message, missing models distinguish Cloud unsupported models from OSS missing files, and missing nodes/swap nodes use node-type-aware copy. - **What**: Deduplicates missing node and swap node toast decisions by distinct node type so repeated instances of the same missing/replaceable node do not accidentally switch the single-error copy to plural copy. - **What**: Preserves representative missing media candidate metadata so missing media toast copy can use a human-readable node name such as `Load Image is missing a required media file.` - **What**: Removes unused missing-resource resolver fields such as grouped `displayDetails`, grouped `displayItemLabel`, and the unused `mediaTypes` source parameter after deciding those fields do not fit grouped missing-resource cards. - **Breaking**: None. - **Dependencies**: None. ## Review Focus - Missing resource groups are still grouped cards. This PR intentionally gives them group-level display and toast copy, but does not split missing resources into one error item per underlying candidate. - Missing resource count semantics are intentionally not normalized here. Error overlay totals, store counts, and grouped card counts still follow the existing behavior; a follow-up PR can define those count units separately. - The Cloud/OSS message variants remain explicit in the resolver instead of being abstracted into a generic variant helper. That keeps this PR focused on the messaging behavior and avoids a broader resolver refactor. - Only `src/locales/en/main.json` is updated directly. Other locales should be synced by the existing localization flow. ## Screenshots (if applicable) <img width="668" height="245" alt="스크린샷 2026-06-05 오전 3 16 49" src="https://github.com/user-attachments/assets/98b50ac3-67e1-438d-8c37-e06c7bf465ee" /> <img width="666" height="195" alt="스크린샷 2026-06-05 오전 3 16 58" src="https://github.com/user-attachments/assets/92da95b1-03d6-4739-97e6-c573982bfec9" /> <img width="505" height="358" alt="스크린샷 2026-06-05 오전 3 17 27" src="https://github.com/user-attachments/assets/4d0e1a6e-13b9-4097-9fb5-19fe0c5331dc" /> <img width="507" height="324" alt="스크린샷 2026-06-05 오전 3 17 44" src="https://github.com/user-attachments/assets/054e42f8-0d0c-44b5-8a67-e467fc04f1fc" /> ## Validation - `pnpm format` - `pnpm lint` - `pnpm test:unit src/platform/errorCatalog/errorMessageResolver.test.ts src/components/rightSidePanel/errors/useErrorGroups.test.ts src/components/rightSidePanel/errors/TabErrors.test.ts` - `pnpm typecheck` - push hook: `knip --cache`
220 lines
6.5 KiB
TypeScript
220 lines
6.5 KiB
TypeScript
import { expect } from '@playwright/test'
|
|
|
|
import type { ComfyPage } from '@e2e/fixtures/ComfyPage'
|
|
import { comfyPageFixture as test } from '@e2e/fixtures/ComfyPage'
|
|
import { TestIds } from '@e2e/fixtures/selectors'
|
|
import { loadWorkflowAndOpenErrorsTab } from '@e2e/fixtures/helpers/ErrorsTabHelper'
|
|
|
|
async function uploadFileViaDropzone(comfyPage: ComfyPage) {
|
|
const dropzone = comfyPage.page.getByTestId(
|
|
TestIds.dialogs.missingMediaUploadDropzone
|
|
)
|
|
const [fileChooser] = await Promise.all([
|
|
comfyPage.page.waitForEvent('filechooser'),
|
|
dropzone.click()
|
|
])
|
|
await fileChooser.setFiles(comfyPage.assetPath('test_upload_image.png'))
|
|
}
|
|
|
|
async function confirmPendingSelection(comfyPage: ComfyPage) {
|
|
const confirmButton = comfyPage.page.getByTestId(
|
|
TestIds.dialogs.missingMediaConfirmButton
|
|
)
|
|
await expect(confirmButton).toBeEnabled()
|
|
await confirmButton.click()
|
|
}
|
|
|
|
function getMediaRow(comfyPage: ComfyPage) {
|
|
return comfyPage.page.getByTestId(TestIds.dialogs.missingMediaRow)
|
|
}
|
|
|
|
function getStatusCard(comfyPage: ComfyPage) {
|
|
return comfyPage.page.getByTestId(TestIds.dialogs.missingMediaStatusCard)
|
|
}
|
|
|
|
function getDropzone(comfyPage: ComfyPage) {
|
|
return comfyPage.page.getByTestId(TestIds.dialogs.missingMediaUploadDropzone)
|
|
}
|
|
|
|
function getErrorOverlay(comfyPage: ComfyPage) {
|
|
return comfyPage.page.getByTestId(TestIds.dialogs.errorOverlay)
|
|
}
|
|
|
|
test.describe('Errors tab - Missing media', { tag: '@ui' }, () => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting(
|
|
'Comfy.RightSidePanel.ShowErrorsTab',
|
|
true
|
|
)
|
|
})
|
|
|
|
test.describe('Detection', () => {
|
|
test('Shows missing media group in errors tab', async ({ comfyPage }) => {
|
|
await comfyPage.workflow.loadWorkflow('missing/missing_media_single')
|
|
|
|
const overlay = getErrorOverlay(comfyPage)
|
|
await expect(overlay).toBeVisible()
|
|
await expect(
|
|
overlay.getByTestId(TestIds.dialogs.errorOverlayMessages)
|
|
).toContainText(/Load Image/)
|
|
|
|
await overlay.getByTestId(TestIds.dialogs.errorOverlaySeeErrors).click()
|
|
await expect(overlay).toBeHidden()
|
|
|
|
const missingMediaGroup = comfyPage.page.getByTestId(
|
|
TestIds.dialogs.missingMediaGroup
|
|
)
|
|
await expect(missingMediaGroup).toBeVisible()
|
|
await expect(
|
|
missingMediaGroup.getByTestId(TestIds.dialogs.errorGroupDisplayMessage)
|
|
).toHaveText(/\S/)
|
|
})
|
|
|
|
test('Shows correct number of missing media rows', async ({
|
|
comfyPage
|
|
}) => {
|
|
await loadWorkflowAndOpenErrorsTab(
|
|
comfyPage,
|
|
'missing/missing_media_multiple'
|
|
)
|
|
|
|
await expect(getMediaRow(comfyPage)).toHaveCount(2)
|
|
})
|
|
|
|
test('Shows upload dropzone and library select for each missing item', async ({
|
|
comfyPage
|
|
}) => {
|
|
await loadWorkflowAndOpenErrorsTab(
|
|
comfyPage,
|
|
'missing/missing_media_single'
|
|
)
|
|
|
|
await expect(getDropzone(comfyPage)).toBeVisible()
|
|
await expect(
|
|
comfyPage.page.getByTestId(TestIds.dialogs.missingMediaLibrarySelect)
|
|
).toBeVisible()
|
|
})
|
|
})
|
|
|
|
test.describe('Upload flow', () => {
|
|
test('Upload via file picker shows status card then allows confirm', async ({
|
|
comfyPage
|
|
}) => {
|
|
await loadWorkflowAndOpenErrorsTab(
|
|
comfyPage,
|
|
'missing/missing_media_single'
|
|
)
|
|
await uploadFileViaDropzone(comfyPage)
|
|
|
|
await expect(getStatusCard(comfyPage)).toBeVisible()
|
|
|
|
await confirmPendingSelection(comfyPage)
|
|
await expect(getMediaRow(comfyPage)).toHaveCount(0)
|
|
})
|
|
})
|
|
|
|
test.describe('Library select flow', () => {
|
|
test('Selecting from library shows status card then allows confirm', async ({
|
|
comfyPage
|
|
}) => {
|
|
await loadWorkflowAndOpenErrorsTab(
|
|
comfyPage,
|
|
'missing/missing_media_single'
|
|
)
|
|
|
|
const librarySelect = comfyPage.page.getByTestId(
|
|
TestIds.dialogs.missingMediaLibrarySelect
|
|
)
|
|
await librarySelect.getByRole('combobox').click()
|
|
|
|
const optionCount = await comfyPage.page.getByRole('option').count()
|
|
if (optionCount === 0) {
|
|
// oxlint-disable-next-line playwright/no-skipped-test -- no library options available in CI
|
|
test.skip()
|
|
return
|
|
}
|
|
|
|
await comfyPage.page.getByRole('option').first().click()
|
|
|
|
await expect(getStatusCard(comfyPage)).toBeVisible()
|
|
|
|
await confirmPendingSelection(comfyPage)
|
|
await expect(getMediaRow(comfyPage)).toHaveCount(0)
|
|
})
|
|
})
|
|
|
|
test.describe('Cancel selection', () => {
|
|
test('Cancelling pending selection returns to upload/library UI', async ({
|
|
comfyPage
|
|
}) => {
|
|
await loadWorkflowAndOpenErrorsTab(
|
|
comfyPage,
|
|
'missing/missing_media_single'
|
|
)
|
|
await uploadFileViaDropzone(comfyPage)
|
|
|
|
await expect(getStatusCard(comfyPage)).toBeVisible()
|
|
await expect(getDropzone(comfyPage)).toBeHidden()
|
|
|
|
await comfyPage.page
|
|
.getByTestId(TestIds.dialogs.missingMediaCancelButton)
|
|
.click()
|
|
|
|
await expect(getStatusCard(comfyPage)).toBeHidden()
|
|
await expect(getDropzone(comfyPage)).toBeVisible()
|
|
})
|
|
})
|
|
|
|
test.describe('All resolved', () => {
|
|
test('Missing Inputs group disappears when all items are resolved', async ({
|
|
comfyPage
|
|
}) => {
|
|
await loadWorkflowAndOpenErrorsTab(
|
|
comfyPage,
|
|
'missing/missing_media_single'
|
|
)
|
|
await uploadFileViaDropzone(comfyPage)
|
|
await confirmPendingSelection(comfyPage)
|
|
|
|
await expect(
|
|
comfyPage.page.getByTestId(TestIds.dialogs.missingMediaGroup)
|
|
).toBeHidden()
|
|
})
|
|
})
|
|
|
|
test.describe('Locate node', () => {
|
|
test('Locate button navigates canvas to the missing media node', async ({
|
|
comfyPage
|
|
}) => {
|
|
await loadWorkflowAndOpenErrorsTab(
|
|
comfyPage,
|
|
'missing/missing_media_single'
|
|
)
|
|
|
|
const offsetBefore = await comfyPage.page.evaluate(() => {
|
|
const canvas = window['app']?.canvas
|
|
return canvas?.ds?.offset
|
|
? [canvas.ds.offset[0], canvas.ds.offset[1]]
|
|
: null
|
|
})
|
|
|
|
const locateButton = comfyPage.page.getByTestId(
|
|
TestIds.dialogs.missingMediaLocateButton
|
|
)
|
|
await expect(locateButton).toBeVisible()
|
|
await locateButton.click()
|
|
|
|
await expect
|
|
.poll(async () => {
|
|
return await comfyPage.page.evaluate(() => {
|
|
const canvas = window['app']?.canvas
|
|
return canvas?.ds?.offset
|
|
? [canvas.ds.offset[0], canvas.ds.offset[1]]
|
|
: null
|
|
})
|
|
})
|
|
.not.toEqual(offsetBefore)
|
|
})
|
|
})
|
|
})
|