mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-07-15 19:54:32 +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)
117 lines
3.9 KiB
TypeScript
117 lines
3.9 KiB
TypeScript
import {
|
|
comfyPageFixture as test,
|
|
comfyExpect as expect
|
|
} from '@e2e/fixtures/ComfyPage'
|
|
|
|
test.describe('App mode builder selection', () => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.appMode.enableLinearMode()
|
|
})
|
|
|
|
test('Can independently select inputs of same name', async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', true)
|
|
const items = comfyPage.appMode.select.inputItems
|
|
|
|
await comfyPage.vueNodes.selectNodes(['6', '7'])
|
|
await comfyPage.command.executeCommand('Comfy.Graph.ConvertToSubgraph')
|
|
|
|
await comfyPage.appMode.enterBuilder()
|
|
await comfyPage.appMode.steps.goToInputs()
|
|
await expect(items).toHaveCount(0)
|
|
|
|
const prompts = comfyPage.vueNodes
|
|
.getNodeByTitle('New Subgraph')
|
|
.locator('.lg-node-widget')
|
|
const count = await prompts.count()
|
|
for (let i = 0; i < count; i++) {
|
|
await expect(prompts.nth(i)).toBeVisible()
|
|
await prompts.nth(i).click()
|
|
await expect(items).toHaveCount(i + 1)
|
|
}
|
|
})
|
|
|
|
test('Can select outputs', async ({ comfyPage }) => {
|
|
await comfyPage.appMode.enterBuilder()
|
|
await comfyPage.appMode.steps.goToOutputs()
|
|
|
|
await comfyPage.nodeOps
|
|
.getNodeRefById('9')
|
|
.then((ref) => ref.centerOnNode())
|
|
const saveImage = await comfyPage.vueNodes.getNodeLocator('9')
|
|
await saveImage.click()
|
|
|
|
const items = comfyPage.appMode.select.inputItems
|
|
await expect(items).toHaveCount(1)
|
|
})
|
|
|
|
test('Can not select nodes with errors or notes', async ({ comfyPage }) => {
|
|
//Manually set error state on checkpoint loader
|
|
//Shouldn't be needed on ci, but has spotty reliability
|
|
await comfyPage.page.evaluate(() => (graph!.nodes[6].has_errors = true))
|
|
await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', true)
|
|
|
|
const items = comfyPage.appMode.select.inputItems
|
|
await comfyPage.appMode.enterBuilder()
|
|
await comfyPage.appMode.steps.goToInputs()
|
|
await expect(items).toHaveCount(0)
|
|
|
|
await comfyPage.appMode.select.selectInputWidget(
|
|
'Load Checkpoint',
|
|
'ckpt_name'
|
|
)
|
|
await expect(items).toHaveCount(0)
|
|
|
|
await comfyPage.workflow.loadWorkflow('nodes/note_nodes')
|
|
await comfyPage.appMode.enterBuilder()
|
|
await comfyPage.appMode.steps.goToInputs()
|
|
await expect(items).toHaveCount(0)
|
|
|
|
await comfyPage.appMode.select.selectInputWidget('Note', 'text')
|
|
await comfyPage.appMode.select.selectInputWidget('Markdown Note', 'text')
|
|
|
|
await expect(items).toHaveCount(0)
|
|
})
|
|
|
|
test('Marks canvas readOnly', async ({ comfyPage }) => {
|
|
await comfyPage.searchBoxV2.openByDoubleClickCanvas()
|
|
await expect(
|
|
comfyPage.searchBoxV2.input,
|
|
'Canvas is initially editable'
|
|
).toBeVisible()
|
|
await comfyPage.page.keyboard.press('Escape')
|
|
|
|
await comfyPage.appMode.enterBuilder()
|
|
await comfyPage.appMode.steps.goToInputs()
|
|
|
|
await comfyPage.searchBoxV2.openByDoubleClickCanvas()
|
|
await expect(
|
|
comfyPage.searchBoxV2.input,
|
|
'Entering builder makes the canvas readonly'
|
|
).toBeHidden()
|
|
|
|
await comfyPage.page.keyboard.press('Space')
|
|
await comfyPage.searchBoxV2.openByDoubleClickCanvas()
|
|
await expect(
|
|
comfyPage.searchBoxV2.input,
|
|
'Canvas remains readonly after pressing space'
|
|
).toBeHidden()
|
|
|
|
const ksampler = await comfyPage.vueNodes.getFixtureByTitle('KSampler')
|
|
// oxlint-disable-next-line playwright/no-force-option -- Node container has conditional pointer-events:none that blocks actionability
|
|
await ksampler.header.dblclick({ force: true })
|
|
await expect(
|
|
ksampler.titleEditor.input,
|
|
'Double clicking node titles will not initiate a rename'
|
|
).toBeHidden()
|
|
|
|
await comfyPage.page.keyboard.press('Escape')
|
|
await comfyPage.searchBoxV2.openByDoubleClickCanvas()
|
|
await expect(
|
|
comfyPage.searchBoxV2.input,
|
|
'Canvas is no longer readonly after exiting'
|
|
).toBeVisible()
|
|
})
|
|
})
|