mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-21 21:09:00 +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>
41 lines
1.3 KiB
TypeScript
41 lines
1.3 KiB
TypeScript
import { expect } from '@playwright/test'
|
|
|
|
import { comfyPageFixture as test } from '@e2e/fixtures/ComfyPage'
|
|
import { getGroupTitlePosition } from '@e2e/fixtures/utils/groupHelpers'
|
|
|
|
test.describe('Group Copy Paste', { tag: ['@canvas'] }, () => {
|
|
test.afterEach(async ({ comfyPage }) => {
|
|
await comfyPage.canvasOps.resetView()
|
|
})
|
|
|
|
test('Pasted group is offset from original position', async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.workflow.loadWorkflow('groups/single_group_only')
|
|
|
|
const titlePos = await getGroupTitlePosition(comfyPage, 'Group')
|
|
await comfyPage.canvas.click({ position: titlePos })
|
|
await comfyPage.nextFrame()
|
|
|
|
await comfyPage.clipboard.copy()
|
|
await comfyPage.clipboard.paste()
|
|
await comfyPage.nextFrame()
|
|
|
|
const getGroupPositions = () =>
|
|
comfyPage.page.evaluate(() =>
|
|
window.app!.graph.groups.map((g: { pos: number[] }) => ({
|
|
x: g.pos[0],
|
|
y: g.pos[1]
|
|
}))
|
|
)
|
|
|
|
await expect.poll(getGroupPositions).toHaveLength(2)
|
|
|
|
await expect(async () => {
|
|
const positions = await getGroupPositions()
|
|
expect(Math.abs(positions[0].x - positions[1].x)).toBeCloseTo(50, 0)
|
|
expect(Math.abs(positions[0].y - positions[1].y)).toBeCloseTo(15, 0)
|
|
}).toPass({ timeout: 5000 })
|
|
})
|
|
})
|