mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-24 14:45:36 +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>
35 lines
957 B
TypeScript
35 lines
957 B
TypeScript
import type { ComfyPage } from '@e2e/fixtures/ComfyPage'
|
|
|
|
const GROUP_TITLE_CLICK_OFFSET_X = 50
|
|
const GROUP_TITLE_CLICK_OFFSET_Y = 15
|
|
|
|
/**
|
|
* Returns the client-space position of a group's title bar (for clicking).
|
|
*/
|
|
export async function getGroupTitlePosition(
|
|
comfyPage: ComfyPage,
|
|
title: string
|
|
): Promise<{ x: number; y: number }> {
|
|
const pos = await comfyPage.page.evaluate(
|
|
({ title, offsetX, offsetY }) => {
|
|
const app = window.app!
|
|
const group = app.graph.groups.find(
|
|
(g: { title: string }) => g.title === title
|
|
)
|
|
if (!group) return null
|
|
const clientPos = app.canvasPosToClientPos([
|
|
group.pos[0] + offsetX,
|
|
group.pos[1] + offsetY
|
|
])
|
|
return { x: clientPos[0], y: clientPos[1] }
|
|
},
|
|
{
|
|
title,
|
|
offsetX: GROUP_TITLE_CLICK_OFFSET_X,
|
|
offsetY: GROUP_TITLE_CLICK_OFFSET_Y
|
|
}
|
|
)
|
|
if (!pos) throw new Error(`Group "${title}" not found`)
|
|
return pos
|
|
}
|