Skip to content
Merged
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
[refactor] address review comments - use fixture locators
- Add selectionToolbox locator to ComfyPage fixture as requested
- Replace .isVisible() === false with .not.toBeVisible() pattern
- Update all selection toolbox locators to use fixture instead of inline selectors
- Improves maintainability and follows established patterns
  • Loading branch information
christian-byrne committed Aug 23, 2025
commit 57bc4c25fa9fe6d238f959d9a07830f1c72f93d3
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
6 changes: 3 additions & 3 deletions browser_tests/tests/nodeHelp.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ test.describe('Node Help', () => {
await selectNodeWithPan(comfyPage, ksamplerNodes[0])

// Wait for selection toolbox to appear
await expect(comfyPage.page.locator('.selection-toolbox')).toBeVisible()
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
12 changes: 5 additions & 7 deletions browser_tests/tests/selectionToolbox.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@ test.describe('Selection Toolbox', () => {

test('shows selection toolbox', async ({ comfyPage }) => {
// By default, selection toolbox should be enabled
expect(await comfyPage.page.locator('.selection-toolbox').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-toolbox')).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'
Expand All @@ -38,7 +36,7 @@ test.describe('Selection Toolbox', () => {
await comfyPage.page.mouse.move(100, 100)
await comfyPage.ctrlV()

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

// Verify toolbox is positioned (canvas-based positioning has different coordinates)
Expand All @@ -62,15 +60,15 @@ 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-toolbox')).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 toolbox should be visible but without border
await expect(comfyPage.page.locator('.selection-toolbox')).toBeVisible()
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'
Expand Down
Loading