mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +00:00
## Summary Alright, alright, alright. These e2e tests have been runnin' around like they're late for somethin', settin' tight little timeouts like the world's gonna end in 250 milliseconds. Man, you gotta *breathe*. Let the framework do its thing. Go slow to go fast, that's what I always say. ## Changes - **What**: Removed ~120 redundant timeout overrides from auto-retrying Playwright assertions (`toBeVisible`, `toBeHidden`, `toHaveCount`, `toBeEnabled`, `toHaveAttribute`, `toContainText`, `expect.poll`) where 5000ms is already the default. Also removed sub-5s timeouts (1s, 2s, 3s) that were just *begging* for flaky failures — like wearin' a belt and suspenders and also holdin' your pants up with both hands. Raised the absurdly short timeouts in `customMatchers.ts` (250ms `toPass` → 5000ms, 256ms poll → default). Kept `timeout: 5000` on `.toPass()` calls (defaults to 0), `.waitFor()`, `waitForRequest`, `waitForFunction`, intentionally-short timeouts inside retry loops, and conditional `.isVisible()/.catch()` checks — those fellas actually need the help. ## Review Focus Every remaining timeout in the diff is there for a *reason*. The ones on `.toPass()` stay because that API defaults to zero — it won't retry at all without one. The ones on `.waitFor()` and `waitForRequest` stay because those are locator actions, not auto-retrying assertions. The intentionally-short ones inside `toPass` retry loops (`interaction.spec.ts`) and the negative assertions (`actionbar.spec.ts` confirming no response arrives) — those are *supposed* to be tight. The short timeouts on regular assertions were actively *encouragin'* flaky failures. That's like settin' your alarm for 4 AM and then gettin' mad you're tired. Just... don't do that, man. Let things take the time they need. 38 files, net -115 lines. Less code, more chill. That's livin'. --------- Co-authored-by: Amp <amp@ampcode.com>
164 lines
4.6 KiB
TypeScript
164 lines
4.6 KiB
TypeScript
import type { Page } from '@playwright/test'
|
|
|
|
import {
|
|
comfyPageFixture as test,
|
|
comfyExpect as expect
|
|
} from '@e2e/fixtures/ComfyPage'
|
|
|
|
/**
|
|
* Default workflow widget inputs as [nodeId, widgetName] tuples.
|
|
* All widgets from the default graph are selected so the panel scrolls,
|
|
* pushing the last widget's dropdown to the clipping boundary.
|
|
*/
|
|
const DEFAULT_INPUTS: [string, string][] = [
|
|
['4', 'ckpt_name'],
|
|
['6', 'text'],
|
|
['7', 'text'],
|
|
['5', 'width'],
|
|
['5', 'height'],
|
|
['5', 'batch_size'],
|
|
['3', 'seed'],
|
|
['3', 'steps'],
|
|
['3', 'cfg'],
|
|
['3', 'sampler_name'],
|
|
['3', 'scheduler'],
|
|
['3', 'denoise'],
|
|
['9', 'filename_prefix']
|
|
]
|
|
|
|
function isClippedByAnyAncestor(el: Element): boolean {
|
|
const child = el.getBoundingClientRect()
|
|
let parent = el.parentElement
|
|
|
|
while (parent) {
|
|
const overflow = getComputedStyle(parent).overflow
|
|
if (overflow !== 'visible') {
|
|
const p = parent.getBoundingClientRect()
|
|
if (
|
|
child.top < p.top ||
|
|
child.bottom > p.bottom ||
|
|
child.left < p.left ||
|
|
child.right > p.right
|
|
) {
|
|
return true
|
|
}
|
|
}
|
|
parent = parent.parentElement
|
|
}
|
|
return false
|
|
}
|
|
|
|
/** Add a node to the graph by type and return its ID. */
|
|
async function addNode(page: Page, nodeType: string): Promise<string> {
|
|
return page.evaluate((type) => {
|
|
const node = window.app!.graph.add(
|
|
window.LiteGraph!.createNode(type, undefined, {})
|
|
)
|
|
return String(node!.id)
|
|
}, nodeType)
|
|
}
|
|
|
|
test.describe('App mode dropdown clipping', { tag: '@ui' }, () => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.appMode.enableLinearMode()
|
|
})
|
|
|
|
test('Select dropdown is not clipped in app mode panel', async ({
|
|
comfyPage
|
|
}) => {
|
|
const saveVideoId = await addNode(comfyPage.page, 'SaveVideo')
|
|
await comfyPage.nextFrame()
|
|
|
|
const inputs: [string, string][] = [
|
|
...DEFAULT_INPUTS,
|
|
[saveVideoId, 'codec']
|
|
]
|
|
await comfyPage.appMode.enterAppModeWithInputs(inputs)
|
|
|
|
await expect(comfyPage.appMode.linearWidgets).toBeVisible()
|
|
|
|
// Scroll to bottom so the codec widget is at the clipping edge
|
|
const widgetList = comfyPage.appMode.linearWidgets
|
|
await widgetList.evaluate((el) =>
|
|
el.scrollTo({ top: el.scrollHeight, behavior: 'instant' })
|
|
)
|
|
|
|
// Click the codec select (combobox role with aria-label from WidgetSelectDefault)
|
|
const codecSelect = widgetList.getByRole('combobox', { name: 'codec' })
|
|
await codecSelect.click()
|
|
|
|
const overlay = comfyPage.page.locator('.p-select-overlay').first()
|
|
await expect(overlay).toBeVisible()
|
|
|
|
await expect
|
|
.poll(() =>
|
|
overlay.evaluate((el) => {
|
|
const rect = el.getBoundingClientRect()
|
|
return (
|
|
rect.top >= 0 &&
|
|
rect.left >= 0 &&
|
|
rect.bottom <= window.innerHeight &&
|
|
rect.right <= window.innerWidth
|
|
)
|
|
})
|
|
)
|
|
.toBe(true)
|
|
|
|
await expect
|
|
.poll(() => overlay.evaluate(isClippedByAnyAncestor))
|
|
.toBe(false)
|
|
})
|
|
|
|
test('FormDropdown popup is not clipped in app mode panel', async ({
|
|
comfyPage
|
|
}) => {
|
|
const loadImageId = await addNode(comfyPage.page, 'LoadImage')
|
|
await comfyPage.nextFrame()
|
|
|
|
const inputs: [string, string][] = [
|
|
...DEFAULT_INPUTS,
|
|
[loadImageId, 'image']
|
|
]
|
|
await comfyPage.appMode.enterAppModeWithInputs(inputs)
|
|
|
|
await expect(comfyPage.appMode.linearWidgets).toBeVisible()
|
|
|
|
// Scroll to bottom so the image widget is at the clipping edge
|
|
const widgetList = comfyPage.appMode.linearWidgets
|
|
await widgetList.evaluate((el) =>
|
|
el.scrollTo({ top: el.scrollHeight, behavior: 'instant' })
|
|
)
|
|
|
|
// Click the FormDropdown trigger button for the image widget.
|
|
// The button emits 'select-click' which toggles the Popover.
|
|
const imageRow = widgetList.locator(
|
|
'div:has(> div > span:text-is("image"))'
|
|
)
|
|
const dropdownButton = imageRow.locator('button:has(> span)').first()
|
|
await dropdownButton.click()
|
|
|
|
// The unstyled PrimeVue Popover renders with role="dialog".
|
|
// Locate the one containing the image grid (filter buttons like "All", "Inputs").
|
|
const popover = comfyPage.appMode.imagePickerPopover
|
|
await expect(popover).toBeVisible()
|
|
|
|
await expect
|
|
.poll(() =>
|
|
popover.evaluate((el) => {
|
|
const rect = el.getBoundingClientRect()
|
|
return (
|
|
rect.top >= 0 &&
|
|
rect.left >= 0 &&
|
|
rect.bottom <= window.innerHeight &&
|
|
rect.right <= window.innerWidth
|
|
)
|
|
})
|
|
)
|
|
.toBe(true)
|
|
|
|
await expect
|
|
.poll(() => popover.evaluate(isClippedByAnyAncestor))
|
|
.toBe(false)
|
|
})
|
|
})
|