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>
90 lines
2.7 KiB
TypeScript
90 lines
2.7 KiB
TypeScript
import { expect } from '@playwright/test'
|
|
|
|
import type { ComfyPage } from '@e2e/fixtures/ComfyPage'
|
|
import { comfyPageFixture as test } from '@e2e/fixtures/ComfyPage'
|
|
|
|
async function createSubgraphAndNavigateInto(comfyPage: ComfyPage) {
|
|
const subgraphNode =
|
|
await comfyPage.subgraph.convertDefaultKSamplerToSubgraph()
|
|
await subgraphNode.navigateIntoSubgraph()
|
|
return subgraphNode
|
|
}
|
|
|
|
async function exitSubgraphAndPublish(
|
|
comfyPage: ComfyPage,
|
|
subgraphNode: Awaited<ReturnType<typeof createSubgraphAndNavigateInto>>,
|
|
blueprintName: string
|
|
) {
|
|
await comfyPage.page.keyboard.press('Escape')
|
|
await comfyPage.nextFrame()
|
|
|
|
await subgraphNode.click('title')
|
|
await comfyPage.command.executeCommand('Comfy.PublishSubgraph', {
|
|
name: blueprintName
|
|
})
|
|
|
|
await expect(comfyPage.visibleToasts).toHaveCount(1)
|
|
await comfyPage.toast.closeToasts(1)
|
|
}
|
|
|
|
async function searchAndExpectResult(
|
|
comfyPage: ComfyPage,
|
|
searchTerm: string,
|
|
expectedResult: string
|
|
) {
|
|
await comfyPage.command.executeCommand('Workspace.SearchBox.Toggle')
|
|
await expect(comfyPage.searchBox.input).toHaveCount(1)
|
|
await comfyPage.searchBox.input.fill(searchTerm)
|
|
await expect(comfyPage.searchBox.findResult(expectedResult)).toBeVisible({
|
|
timeout: 10_000
|
|
})
|
|
}
|
|
|
|
test.describe('Subgraph Search Aliases', { tag: ['@subgraph'] }, () => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting('Comfy.UseNewMenu', 'Top')
|
|
await comfyPage.settings.setSetting(
|
|
'Comfy.NodeSearchBoxImpl',
|
|
'v1 (legacy)'
|
|
)
|
|
})
|
|
|
|
test('Can set description on subgraph', async ({ comfyPage }) => {
|
|
await createSubgraphAndNavigateInto(comfyPage)
|
|
|
|
await comfyPage.command.executeCommand('Comfy.Subgraph.SetDescription', {
|
|
description: 'This is a test description'
|
|
})
|
|
await expect
|
|
.poll(() =>
|
|
comfyPage.page.evaluate(() => {
|
|
const subgraph = window.app!.canvas.subgraph
|
|
return (subgraph?.extra as Record<string, unknown>)
|
|
?.BlueprintDescription
|
|
})
|
|
)
|
|
.toBe('This is a test description')
|
|
})
|
|
|
|
test('Published search aliases remain searchable after reload', async ({
|
|
comfyPage
|
|
}) => {
|
|
const subgraphNode = await createSubgraphAndNavigateInto(comfyPage)
|
|
|
|
await comfyPage.command.executeCommand('Comfy.Subgraph.SetSearchAliases', {
|
|
aliases: 'dragon, fire breather'
|
|
})
|
|
|
|
const blueprintName = `test-persist-${Date.now()}`
|
|
await exitSubgraphAndPublish(comfyPage, subgraphNode, blueprintName)
|
|
|
|
await comfyPage.page.reload()
|
|
await comfyPage.page.waitForFunction(
|
|
() => window.app && window.app.extensionManager
|
|
)
|
|
await comfyPage.nextFrame()
|
|
|
|
await searchAndExpectResult(comfyPage, 'dragon', blueprintName)
|
|
})
|
|
})
|