mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-27 08:25:50 +00:00
*PR Created by the Glary-Bot Agent* --- ## Summary Adds `browser_tests/tests/selectionPasteRename.spec.ts` covering the untested `pasteSelection()` and `renameSelection()` paths in `useSelectionOperations.ts`. ### Coverage gaps filled - `pasteSelection()` — copy → paste creates new nodes - `renameSelection()` single node path — opens title editor - `renameSelection()` batch path — prompt dialog with sequential naming - Empty selection → toast warning ### References - Follows patterns from `selectionToolboxMoreActions.spec.ts` (More Options menu, `selectNodeWithPan`) - Follows `browser_tests/AGENTS.md` directory structure - Follows `browser_tests/FLAKE_PREVENTION_RULES.md` assertion patterns ### Verification - TypeScript: clean - ESLint: clean - oxlint: clean - oxfmt: formatted ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-11367-test-add-selection-paste-rename-and-batch-rename-browser-tests-3466d73d3650812194a4d8bfbed3dee7) by [Unito](https://www.unito.io) --------- Co-authored-by: Glary-Bot <glary-bot@users.noreply.github.com> Co-authored-by: Amp <amp@ampcode.com>
97 lines
3.2 KiB
TypeScript
97 lines
3.2 KiB
TypeScript
import {
|
|
comfyExpect as expect,
|
|
comfyPageFixture as test
|
|
} from '@e2e/fixtures/ComfyPage'
|
|
import { getGroupTitlePosition } from '@e2e/fixtures/utils/groupHelpers'
|
|
import { openMoreOptions } from '@e2e/fixtures/utils/selectionToolbox'
|
|
|
|
test.describe('Selection toolbox rename', { tag: '@ui' }, () => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting('Comfy.Canvas.SelectionToolbox', true)
|
|
await comfyPage.workflow.loadWorkflow('default')
|
|
await comfyPage.nextFrame()
|
|
})
|
|
|
|
test.describe('Single rename', () => {
|
|
test('Rename via More Options opens title editor for single node', async ({
|
|
comfyPage
|
|
}) => {
|
|
const nodeRef = (
|
|
await comfyPage.nodeOps.getNodeRefsByTitle('KSampler')
|
|
)[0]
|
|
await comfyPage.nodeOps.selectNodeWithPan(nodeRef)
|
|
|
|
const menu = await openMoreOptions(comfyPage)
|
|
await menu.getByText('Rename', { exact: true }).click()
|
|
|
|
await expect(comfyPage.page.getByTestId('node-title-input')).toHaveValue(
|
|
'KSampler'
|
|
)
|
|
})
|
|
|
|
test('Rename shows prompt dialog for group', async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting(
|
|
'LiteGraph.Group.SelectChildrenOnClick',
|
|
false
|
|
)
|
|
await comfyPage.workflow.loadWorkflow('groups/nested-groups-1-inner-node')
|
|
await comfyPage.nextFrame()
|
|
|
|
const outerGroupPos = await getGroupTitlePosition(
|
|
comfyPage,
|
|
'Outer Group'
|
|
)
|
|
await comfyPage.canvas.click({ position: outerGroupPos })
|
|
|
|
const menu = await openMoreOptions(comfyPage)
|
|
await menu.getByText('Rename', { exact: true }).click()
|
|
|
|
await expect(comfyPage.nodeOps.promptDialogInput).toBeVisible()
|
|
await comfyPage.nodeOps.promptDialogInput.fill('Renamed Group')
|
|
await comfyPage.page.keyboard.press('Enter')
|
|
await expect(comfyPage.nodeOps.promptDialogInput).toBeHidden()
|
|
|
|
await expect
|
|
.poll(() =>
|
|
comfyPage.page.evaluate(() => {
|
|
return window.app!.graph.groups.some(
|
|
(g) => g.title === 'Renamed Group'
|
|
)
|
|
})
|
|
)
|
|
.toBe(true)
|
|
})
|
|
})
|
|
|
|
test.describe('Batch rename', () => {
|
|
test('Batch rename multiple selected nodes', async ({ comfyPage }) => {
|
|
const ksampler = (
|
|
await comfyPage.nodeOps.getNodeRefsByTitle('KSampler')
|
|
)[0]
|
|
const emptyLatent = (
|
|
await comfyPage.nodeOps.getNodeRefsByTitle('Empty Latent Image')
|
|
)[0]
|
|
|
|
await comfyPage.nodeOps.selectNodes(['KSampler', 'Empty Latent Image'])
|
|
|
|
const menu = await openMoreOptions(comfyPage)
|
|
await menu.getByText('Rename', { exact: true }).click()
|
|
|
|
await expect(comfyPage.nodeOps.promptDialogInput).toBeVisible()
|
|
await comfyPage.nodeOps.promptDialogInput.fill('TestNode')
|
|
await comfyPage.page.keyboard.press('Enter')
|
|
await expect(comfyPage.nodeOps.promptDialogInput).toBeHidden()
|
|
|
|
await expect
|
|
.poll(async () => {
|
|
const titles = await Promise.all([
|
|
ksampler.getProperty<string>('title'),
|
|
emptyLatent.getProperty<string>('title')
|
|
])
|
|
return [...titles].sort()
|
|
})
|
|
.toEqual(['TestNode 1', 'TestNode 2'])
|
|
})
|
|
})
|
|
})
|