Skip to content

Commit 4af44c2

Browse files
authored
Merge branch 'main' into ux-improvement
2 parents 49796aa + 0e01bb3 commit 4af44c2

28 files changed

+279
-89
lines changed

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,15 @@ core extensions will be loaded.
231231

232232
### LiteGraph
233233

234-
This repo is using litegraph package hosted on https://github.com/Comfy-Org/litegraph.js. Any changes to litegraph should be submitted in that repo instead.
234+
This repo is using litegraph package hosted on <https://github.com/Comfy-Org/litegraph.js>. Any changes to litegraph should be submitted in that repo instead.
235+
236+
### Test litegraph changes
237+
238+
- Run `npm link` in the local litegraph repo.
239+
- Run `npm uninstall @comfyorg/litegraph` in this repo.
240+
- Run `npm link @comfyorg/litegraph` in this repo.
241+
242+
This will replace the litegraph package in this repo with the local litegraph repo.
235243

236244
## Deploy
237245

browser_tests/ComfyPage.ts

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import type { Page, Locator } from '@playwright/test'
22
import { test as base } from '@playwright/test'
33
import dotenv from 'dotenv'
44
dotenv.config()
5+
import * as fs from 'fs'
6+
import * as path from 'path'
57

68
interface Position {
79
x: number
@@ -202,6 +204,10 @@ export class ComfyPage {
202204
await this.resetView()
203205
}
204206

207+
public assetPath(fileName: string) {
208+
return `./browser_tests/assets/${fileName}`
209+
}
210+
205211
async setSetting(settingId: string, settingValue: any) {
206212
return await this.page.evaluate(
207213
async ({ id, value }) => {
@@ -238,7 +244,7 @@ export class ComfyPage {
238244

239245
async loadWorkflow(workflowName: string) {
240246
await this.workflowUploadInput.setInputFiles(
241-
`./browser_tests/assets/${workflowName}.json`
247+
this.assetPath(`${workflowName}.json`)
242248
)
243249
await this.nextFrame()
244250
}
@@ -300,6 +306,54 @@ export class ComfyPage {
300306
await this.nextFrame()
301307
}
302308

309+
async dragAndDropFile(fileName: string) {
310+
const filePath = this.assetPath(fileName)
311+
312+
// Read the file content
313+
const buffer = fs.readFileSync(filePath)
314+
315+
// Get file type
316+
const getFileType = (fileName: string) => {
317+
if (fileName.endsWith('.png')) return 'image/png'
318+
if (fileName.endsWith('.webp')) return 'image/webp'
319+
if (fileName.endsWith('.json')) return 'application/json'
320+
return 'application/octet-stream'
321+
}
322+
323+
const fileType = getFileType(fileName)
324+
325+
await this.page.evaluate(
326+
async ({ buffer, fileName, fileType }) => {
327+
const file = new File([new Uint8Array(buffer)], fileName, {
328+
type: fileType
329+
})
330+
const dataTransfer = new DataTransfer()
331+
dataTransfer.items.add(file)
332+
333+
const dropEvent = new DragEvent('drop', {
334+
bubbles: true,
335+
cancelable: true,
336+
dataTransfer
337+
})
338+
339+
Object.defineProperty(dropEvent, 'preventDefault', {
340+
value: () => {},
341+
writable: false
342+
})
343+
344+
Object.defineProperty(dropEvent, 'stopPropagation', {
345+
value: () => {},
346+
writable: false
347+
})
348+
349+
document.dispatchEvent(dropEvent)
350+
},
351+
{ buffer: [...new Uint8Array(buffer)], fileName, fileType }
352+
)
353+
354+
await this.nextFrame()
355+
}
356+
303357
async dragNode2() {
304358
await this.dragAndDrop({ x: 622, y: 400 }, { x: 622, y: 300 })
305359
await this.nextFrame()
200 KB
Binary file not shown.

browser_tests/assets/no_workflow.webp

195 KB
Binary file not shown.

browser_tests/assets/workflow.webp

200 KB
Binary file not shown.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { expect } from '@playwright/test'
2+
import { comfyPageFixture as test } from './ComfyPage'
3+
4+
test.describe('Load Workflow in Media', () => {
5+
;['workflow.webp', 'edited_workflow.webp', 'no_workflow.webp'].forEach(
6+
async (fileName) => {
7+
test(`Load workflow in ${fileName}`, async ({ comfyPage }) => {
8+
await comfyPage.dragAndDropFile(fileName)
9+
await expect(comfyPage.canvas).toHaveScreenshot(`${fileName}.png`)
10+
})
11+
}
12+
)
13+
})
Loading
Loading
Loading

browser_tests/menu.spec.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,9 @@ test.describe('Menu', () => {
171171
const tab = comfyPage.menu.nodeLibraryTab
172172

173173
await tab.getFolder('foo').click({ button: 'right' })
174-
await comfyPage.page.getByLabel('Rename').click()
174+
await comfyPage.page
175+
.locator('.p-contextmenu-item-label:has-text("Rename")')
176+
.click()
175177
await comfyPage.page.keyboard.insertText('bar')
176178
await comfyPage.page.keyboard.press('Enter')
177179

@@ -291,7 +293,9 @@ test.describe('Menu', () => {
291293
})
292294
const tab = comfyPage.menu.nodeLibraryTab
293295
await tab.getFolder('foo').click({ button: 'right' })
294-
await comfyPage.page.getByLabel('Rename').click()
296+
await comfyPage.page
297+
.locator('.p-contextmenu-item-label:has-text("Rename")')
298+
.click()
295299
await comfyPage.page.keyboard.insertText('bar')
296300
await comfyPage.page.keyboard.press('Enter')
297301
await comfyPage.nextFrame()

browser_tests/nodeSearchBox.spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,16 @@ test.describe('Node search box', () => {
7676
'added-node-no-connection.png'
7777
)
7878
})
79+
80+
test('Has correct aria-labels on search results', async ({ comfyPage }) => {
81+
const node = 'Load Checkpoint'
82+
await comfyPage.doubleClickCanvas()
83+
await comfyPage.searchBox.fillAndSelectFirstNode(node)
84+
const firstResult = comfyPage.page
85+
.locator('li.p-autocomplete-option')
86+
.first()
87+
await expect(firstResult).toHaveAttribute('aria-label', node)
88+
})
7989
})
8090

8191
test.describe('Release context menu', () => {

package-lock.json

Lines changed: 38 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "comfyui-frontend",
33
"private": true,
4-
"version": "1.2.47",
4+
"version": "1.2.48",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
@@ -62,8 +62,8 @@
6262
},
6363
"dependencies": {
6464
"@atlaskit/pragmatic-drag-and-drop": "^1.2.1",
65-
"@comfyorg/litegraph": "^0.7.64",
66-
"@primevue/themes": "^4.0.0-rc.2",
65+
"@comfyorg/litegraph": "^0.7.65",
66+
"@primevue/themes": "^4.0.5",
6767
"@vitejs/plugin-vue": "^5.0.5",
6868
"@vueuse/core": "^11.0.0",
6969
"axios": "^1.7.4",
@@ -73,7 +73,7 @@
7373
"lodash": "^4.17.21",
7474
"pinia": "^2.1.7",
7575
"primeicons": "^7.0.0",
76-
"primevue": "^4.0.0",
76+
"primevue": "^4.0.5",
7777
"reflect-metadata": "^0.2.2",
7878
"vue": "^3.4.31",
7979
"vue-i18n": "^9.13.1",

src/assets/css/style.css

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
@tailwind base;
2-
@tailwind components;
3-
@tailwind utilities;
1+
@layer primevue, tailwind-utilities;
2+
3+
@layer tailwind-utilities {
4+
@tailwind components;
5+
@tailwind utilities;
6+
}
47

58
:root {
69
--fg-color: #000;

src/components/dialog/content/SettingDialogContent.vue

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,6 @@ const tabValue = computed(() =>
144144
</script>
145145

146146
<style>
147-
/* Remove after we have tailwind setup */
148-
.border-none {
149-
border: none !important;
150-
}
151-
152147
.settings-tab-panels {
153148
padding-top: 0px !important;
154149
}

src/components/searchbox/NodeSearchBox.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
auto-option-focus
4141
force-selection
4242
multiple
43+
:optionLabel="'display_name'"
4344
>
4445
<template v-slot:option="{ option }">
4546
<div class="option-container">

src/components/searchbox/NodeSearchBoxPopover.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
:dismissable-mask="dismissable"
77
@hide="clearFilters"
88
:pt="{
9-
root: { class: 'invisible-dialog-root' },
9+
root: {
10+
class: 'invisible-dialog-root',
11+
role: 'search'
12+
},
1013
mask: { class: 'node-search-box-dialog-mask' },
1114
transition: {
1215
enterFromClass: 'opacity-0 scale-75',

0 commit comments

Comments
 (0)