mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-06-05 12:44:23 +00:00
Default search box settings are a little inconvenient to work with. This PR introduces a new `addNode` utility function to the V2 search fixture that handles all the steps of opening search and adding a node that a user would perform. It then migrates several PRs I have recently written to use this new fixture. See also #12029 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-12382-Use-utility-function-to-add-node-with-V2-search-3666d73d3650817c8c73c9104b1113bf) by [Unito](https://www.unito.io)
78 lines
2.3 KiB
TypeScript
78 lines
2.3 KiB
TypeScript
import { expect } from '@playwright/test'
|
|
|
|
import { comfyPageFixture as test } from '@e2e/fixtures/ComfyPage'
|
|
|
|
test.describe('Subgraph Operations', { tag: ['@slow', '@subgraph'] }, () => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting('Comfy.UseNewMenu', 'Disabled')
|
|
})
|
|
|
|
test.describe('Subgraph Clipboard Operations', () => {
|
|
test('Can copy and paste nodes inside a subgraph', async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.workflow.loadWorkflow('subgraphs/basic-subgraph')
|
|
|
|
const subgraphNode = await comfyPage.nodeOps.getNodeRefById('2')
|
|
await subgraphNode.navigateIntoSubgraph()
|
|
|
|
const initialNodeCount = await comfyPage.subgraph.getNodeCount()
|
|
|
|
await expect
|
|
.poll(() =>
|
|
comfyPage.page.evaluate(() => {
|
|
const nodes = window.app!.canvas.graph!.nodes
|
|
return nodes?.[0]?.id ?? null
|
|
})
|
|
)
|
|
.not.toBeNull()
|
|
|
|
const nodeId = await comfyPage.page.evaluate(() => {
|
|
const nodes = window.app!.canvas.graph!.nodes
|
|
return nodes?.[0]?.id ?? null
|
|
})
|
|
|
|
const nodeToClone = await comfyPage.nodeOps.getNodeRefById(String(nodeId))
|
|
await nodeToClone.click('title')
|
|
|
|
await comfyPage.keyboard.press('ControlOrMeta+c')
|
|
|
|
await comfyPage.keyboard.press('ControlOrMeta+v')
|
|
|
|
await expect
|
|
.poll(() => comfyPage.subgraph.getNodeCount())
|
|
.toBe(initialNodeCount + 1)
|
|
})
|
|
})
|
|
|
|
test.describe('Subgraph History Operations', () => {
|
|
test('Can undo and redo operations inside a subgraph', async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.workflow.loadWorkflow('subgraphs/basic-subgraph')
|
|
|
|
const subgraphNode = await comfyPage.nodeOps.getNodeRefById('2')
|
|
await subgraphNode.navigateIntoSubgraph()
|
|
|
|
await comfyPage.searchBoxV2.addNode('Note')
|
|
await comfyPage.nextFrame()
|
|
|
|
const initialCount = await comfyPage.subgraph.getNodeCount()
|
|
|
|
await comfyPage.keyboard.undo()
|
|
await comfyPage.nextFrame()
|
|
|
|
await expect
|
|
.poll(() => comfyPage.subgraph.getNodeCount())
|
|
.toBe(initialCount - 1)
|
|
|
|
await comfyPage.keyboard.redo()
|
|
await comfyPage.nextFrame()
|
|
|
|
await expect
|
|
.poll(() => comfyPage.subgraph.getNodeCount())
|
|
.toBe(initialCount)
|
|
})
|
|
})
|
|
})
|