mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 06:20:11 +00:00
## Summary - Surface missing models in the Error Tab for OSS environments, replacing the legacy modal dialog - Add Download button per model and Download All button in group header with file size display - Move download business logic from `components/dialog/content` to `platform/missingModel` - Remove legacy missing models dialog components and composable ## Changes - **Pipeline**: Remove `isCloud` guard from `scanAllModelCandidates` and `surfaceMissingModels` so OSS detects missing models - **Grouping**: Group non-asset-supported models by directory in OSS instead of lumping into UNSUPPORTED - **UI**: Add Download button (matching Install Node Pack design) and Download All header button - **Store**: Add `folderPaths`/`fileSizes` state with setter methods, race condition guard - **Cleanup**: Delete `MissingModelsContent`, `MissingModelsHeader`, `MissingModelsFooter`, `useMissingModelsDialog`, `missingModelsUtils` - **Tests**: Add OSS/Cloud grouping tests, migrate Playwright E2E to Error Tab, improve test isolation - **Snapshots**: Reset Playwright screenshot expectations since OSS missing model error detection now causes red highlights on affected nodes - **Accessibility**: Add `aria-label` with model name, `aria-expanded` on toggle, warning icon for unknown category ## Test plan - [x] Unit tests pass (86 tests) - [x] TypeScript typecheck passes - [x] knip passes - [x] Load workflow with missing models in OSS → Error Tab shows missing models grouped by directory - [x] Download button triggers browser download with correct URL - [x] Download All button downloads all downloadable models - [x] Cloud environment behavior unchanged - [x] Playwright E2E: `pnpm test:browser:local -- --grep "Missing models in Error Tab"` ## Screenshots https://github.com/user-attachments/assets/12f15e09-215a-4c58-87ed-39bbffd1359c ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-9921-feat-surface-missing-models-in-Error-Tab-for-OSS-and-remove-legacy-dialog-3236d73d365081f0a9dfc291978f5ecf) by [Unito](https://www.unito.io) --------- Co-authored-by: GitHub Action <action@github.com> Co-authored-by: github-actions <github-actions@github.com>
351 lines
12 KiB
TypeScript
351 lines
12 KiB
TypeScript
import { expect } from '@playwright/test'
|
|
|
|
import type { Keybinding } from '../../src/platform/keybindings/types'
|
|
import { comfyPageFixture as test } from '../fixtures/ComfyPage'
|
|
import { DefaultGraphPositions } from '../fixtures/constants/defaultGraphPositions'
|
|
import { TestIds } from '../fixtures/selectors'
|
|
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting('Comfy.UseNewMenu', 'Disabled')
|
|
})
|
|
|
|
test.describe('Load workflow warning', { tag: '@ui' }, () => {
|
|
test('Should display a warning when loading a workflow with missing nodes', async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.workflow.loadWorkflow('missing/missing_nodes')
|
|
|
|
const missingNodesWarning = comfyPage.page.getByTestId(
|
|
TestIds.dialogs.missingNodes
|
|
)
|
|
await expect(missingNodesWarning).toBeVisible()
|
|
})
|
|
|
|
test('Should display a warning when loading a workflow with missing nodes in subgraphs', async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.workflow.loadWorkflow('missing/missing_nodes_in_subgraph')
|
|
|
|
const missingNodesWarning = comfyPage.page.getByTestId(
|
|
TestIds.dialogs.missingNodes
|
|
)
|
|
await expect(missingNodesWarning).toBeVisible()
|
|
|
|
// Verify the missing node text includes subgraph context
|
|
const warningText = await missingNodesWarning.textContent()
|
|
expect(warningText).toContain('MISSING_NODE_TYPE_IN_SUBGRAPH')
|
|
expect(warningText).toContain('in subgraph')
|
|
})
|
|
})
|
|
|
|
test('Does not report warning on undo/redo', async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting('Comfy.NodeSearchBoxImpl', 'v1 (legacy)')
|
|
const missingNodesWarning = comfyPage.page.getByTestId(
|
|
TestIds.dialogs.missingNodes
|
|
)
|
|
|
|
await comfyPage.workflow.loadWorkflow('missing/missing_nodes')
|
|
await expect(missingNodesWarning).toBeVisible()
|
|
await comfyPage.page.keyboard.press('Escape')
|
|
await expect(missingNodesWarning).not.toBeVisible()
|
|
|
|
// Wait for any async operations to complete after dialog closes
|
|
await comfyPage.nextFrame()
|
|
|
|
// Make a change to the graph
|
|
await comfyPage.canvasOps.doubleClick()
|
|
await comfyPage.searchBox.fillAndSelectFirstNode('KSampler')
|
|
|
|
// Undo and redo the change
|
|
await comfyPage.keyboard.undo()
|
|
await expect(async () => {
|
|
await expect(missingNodesWarning).not.toBeVisible()
|
|
}).toPass({ timeout: 5000 })
|
|
|
|
await comfyPage.keyboard.redo()
|
|
await expect(async () => {
|
|
await expect(missingNodesWarning).not.toBeVisible()
|
|
}).toPass({ timeout: 5000 })
|
|
})
|
|
|
|
test.describe('Execution error', () => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting('Comfy.UseNewMenu', 'Top')
|
|
await comfyPage.settings.setSetting(
|
|
'Comfy.RightSidePanel.ShowErrorsTab',
|
|
true
|
|
)
|
|
await comfyPage.setup()
|
|
})
|
|
|
|
test('Should display an error message when an execution error occurs', async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.workflow.loadWorkflow('nodes/execution_error')
|
|
await comfyPage.command.executeCommand('Comfy.QueuePrompt')
|
|
await comfyPage.nextFrame()
|
|
|
|
// Wait for the error overlay to be visible
|
|
const errorOverlay = comfyPage.page.locator('[data-testid="error-overlay"]')
|
|
await expect(errorOverlay).toBeVisible()
|
|
})
|
|
})
|
|
|
|
test.describe('Missing models in Error Tab', () => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting('Comfy.UseNewMenu', 'Top')
|
|
await comfyPage.settings.setSetting(
|
|
'Comfy.RightSidePanel.ShowErrorsTab',
|
|
true
|
|
)
|
|
const cleanupOk = await comfyPage.page.evaluate(async (url: string) => {
|
|
const response = await fetch(`${url}/api/devtools/cleanup_fake_model`)
|
|
return response.ok
|
|
}, comfyPage.url)
|
|
expect(cleanupOk).toBeTruthy()
|
|
})
|
|
|
|
test('Should show error overlay with missing models when workflow has missing models', async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.workflow.loadWorkflow('missing/missing_models')
|
|
|
|
const errorOverlay = comfyPage.page.locator('[data-testid="error-overlay"]')
|
|
await expect(errorOverlay).toBeVisible()
|
|
|
|
const missingModelsTitle = comfyPage.page.getByText(/Missing Models/)
|
|
await expect(missingModelsTitle).toBeVisible()
|
|
})
|
|
|
|
test('Should show missing models from node properties', async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.workflow.loadWorkflow(
|
|
'missing/missing_models_from_node_properties'
|
|
)
|
|
|
|
const errorOverlay = comfyPage.page.locator('[data-testid="error-overlay"]')
|
|
await expect(errorOverlay).toBeVisible()
|
|
|
|
const missingModelsTitle = comfyPage.page.getByText(/Missing Models/)
|
|
await expect(missingModelsTitle).toBeVisible()
|
|
})
|
|
|
|
test('Should not show missing models when widget values have changed', async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.workflow.loadWorkflow(
|
|
'missing/model_metadata_widget_mismatch'
|
|
)
|
|
|
|
const missingModelsTitle = comfyPage.page.getByText(/Missing Models/)
|
|
await expect(missingModelsTitle).not.toBeVisible()
|
|
|
|
const errorOverlay = comfyPage.page.locator('[data-testid="error-overlay"]')
|
|
await expect(errorOverlay).not.toBeVisible()
|
|
})
|
|
|
|
// Flaky test after parallelization
|
|
// https://github.com/Comfy-Org/ComfyUI_frontend/pull/1400
|
|
test.skip('Should download missing model when clicking download button', async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.workflow.loadWorkflow('missing/missing_models')
|
|
|
|
const errorOverlay = comfyPage.page.locator('[data-testid="error-overlay"]')
|
|
await expect(errorOverlay).toBeVisible()
|
|
|
|
const downloadAllButton = comfyPage.page.getByText('Download all')
|
|
await expect(downloadAllButton).toBeVisible()
|
|
const downloadPromise = comfyPage.page.waitForEvent('download')
|
|
await downloadAllButton.click()
|
|
|
|
const download = await downloadPromise
|
|
expect(download.suggestedFilename()).toBe('fake_model.safetensors')
|
|
})
|
|
})
|
|
|
|
test.describe('Settings', () => {
|
|
test('@mobile Should be visible on mobile', async ({ comfyPage }) => {
|
|
await comfyPage.page.keyboard.press('Control+,')
|
|
const settingsDialog = comfyPage.page.locator(
|
|
'[data-testid="settings-dialog"]'
|
|
)
|
|
await expect(settingsDialog).toBeVisible()
|
|
const contentArea = settingsDialog.locator('main')
|
|
await expect(contentArea).toBeVisible()
|
|
const isUsableHeight = await contentArea.evaluate(
|
|
(el) => el.clientHeight > 30
|
|
)
|
|
expect(isUsableHeight).toBeTruthy()
|
|
})
|
|
|
|
test('Can open settings with hotkey', async ({ comfyPage }) => {
|
|
await comfyPage.page.keyboard.down('ControlOrMeta')
|
|
await comfyPage.page.keyboard.press(',')
|
|
await comfyPage.page.keyboard.up('ControlOrMeta')
|
|
const settingsLocator = comfyPage.page.locator(
|
|
'[data-testid="settings-dialog"]'
|
|
)
|
|
await expect(settingsLocator).toBeVisible()
|
|
await comfyPage.page.keyboard.press('Escape')
|
|
await expect(settingsLocator).not.toBeVisible()
|
|
})
|
|
|
|
test('Can change canvas zoom speed setting', async ({ comfyPage }) => {
|
|
const maxSpeed = 2.5
|
|
await comfyPage.settings.setSetting('Comfy.Graph.ZoomSpeed', maxSpeed)
|
|
await test.step('Setting should persist', async () => {
|
|
expect(await comfyPage.settings.getSetting('Comfy.Graph.ZoomSpeed')).toBe(
|
|
maxSpeed
|
|
)
|
|
})
|
|
})
|
|
|
|
test('Should persist keybinding setting', async ({ comfyPage }) => {
|
|
// Open the settings dialog
|
|
await comfyPage.page.keyboard.press('Control+,')
|
|
await comfyPage.page.waitForSelector('[data-testid="settings-dialog"]')
|
|
|
|
// Open the keybinding tab
|
|
const settingsDialog = comfyPage.page.locator(
|
|
'[data-testid="settings-dialog"]'
|
|
)
|
|
await settingsDialog
|
|
.locator('nav [role="button"]', { hasText: 'Keybinding' })
|
|
.click()
|
|
await comfyPage.page.waitForSelector(
|
|
'[placeholder="Search Keybindings..."]'
|
|
)
|
|
|
|
// Focus the 'New Blank Workflow' row
|
|
const newBlankWorkflowRow = comfyPage.page.locator('tr', {
|
|
has: comfyPage.page.getByRole('cell', { name: 'New Blank Workflow' })
|
|
})
|
|
await newBlankWorkflowRow.click()
|
|
|
|
// Click add keybinding button (New Blank Workflow has no default keybinding)
|
|
const addKeybindingButton = newBlankWorkflowRow.locator(
|
|
'.icon-\\[lucide--plus\\]'
|
|
)
|
|
await addKeybindingButton.click()
|
|
|
|
// Set new keybinding
|
|
const input = comfyPage.page.getByPlaceholder('Enter your keybind')
|
|
await input.press('Alt+n')
|
|
|
|
const requestPromise = comfyPage.page.waitForRequest(
|
|
(req) =>
|
|
req.url().includes('/api/settings') &&
|
|
!req.url().includes('/api/settings/') &&
|
|
req.method() === 'POST'
|
|
)
|
|
|
|
// Save keybinding
|
|
const saveButton = comfyPage.page
|
|
.getByLabel('Modify keybinding')
|
|
.getByText('Save')
|
|
await saveButton.click()
|
|
|
|
const request = await requestPromise
|
|
const expectedSetting: Keybinding = {
|
|
commandId: 'Comfy.NewBlankWorkflow',
|
|
combo: {
|
|
key: 'n',
|
|
ctrl: false,
|
|
alt: true,
|
|
shift: false
|
|
}
|
|
}
|
|
expect(request.postData()).toContain(JSON.stringify(expectedSetting))
|
|
})
|
|
})
|
|
|
|
test.describe('Support', () => {
|
|
test('Should open external zendesk link with OSS tag', async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.settings.setSetting('Comfy.UseNewMenu', 'Top')
|
|
|
|
// Prevent loading the external page
|
|
await comfyPage.page
|
|
.context()
|
|
.route('https://support.comfy.org/**', (route) =>
|
|
route.fulfill({ body: '<html></html>', contentType: 'text/html' })
|
|
)
|
|
|
|
const popupPromise = comfyPage.page.waitForEvent('popup')
|
|
await comfyPage.menu.topbar.triggerTopbarCommand(['Help', 'Support'])
|
|
const popup = await popupPromise
|
|
|
|
const url = new URL(popup.url())
|
|
expect(url.hostname).toBe('support.comfy.org')
|
|
expect(url.searchParams.get('tf_42243568391700')).toBe('oss')
|
|
|
|
await popup.close()
|
|
})
|
|
})
|
|
|
|
test.describe('Error dialog', () => {
|
|
test('Should display an error dialog when graph configure fails', async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.page.evaluate(() => {
|
|
const graph = window.graph!
|
|
;(graph as { configure: () => void }).configure = () => {
|
|
throw new Error('Error on configure!')
|
|
}
|
|
})
|
|
|
|
await comfyPage.workflow.loadWorkflow('default')
|
|
|
|
const errorDialog = comfyPage.page.locator('.comfy-error-report')
|
|
await expect(errorDialog).toBeVisible()
|
|
})
|
|
|
|
test('Should display an error dialog when prompt execution fails', async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.page.evaluate(async () => {
|
|
const app = window.app!
|
|
app.api.queuePrompt = () => {
|
|
throw new Error('Error on queuePrompt!')
|
|
}
|
|
await app.queuePrompt(0)
|
|
})
|
|
const errorDialog = comfyPage.page.locator('.comfy-error-report')
|
|
await expect(errorDialog).toBeVisible()
|
|
})
|
|
})
|
|
|
|
test.describe('Signin dialog', () => {
|
|
test('Paste content to signin dialog should not paste node on canvas', async ({
|
|
comfyPage
|
|
}) => {
|
|
const nodeNum = await comfyPage.nodeOps.getNodeCount()
|
|
await comfyPage.canvas.click({
|
|
position: DefaultGraphPositions.emptyLatentWidgetClick
|
|
})
|
|
await comfyPage.page.mouse.move(10, 10)
|
|
await comfyPage.nextFrame()
|
|
await comfyPage.clipboard.copy()
|
|
|
|
const textBox = comfyPage.widgetTextBox
|
|
await textBox.click()
|
|
await textBox.fill('test_password')
|
|
await textBox.press('Control+a')
|
|
await textBox.press('Control+c')
|
|
|
|
await comfyPage.page.evaluate(() => {
|
|
void window.app!.extensionManager.dialog.showSignInDialog()
|
|
})
|
|
|
|
const input = comfyPage.page.locator('#comfy-org-sign-in-password')
|
|
await input.waitFor({ state: 'visible' })
|
|
await input.press('Control+v')
|
|
await expect(input).toHaveValue('test_password')
|
|
|
|
expect(await comfyPage.nodeOps.getNodeCount()).toBe(nodeNum)
|
|
})
|
|
})
|