mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-08 05:19:59 +00:00
Compare commits
6 Commits
test/setti
...
test/botto
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
550f5bb4ab | ||
|
|
3d175d66bb | ||
|
|
38cab734dc | ||
|
|
cde01f67ed | ||
|
|
b442956b27 | ||
|
|
7e855e7cc3 |
@@ -20,6 +20,8 @@ export class BottomPanel {
|
||||
readonly root: Locator
|
||||
readonly keyboardShortcutsButton: Locator
|
||||
readonly toggleButton: Locator
|
||||
readonly closeButton: Locator
|
||||
readonly resizeGutter: Locator
|
||||
readonly shortcuts: ShortcutsTab
|
||||
|
||||
constructor(readonly page: Page) {
|
||||
@@ -30,6 +32,28 @@ export class BottomPanel {
|
||||
this.toggleButton = page.getByRole('button', {
|
||||
name: /Toggle Bottom Panel/i
|
||||
})
|
||||
this.closeButton = this.root.getByRole('button', { name: /^Close$/i })
|
||||
// PrimeVue renders the splitter gutter outside the panel body.
|
||||
this.resizeGutter = page.locator(
|
||||
'.splitter-overlay-bottom > .p-splitter-gutter'
|
||||
)
|
||||
this.shortcuts = new ShortcutsTab(page)
|
||||
}
|
||||
|
||||
async resizeByDragging(deltaY: number): Promise<void> {
|
||||
const gutterBox = await this.resizeGutter.boundingBox()
|
||||
if (!gutterBox) {
|
||||
throw new Error('Bottom panel resize gutter should have layout')
|
||||
}
|
||||
|
||||
const gutterCenterX = gutterBox.x + gutterBox.width / 2
|
||||
const gutterCenterY = gutterBox.y + gutterBox.height / 2
|
||||
|
||||
await this.page.mouse.move(gutterCenterX, gutterCenterY)
|
||||
await this.page.mouse.down()
|
||||
await this.page.mouse.move(gutterCenterX, gutterCenterY + deltaY, {
|
||||
steps: 5
|
||||
})
|
||||
await this.page.mouse.up()
|
||||
}
|
||||
}
|
||||
|
||||
105
browser_tests/tests/bottomPanel.spec.ts
Normal file
105
browser_tests/tests/bottomPanel.spec.ts
Normal file
@@ -0,0 +1,105 @@
|
||||
import {
|
||||
comfyPageFixture as test,
|
||||
comfyExpect as expect
|
||||
} from '../fixtures/ComfyPage'
|
||||
|
||||
test.describe('Bottom Panel', { tag: '@ui' }, () => {
|
||||
test.beforeEach(async ({ comfyPage }) => {
|
||||
await comfyPage.settings.setSetting('Comfy.UseNewMenu', 'Top')
|
||||
})
|
||||
|
||||
test('should close panel via close button inside the panel', async ({
|
||||
comfyPage
|
||||
}) => {
|
||||
const { bottomPanel } = comfyPage
|
||||
|
||||
await bottomPanel.toggleButton.click()
|
||||
await expect(
|
||||
bottomPanel.root,
|
||||
'Panel should be open before testing close button'
|
||||
).toBeVisible()
|
||||
|
||||
await bottomPanel.closeButton.click()
|
||||
await expect(bottomPanel.root).not.toBeVisible()
|
||||
})
|
||||
|
||||
test('should display resize gutter when panel is open', async ({
|
||||
comfyPage
|
||||
}) => {
|
||||
const { bottomPanel } = comfyPage
|
||||
|
||||
await bottomPanel.toggleButton.click()
|
||||
await expect(
|
||||
bottomPanel.root,
|
||||
'Panel should be open before checking the resize gutter'
|
||||
).toBeVisible()
|
||||
await expect(bottomPanel.resizeGutter).toBeVisible()
|
||||
})
|
||||
|
||||
test('should hide resize gutter when panel is closed', async ({
|
||||
comfyPage
|
||||
}) => {
|
||||
const { bottomPanel } = comfyPage
|
||||
|
||||
await expect(bottomPanel.root).not.toBeVisible()
|
||||
await expect(bottomPanel.resizeGutter).toBeHidden()
|
||||
})
|
||||
|
||||
test('should resize panel by dragging the gutter', async ({ comfyPage }) => {
|
||||
const { bottomPanel } = comfyPage
|
||||
|
||||
await bottomPanel.toggleButton.click()
|
||||
await expect(
|
||||
bottomPanel.root,
|
||||
'Panel should be open before resizing'
|
||||
).toBeVisible()
|
||||
|
||||
const initialHeight = await bottomPanel.root.evaluate(
|
||||
(el) => el.getBoundingClientRect().height
|
||||
)
|
||||
|
||||
await bottomPanel.resizeByDragging(-100)
|
||||
|
||||
await expect
|
||||
.poll(
|
||||
() =>
|
||||
bottomPanel.root.evaluate((el) => el.getBoundingClientRect().height),
|
||||
{
|
||||
message:
|
||||
'Panel height should increase after dragging the resize gutter'
|
||||
}
|
||||
)
|
||||
.toBeGreaterThan(initialHeight)
|
||||
})
|
||||
|
||||
test('should not block canvas interactions when panel is closed', async ({
|
||||
comfyPage
|
||||
}) => {
|
||||
const { bottomPanel } = comfyPage
|
||||
|
||||
if (await bottomPanel.root.isVisible()) {
|
||||
await bottomPanel.closeButton.click()
|
||||
}
|
||||
await expect(bottomPanel.root).not.toBeVisible()
|
||||
|
||||
await comfyPage.canvas.click({
|
||||
position: { x: 100, y: 100 }
|
||||
})
|
||||
await expect(comfyPage.canvas).toHaveFocus()
|
||||
})
|
||||
|
||||
test('should close panel via close button from shortcuts view', async ({
|
||||
comfyPage
|
||||
}) => {
|
||||
const { bottomPanel } = comfyPage
|
||||
|
||||
await bottomPanel.keyboardShortcutsButton.click()
|
||||
await expect(
|
||||
bottomPanel.root,
|
||||
'Panel should be open before closing it from the shortcuts view'
|
||||
).toBeVisible()
|
||||
|
||||
await bottomPanel.closeButton.click()
|
||||
await expect(bottomPanel.root).not.toBeVisible()
|
||||
})
|
||||
})
|
||||
@@ -1,141 +0,0 @@
|
||||
import { expect } from '@playwright/test'
|
||||
|
||||
import { comfyPageFixture as test } from '../../fixtures/ComfyPage'
|
||||
|
||||
test.describe('Settings dialog', { tag: '@ui' }, () => {
|
||||
test('About panel shows version badges', async ({ comfyPage }) => {
|
||||
const dialog = comfyPage.settingDialog
|
||||
await dialog.open()
|
||||
await dialog.goToAboutPanel()
|
||||
|
||||
const aboutPanel = comfyPage.page.getByTestId('about-panel')
|
||||
await expect(aboutPanel).toBeVisible()
|
||||
await expect(aboutPanel.locator('.about-badge').first()).toBeVisible()
|
||||
await expect(aboutPanel).toContainText('ComfyUI_frontend')
|
||||
})
|
||||
|
||||
test('Toggling a boolean setting through UI persists the value', async ({
|
||||
comfyPage
|
||||
}) => {
|
||||
const settingId = 'Comfy.Validation.Workflows'
|
||||
const initialValue = await comfyPage.settings.getSetting<boolean>(settingId)
|
||||
|
||||
const dialog = comfyPage.settingDialog
|
||||
await dialog.open()
|
||||
|
||||
await dialog.searchBox.fill('Validate workflows')
|
||||
const settingRow = dialog.root.locator(`[data-setting-id="${settingId}"]`)
|
||||
await expect(settingRow).toBeVisible()
|
||||
|
||||
await settingRow.locator('.p-toggleswitch').click()
|
||||
|
||||
await expect
|
||||
.poll(() => comfyPage.settings.getSetting<boolean>(settingId))
|
||||
.toBe(!initialValue)
|
||||
})
|
||||
|
||||
test('Can be closed via close button', async ({ comfyPage }) => {
|
||||
const dialog = comfyPage.settingDialog
|
||||
await dialog.open()
|
||||
await expect(dialog.root).toBeVisible()
|
||||
|
||||
await dialog.close()
|
||||
await expect(dialog.root).not.toBeVisible()
|
||||
})
|
||||
|
||||
test('Escape key closes dialog', async ({ comfyPage }) => {
|
||||
const dialog = comfyPage.settingDialog
|
||||
await dialog.open()
|
||||
await expect(dialog.root).toBeVisible()
|
||||
|
||||
await comfyPage.page.keyboard.press('Escape')
|
||||
await expect(dialog.root).not.toBeVisible()
|
||||
})
|
||||
|
||||
test('Search filters settings list', async ({ comfyPage }) => {
|
||||
const dialog = comfyPage.settingDialog
|
||||
await dialog.open()
|
||||
|
||||
const settingItems = dialog.root.locator('[data-setting-id]')
|
||||
const countBeforeSearch = await settingItems.count()
|
||||
|
||||
await dialog.searchBox.fill('Validate workflows')
|
||||
await expect
|
||||
.poll(() => settingItems.count())
|
||||
.toBeLessThan(countBeforeSearch)
|
||||
})
|
||||
|
||||
test('Search can be cleared to restore all settings', async ({
|
||||
comfyPage
|
||||
}) => {
|
||||
const dialog = comfyPage.settingDialog
|
||||
await dialog.open()
|
||||
|
||||
const settingItems = dialog.root.locator('[data-setting-id]')
|
||||
const countBeforeSearch = await settingItems.count()
|
||||
|
||||
await dialog.searchBox.fill('Validate workflows')
|
||||
await expect
|
||||
.poll(() => settingItems.count())
|
||||
.toBeLessThan(countBeforeSearch)
|
||||
|
||||
await dialog.searchBox.clear()
|
||||
await expect.poll(() => settingItems.count()).toBe(countBeforeSearch)
|
||||
})
|
||||
|
||||
test('Category navigation changes content area', async ({ comfyPage }) => {
|
||||
const dialog = comfyPage.settingDialog
|
||||
await dialog.open()
|
||||
|
||||
const firstCategory = dialog.categories.first()
|
||||
const firstCategoryName = await firstCategory.textContent()
|
||||
await firstCategory.click()
|
||||
const firstContent = await dialog.contentArea.textContent()
|
||||
|
||||
// Find a different category to click
|
||||
const categoryCount = await dialog.categories.count()
|
||||
for (let i = 1; i < categoryCount; i++) {
|
||||
const cat = dialog.categories.nth(i)
|
||||
const catName = await cat.textContent()
|
||||
if (catName !== firstCategoryName) {
|
||||
await cat.click()
|
||||
await expect
|
||||
.poll(() => dialog.contentArea.textContent())
|
||||
.not.toBe(firstContent)
|
||||
return
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
test('Dropdown setting can be changed and persists', async ({
|
||||
comfyPage
|
||||
}) => {
|
||||
const settingId = 'Comfy.UseNewMenu'
|
||||
const initialValue = await comfyPage.settings.getSetting<string>(settingId)
|
||||
|
||||
const dialog = comfyPage.settingDialog
|
||||
await dialog.open()
|
||||
|
||||
await dialog.searchBox.fill('Use new menu')
|
||||
const settingRow = dialog.root.locator(`[data-setting-id="${settingId}"]`)
|
||||
await expect(settingRow).toBeVisible()
|
||||
|
||||
// Click the PrimeVue Select to open the dropdown
|
||||
await settingRow.locator('.p-select').click()
|
||||
const overlay = comfyPage.page.locator('.p-select-overlay')
|
||||
await expect(overlay).toBeVisible()
|
||||
|
||||
// Pick the option that is not the current value
|
||||
const targetValue = initialValue === 'Top' ? 'Disabled' : 'Top'
|
||||
await overlay
|
||||
.locator(`.p-select-option-label:text-is("${targetValue}")`)
|
||||
.click()
|
||||
|
||||
await expect
|
||||
.poll(() => comfyPage.settings.getSetting<string>(settingId))
|
||||
.toBe(targetValue)
|
||||
|
||||
// Restore original value
|
||||
await comfyPage.settings.setSetting(settingId, initialValue)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user