Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
simplify
  • Loading branch information
christian-byrne committed Dec 12, 2025
commit 1311d3b428ace710a4281b3aade4369b52d75b74
60 changes: 60 additions & 0 deletions browser_tests/tests/vueNodes/maskEditor.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { expect } from '@playwright/test'

import { comfyPageFixture as test } from '../../fixtures/ComfyPage'

test.describe('Vue Nodes Mask Editor', () => {
test.beforeEach(async ({ comfyPage }) => {
await comfyPage.setSetting('Comfy.UseNewMenu', 'Disabled')
await comfyPage.setSetting('Comfy.VueNodes.Enabled', true)
await comfyPage.setSetting('Comfy.Canvas.SelectionToolbox', true)
})

test('opens mask editor from toolbox and image overlay buttons', async ({
comfyPage
}) => {
await comfyPage.loadWorkflow('widgets/load_image_widget')
await comfyPage.vueNodes.waitForNodes()

// Get the LoadImage node and drop an image onto it
const nodes = await comfyPage.getNodeRefsByType('LoadImage')
const loadImageNode = nodes[0]
const { x, y } = await loadImageNode.getPosition()

await comfyPage.dragAndDropFile('image32x32.webp', {
dropPosition: { x: x + 100, y: y + 100 },
waitForUpload: true
})

await comfyPage.page.waitForTimeout(500)

const maskEditorDialog = comfyPage.page.locator('.maskEditor-dialog-root')

// Test 1: Open from toolbox button
await comfyPage.selectNodes(['Load Image'])
await expect(comfyPage.selectionToolbox).toBeVisible()

const toolboxMaskButton = comfyPage.page.locator(
'.selection-toolbox button:has(.i-comfy\\:mask)'
)
await expect(toolboxMaskButton).toBeVisible()
await toolboxMaskButton.click()

await expect(maskEditorDialog).toBeVisible()

// Close mask editor
await comfyPage.page.keyboard.press('Escape')
await expect(maskEditorDialog).not.toBeVisible()

// Test 2: Open from image overlay button
const imageWrapper = comfyPage.page.locator('.image-preview [role="img"]')
await imageWrapper.hover()

const overlayMaskButton = comfyPage.page.locator(
'.image-preview [aria-label="Edit or mask image"]'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could use getByLabel here

)
await expect(overlayMaskButton).toBeVisible()
await overlayMaskButton.click()

await expect(maskEditorDialog).toBeVisible()
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -228,15 +228,7 @@ const handleImageError = () => {
actualDimensions.value = null
}

const setupNodeForMaskEditor = () => {
syncNodeImgs()
if (!props.nodeId) return
const node = app.rootGraph?.getNodeById(props.nodeId)
if (node) app.canvas?.select(node)
}

const handleEditMask = () => {
setupNodeForMaskEditor()
void commandStore.execute('Comfy.MaskEditor.OpenMaskEditor')
}

Expand Down
Loading