From 35a7c81fd8185b474b0f16197c7e6d80ca82fa0f Mon Sep 17 00:00:00 2001 From: "Alex \"mcmonkey\" Goodwin" <4000772+mcmonkey4eva@users.noreply.github.com> Date: Tue, 24 Sep 2024 16:51:30 +0900 Subject: [PATCH] initial download-folder-selector interface (#890) * initial download-folder-selector interface * use primevue select * add a folder select visibility checkbox * slightly reduce indirection * fix up select box updating * revert bad upstream changes * cleanup * allow localhost sourced models in ui side (for testing purposes only basically, but does no harm in deployed envs) * add screenshot expectations to test * Update test expectations [skip ci] * add testing of folder select * fix test * don't exclude folder selector when there's only 1 since the checkbox covers that better anyway * oo - fix checkbox * Update test expectations [skip ci] * testing - don't expect screenshots :( * experimental new test code * toHaveClass is silly * add // comments documenting intent of allowedSources --------- Co-authored-by: github-actions --- browser_tests/dialog.spec.ts | 38 +++-- .../dialog/content/MissingModelsWarning.vue | 133 +++++++++++++----- src/scripts/api.ts | 10 +- src/scripts/app.ts | 6 +- src/services/dialogService.ts | 1 + src/stores/coreSettings.ts | 12 -- src/types/apiTypes.ts | 2 - 7 files changed, 139 insertions(+), 63 deletions(-) diff --git a/browser_tests/dialog.spec.ts b/browser_tests/dialog.spec.ts index 7c56a1859..e4e54a87a 100644 --- a/browser_tests/dialog.spec.ts +++ b/browser_tests/dialog.spec.ts @@ -45,38 +45,54 @@ test.describe('Execution error', () => { test.describe('Missing models warning', () => { test.beforeEach(async ({ comfyPage }) => { + await comfyPage.setSetting('Comfy.Workflow.ShowMissingModelsWarning', true) await comfyPage.page.evaluate((url: string) => { return fetch(`${url}/api/devtools/cleanup_fake_model`) }, comfyPage.url) - await comfyPage.setSetting('Comfy.Workflow.ModelDownload.AllowedSources', [ - 'http://localhost:8188' - ]) - await comfyPage.setSetting('Comfy.Workflow.ModelDownload.AllowedSuffixes', [ - '.safetensors' - ]) }) // Regressed by https://github.com/comfyanonymous/ComfyUI/pull/4981 test.skip('Should display a warning when missing models are found', async ({ comfyPage }) => { - await comfyPage.setSetting('Comfy.Workflow.ShowMissingModelsWarning', true) - // The fake_model.safetensors is served by // https://github.com/Comfy-Org/ComfyUI_devtools/blob/main/__init__.py await comfyPage.loadWorkflow('missing_models') - // Wait for the element with the .comfy-missing-models selector to be visible const missingModelsWarning = comfyPage.page.locator('.comfy-missing-models') await expect(missingModelsWarning).toBeVisible() - // Click the download button const downloadButton = comfyPage.page.getByLabel('Download') await expect(downloadButton).toBeVisible() await downloadButton.click() - // Wait for the element with the .download-complete selector to be visible const downloadComplete = comfyPage.page.locator('.download-complete') await expect(downloadComplete).toBeVisible() }) + + test('Can configure download folder', async ({ comfyPage }) => { + await comfyPage.loadWorkflow('missing_models') + + const missingModelsWarning = comfyPage.page.locator('.comfy-missing-models') + await expect(missingModelsWarning).toBeVisible() + + const folderSelectToggle = comfyPage.page.locator( + '.model-path-select-checkbox' + ) + const folderSelect = comfyPage.page.locator('.model-path-select') + await expect(folderSelectToggle).toBeVisible() + await expect(folderSelect).not.toBeVisible() + + await folderSelectToggle.click() // show the selectors + await expect(folderSelect).toBeVisible() + + await folderSelect.click() // open dropdown + await expect(folderSelect).toHaveClass(/p-select-open/) + + await folderSelect.click() // close the dropdown + await expect(folderSelect).not.toHaveClass(/p-select-open/) + + await folderSelectToggle.click() // hide the selectors + await expect(folderSelect).not.toBeVisible() + }) }) diff --git a/src/components/dialog/content/MissingModelsWarning.vue b/src/components/dialog/content/MissingModelsWarning.vue index 78541a860..cf9ac447f 100644 --- a/src/components/dialog/content/MissingModelsWarning.vue +++ b/src/components/dialog/content/MissingModelsWarning.vue @@ -4,6 +4,15 @@

When loading the graph, the following models were not found:

+

+ + Show folder selector +

+