mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-30 19:21:54 +00:00
Fix group node manage opening to wrong node type (#1754)
Remove dialog from DOM when closed Add test
This commit is contained in:
@@ -103,6 +103,36 @@ test.describe('Group Node', () => {
|
|||||||
await expect(comfyPage.page.locator('.node-tooltip')).toBeVisible()
|
await expect(comfyPage.page.locator('.node-tooltip')).toBeVisible()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('Manage group opens with the correct group selected', async ({
|
||||||
|
comfyPage
|
||||||
|
}) => {
|
||||||
|
const makeGroup = async (name, type1, type2) => {
|
||||||
|
const node1 = (await comfyPage.getNodeRefsByType(type1))[0]
|
||||||
|
const node2 = (await comfyPage.getNodeRefsByType(type2))[0]
|
||||||
|
await node1.click('title')
|
||||||
|
await node2.click('title', {
|
||||||
|
modifiers: ['Shift']
|
||||||
|
})
|
||||||
|
return await node2.convertToGroupNode(name)
|
||||||
|
}
|
||||||
|
|
||||||
|
const group1 = await makeGroup(
|
||||||
|
'g1',
|
||||||
|
'CLIPTextEncode',
|
||||||
|
'CheckpointLoaderSimple'
|
||||||
|
)
|
||||||
|
const group2 = await makeGroup('g2', 'EmptyLatentImage', 'KSampler')
|
||||||
|
|
||||||
|
const manage1 = await group1.manageGroupNode()
|
||||||
|
await comfyPage.nextFrame()
|
||||||
|
expect(await manage1.getSelectedNodeType()).toBe('g1')
|
||||||
|
await manage1.close()
|
||||||
|
await expect(manage1.root).not.toBeVisible()
|
||||||
|
|
||||||
|
const manage2 = await group2.manageGroupNode()
|
||||||
|
expect(await manage2.getSelectedNodeType()).toBe('g2')
|
||||||
|
})
|
||||||
|
|
||||||
test('Reconnects inputs after configuration changed via manage dialog save', async ({
|
test('Reconnects inputs after configuration changed via manage dialog save', async ({
|
||||||
comfyPage
|
comfyPage
|
||||||
}) => {
|
}) => {
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
import { Locator, Page } from '@playwright/test'
|
import { Locator, Page } from '@playwright/test'
|
||||||
export class ManageGroupNode {
|
export class ManageGroupNode {
|
||||||
footer: Locator
|
footer: Locator
|
||||||
|
header: Locator
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
readonly page: Page,
|
readonly page: Page,
|
||||||
readonly root: Locator
|
readonly root: Locator
|
||||||
) {
|
) {
|
||||||
this.footer = root.locator('footer')
|
this.footer = root.locator('footer')
|
||||||
|
this.header = root.locator('header')
|
||||||
}
|
}
|
||||||
|
|
||||||
async setLabel(name: string, label: string) {
|
async setLabel(name: string, label: string) {
|
||||||
@@ -23,6 +25,11 @@ export class ManageGroupNode {
|
|||||||
await this.footer.getByText('Close').click()
|
await this.footer.getByText('Close').click()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getSelectedNodeType() {
|
||||||
|
const select = this.header.locator('select').first()
|
||||||
|
return await select.inputValue()
|
||||||
|
}
|
||||||
|
|
||||||
async selectNode(name: string) {
|
async selectNode(name: string) {
|
||||||
const list = this.root.locator('.comfy-group-manage-list-items')
|
const list = this.root.locator('.comfy-group-manage-list-items')
|
||||||
const item = list.getByText(name)
|
const item = list.getByText(name)
|
||||||
|
|||||||
@@ -1001,7 +1001,7 @@ export class GroupNodeHandler {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
content: 'Manage Group Node',
|
content: 'Manage Group Node',
|
||||||
callback: manageGroupNodes
|
callback: () => manageGroupNodes(this.type)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1488,8 +1488,8 @@ function ungroupSelectedGroupNodes() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function manageGroupNodes() {
|
function manageGroupNodes(type?: string) {
|
||||||
new ManageGroupDialog(app).show()
|
new ManageGroupDialog(app).show(type)
|
||||||
}
|
}
|
||||||
|
|
||||||
const id = 'Comfy.GroupNode'
|
const id = 'Comfy.GroupNode'
|
||||||
|
|||||||
@@ -519,6 +519,7 @@ export class ManageGroupDialog extends ComfyDialog<HTMLDialogElement> {
|
|||||||
|
|
||||||
this.element.addEventListener('close', () => {
|
this.element.addEventListener('close', () => {
|
||||||
this.draggable?.dispose()
|
this.draggable?.dispose()
|
||||||
|
this.element.remove()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user