mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-03 20:51:58 +00:00
test: add E2E tests for bottom panel core behaviors (#10814)
## Summary - Add `browser_tests/tests/bottomPanel.spec.ts` with tests for behaviors not covered by existing `bottomPanelLogs` and `bottomPanelShortcuts` specs - Tests cover: close button (X), tab persistence on re-open, resize gutter visibility and drag, canvas interaction when panel is closed, cross-panel switching (terminal <-> shortcuts), and registered tab enumeration - Extend `BottomPanel` fixture with `closeButton` and `resizeGutter` locators ## Test plan - [ ] `pnpm test:browser:local` passes all new tests in `bottomPanel.spec.ts` - [ ] Existing `bottomPanelLogs.spec.ts` and `bottomPanelShortcuts.spec.ts` are unaffected - [ ] `pnpm typecheck:browser` passes - [ ] `pnpm lint` passes ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-10814-test-add-E2E-tests-for-bottom-panel-core-behaviors-3366d73d365081ea9b90c643897845fa) by [Unito](https://www.unito.io) --------- Co-authored-by: dante <dante@danteui-MacStudio.local> Co-authored-by: GitHub Action <action@github.com> Co-authored-by: Alexander Brown <drjkl@comfy.org>
This commit is contained in:
102
browser_tests/tests/bottomPanel.spec.ts
Normal file
102
browser_tests/tests/bottomPanel.spec.ts
Normal file
@@ -0,0 +1,102 @@
|
||||
import {
|
||||
comfyPageFixture as test,
|
||||
comfyExpect as expect
|
||||
} from '@e2e/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).toBeHidden()
|
||||
})
|
||||
|
||||
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).toBeHidden()
|
||||
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
|
||||
|
||||
await expect(bottomPanel.root).toBeHidden()
|
||||
|
||||
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).toBeHidden()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user