Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions browser_tests/fixtures/ComfyPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export class ComfyPage {
public readonly url: string
// All canvas position operations are based on default view of canvas.
public readonly canvas: Locator
public readonly selectionToolbox: Locator
public readonly widgetTextBox: Locator

// Buttons
Expand Down Expand Up @@ -158,6 +159,7 @@ export class ComfyPage {
) {
this.url = process.env.PLAYWRIGHT_TEST_URL || 'http://localhost:8188'
this.canvas = page.locator('#graph-canvas')
this.selectionToolbox = page.locator('.selection-toolbox')
this.widgetTextBox = page.getByPlaceholder('text').nth(1)
this.resetViewButton = page.getByRole('button', { name: 'Reset View' })
this.queueButton = page.getByRole('button', { name: 'Queue Prompt' })
Expand Down
11 changes: 4 additions & 7 deletions browser_tests/tests/nodeHelp.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,12 @@ test.describe('Node Help', () => {
// Select the node with panning to ensure toolbox is visible
await selectNodeWithPan(comfyPage, ksamplerNodes[0])

// Wait for selection overlay container and toolbox to appear
await expect(
comfyPage.page.locator('.selection-overlay-container')
).toBeVisible()
await expect(comfyPage.page.locator('.selection-toolbox')).toBeVisible()
// Wait for selection toolbox to appear
await expect(comfyPage.selectionToolbox).toBeVisible()

// Click the help button in the selection toolbox
const helpButton = comfyPage.page.locator(
'.selection-toolbox button:has(.pi-question-circle)'
const helpButton = comfyPage.selectionToolbox.locator(
'button:has(.pi-question-circle)'
)
await expect(helpButton).toBeVisible()
await helpButton.click()
Expand Down
66 changes: 29 additions & 37 deletions browser_tests/tests/selectionToolbox.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,17 @@ test.describe('Selection Toolbox', () => {

test('shows selection toolbox', async ({ comfyPage }) => {
// By default, selection toolbox should be enabled
expect(
await comfyPage.page.locator('.selection-overlay-container').isVisible()
).toBe(false)
await expect(comfyPage.selectionToolbox).not.toBeVisible()

// Select multiple nodes
await comfyPage.selectNodes(['KSampler', 'CLIP Text Encode (Prompt)'])

// Selection toolbox should be visible with multiple nodes selected
await expect(
comfyPage.page.locator('.selection-overlay-container')
).toBeVisible()
await expect(
comfyPage.page.locator('.selection-overlay-container.show-border')
).toBeVisible()
await expect(comfyPage.selectionToolbox).toBeVisible()
// Border is now drawn on canvas, check via screenshot
await expect(comfyPage.page.locator('canvas')).toHaveScreenshot(
'selection-toolbox-multiple-nodes-border.png'
)
})

test('shows at correct position when node is pasted', async ({
Expand All @@ -39,18 +36,16 @@ test.describe('Selection Toolbox', () => {
await comfyPage.page.mouse.move(100, 100)
await comfyPage.ctrlV()

const overlayContainer = comfyPage.page.locator(
'.selection-overlay-container'
)
await expect(overlayContainer).toBeVisible()
const toolboxContainer = comfyPage.selectionToolbox
await expect(toolboxContainer).toBeVisible()

// Verify the absolute position
const boundingBox = await overlayContainer.boundingBox()
// Verify toolbox is positioned (canvas-based positioning has different coordinates)
const boundingBox = await toolboxContainer.boundingBox()
expect(boundingBox).not.toBeNull()
// 10px offset for the pasted node
expect(Math.round(boundingBox!.x)).toBeCloseTo(90, -1) // Allow ~10px tolerance
// 30px offset of node title height
expect(Math.round(boundingBox!.y)).toBeCloseTo(60, -1)
// Canvas-based positioning can vary, just verify toolbox appears in reasonable bounds
expect(boundingBox!.x).toBeGreaterThan(-100) // Not too far off-screen left
expect(boundingBox!.x).toBeLessThan(1000) // Not too far off-screen right
expect(boundingBox!.y).toBeGreaterThan(-100) // Not too far off-screen top
})

test('hide when select and drag happen at the same time', async ({
Expand All @@ -65,38 +60,35 @@ test.describe('Selection Toolbox', () => {
await comfyPage.page.mouse.down()
await comfyPage.page.mouse.move(nodePos.x + 200, nodePos.y + 200)
await comfyPage.nextFrame()
await expect(
comfyPage.page.locator('.selection-overlay-container')
).not.toBeVisible()
await expect(comfyPage.selectionToolbox).not.toBeVisible()
})

test('shows border only with multiple selections', async ({ comfyPage }) => {
// Select single node
await comfyPage.selectNodes(['KSampler'])

// Selection overlay should be visible but without border
await expect(
comfyPage.page.locator('.selection-overlay-container')
).toBeVisible()
await expect(
comfyPage.page.locator('.selection-overlay-container.show-border')
).not.toBeVisible()
// Selection toolbox should be visible but without border
await expect(comfyPage.selectionToolbox).toBeVisible()
// Border is now drawn on canvas, check via screenshot
await expect(comfyPage.page.locator('canvas')).toHaveScreenshot(
'selection-toolbox-single-node-no-border.png'
)

// Select multiple nodes
await comfyPage.selectNodes(['KSampler', 'CLIP Text Encode (Prompt)'])

// Selection overlay should show border with multiple selections
await expect(
comfyPage.page.locator('.selection-overlay-container.show-border')
).toBeVisible()
// Selection border should show with multiple selections (canvas-based)
await expect(comfyPage.page.locator('canvas')).toHaveScreenshot(
'selection-toolbox-multiple-selections-border.png'
)

// Deselect to single node
await comfyPage.selectNodes(['CLIP Text Encode (Prompt)'])

// Border should be hidden again
await expect(
comfyPage.page.locator('.selection-overlay-container.show-border')
).not.toBeVisible()
// Border should be hidden again (canvas-based)
await expect(comfyPage.page.locator('canvas')).toHaveScreenshot(
'selection-toolbox-single-selection-no-border.png'
)
})

test('displays bypass button in toolbox when nodes are selected', async ({
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
80 changes: 0 additions & 80 deletions src/composables/element/useRetriggerableAnimation.ts

This file was deleted.

Loading