Files
ComfyUI_frontend/browser_tests/tests/propertiesPanel/propertiesPanelTitleEdit.spec.ts
bymyself 610165cde9 test: add e2e tests for properties panel
- Add ComfyPropertiesPanel fixture class with locators and helpers
- Add tests for basic functionality, search, title editing, global settings, and tab navigation
- Tag all tests with @ui for filtering

Amp-Thread-ID: https://ampcode.com/threads/T-019c16eb-8621-7473-9062-a57b0a1e782a
Co-authored-by: Amp <amp@ampcode.com>
2026-01-31 17:57:55 -08:00

92 lines
2.9 KiB
TypeScript

import { expect } from '@playwright/test'
import { comfyPageFixture as test } from '../../fixtures/ComfyPage'
test.describe('Properties panel title editing', { tag: ['@ui'] }, () => {
test.beforeEach(async ({ comfyPage }) => {
await comfyPage.actionbar.propertiesButton.click()
await expect(comfyPage.propertiesPanel.root).toBeVisible()
})
test.describe('Single node title editing', () => {
test('shows editable title for single node selection', async ({
comfyPage
}) => {
const { propertiesPanel } = comfyPage
await comfyPage.selectNodes(['KSampler'])
await propertiesPanel.panelTitle.click()
await expect(propertiesPanel.nodeTitleInput).toBeVisible()
})
test('edits node title successfully', async ({ comfyPage }) => {
const { propertiesPanel } = comfyPage
await comfyPage.selectNodes(['KSampler'])
const newTitle = 'My Custom KSampler'
await propertiesPanel.panelTitle.click()
await propertiesPanel.nodeTitleInput.fill(newTitle)
await propertiesPanel.nodeTitleInput.press('Enter')
await expect(propertiesPanel.panelTitle).toContainText(newTitle)
const renamedNodes = await comfyPage.getNodeRefsByTitle(newTitle)
expect(renamedNodes.length).toBeGreaterThan(0)
})
test('cancels title edit with Escape', async ({ comfyPage }) => {
const { propertiesPanel } = comfyPage
await comfyPage.selectNodes(['KSampler'])
const originalTitle = await propertiesPanel.panelTitle.innerText()
await propertiesPanel.panelTitle.click()
await propertiesPanel.nodeTitleInput.fill('Should Not Be Saved')
await propertiesPanel.nodeTitleInput.press('Escape')
await expect(propertiesPanel.panelTitle).toContainText(originalTitle)
})
test('does not save empty title', async ({ comfyPage }) => {
const { propertiesPanel } = comfyPage
await comfyPage.selectNodes(['KSampler'])
const originalTitle = await propertiesPanel.panelTitle.innerText()
await propertiesPanel.panelTitle.click()
await propertiesPanel.nodeTitleInput.fill('')
await propertiesPanel.nodeTitleInput.press('Enter')
await expect(propertiesPanel.panelTitle).toContainText(originalTitle)
})
})
test.describe('Title editing restrictions', () => {
test('does not allow title editing for multiple selection', async ({
comfyPage
}) => {
const { propertiesPanel } = comfyPage
await comfyPage.selectNodes(['KSampler', 'CLIP Text Encode (Prompt)'])
await propertiesPanel.panelTitle.click()
await expect(propertiesPanel.nodeTitleInput).not.toBeVisible()
})
test('does not allow title editing for workflow overview', async ({
comfyPage
}) => {
const { propertiesPanel } = comfyPage
await propertiesPanel.panelTitle.click()
await expect(propertiesPanel.nodeTitleInput).not.toBeVisible()
})
})
})