mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-05 23:50:08 +00:00
73 lines
2.2 KiB
TypeScript
73 lines
2.2 KiB
TypeScript
import { expect } from '@playwright/test'
|
|
|
|
import { comfyPageFixture } from './fixtures/ComfyPage'
|
|
|
|
const test = comfyPageFixture
|
|
|
|
test.describe('Selection Toolbox', () => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.setSetting('Comfy.Canvas.SelectionToolbox', true)
|
|
})
|
|
|
|
test('shows/hides selection toolbox based on setting', async ({
|
|
comfyPage
|
|
}) => {
|
|
// By default, selection toolbox should be enabled
|
|
expect(
|
|
await comfyPage.page.locator('.selection-overlay-container').isVisible()
|
|
).toBe(false)
|
|
|
|
// 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()
|
|
})
|
|
|
|
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()
|
|
|
|
// 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()
|
|
|
|
// 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()
|
|
})
|
|
|
|
test('displays refresh button in toolbox when all nodes are selected', async ({
|
|
comfyPage
|
|
}) => {
|
|
// Select all nodes
|
|
await comfyPage.page.focus('canvas')
|
|
await comfyPage.page.keyboard.press('Control+A')
|
|
|
|
await expect(
|
|
comfyPage.page.locator('.selection-toolbox .pi-refresh')
|
|
).toBeVisible()
|
|
})
|
|
})
|