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>
93 lines
3.1 KiB
TypeScript
93 lines
3.1 KiB
TypeScript
import { expect } from '@playwright/test'
|
|
|
|
import type { Asset, ListAssetsResponse } from '@comfyorg/ingest-types'
|
|
import { comfyPageFixture } from '@e2e/fixtures/ComfyPage'
|
|
import {
|
|
STABLE_CHECKPOINT,
|
|
STABLE_CHECKPOINT_2
|
|
} from '@e2e/fixtures/data/assetFixtures'
|
|
|
|
function makeAssetsResponse(assets: Asset[]): ListAssetsResponse {
|
|
return { assets, total: assets.length, has_more: false }
|
|
}
|
|
|
|
const CLOUD_ASSETS: Asset[] = [STABLE_CHECKPOINT, STABLE_CHECKPOINT_2]
|
|
|
|
// Stub /api/assets before the app loads. The local ComfyUI backend has no
|
|
// /api/assets endpoint (returns 503), which poisons the assets store on
|
|
// first load. Narrow pattern avoids intercepting static /assets/*.js bundles.
|
|
//
|
|
// TODO: Consider moving this stub into ComfyPage fixture for all @cloud tests.
|
|
const test = comfyPageFixture.extend<{ stubCloudAssets: void }>({
|
|
stubCloudAssets: [
|
|
async ({ page }, use) => {
|
|
const pattern = '**/api/assets?*'
|
|
await page.route(pattern, (route) =>
|
|
route.fulfill({
|
|
status: 200,
|
|
contentType: 'application/json',
|
|
body: JSON.stringify(makeAssetsResponse(CLOUD_ASSETS))
|
|
})
|
|
)
|
|
await use()
|
|
await page.unroute(pattern)
|
|
},
|
|
{ auto: true }
|
|
]
|
|
})
|
|
|
|
test.describe('Asset-supported node default value', { tag: '@cloud' }, () => {
|
|
test.afterEach(async ({ comfyPage }) => {
|
|
await comfyPage.nodeOps.clearGraph()
|
|
})
|
|
|
|
test('should use first cloud asset when server default is not in assets', async ({
|
|
comfyPage
|
|
}) => {
|
|
// The default workflow contains a CheckpointLoaderSimple node whose
|
|
// server default (from object_info) is a local file not in cloud assets.
|
|
// Wait for the existing node's asset widget to mount, confirming the
|
|
// assets store has been populated from the stub before adding a new node.
|
|
await expect
|
|
.poll(
|
|
() =>
|
|
comfyPage.page.evaluate(() => {
|
|
const node = window.app!.graph.nodes.find(
|
|
(n: { type: string }) => n.type === 'CheckpointLoaderSimple'
|
|
)
|
|
return node?.widgets?.find(
|
|
(w: { name: string }) => w.name === 'ckpt_name'
|
|
)?.type
|
|
}),
|
|
{ timeout: 10_000 }
|
|
)
|
|
.toBe('asset')
|
|
|
|
// Add a new CheckpointLoaderSimple — should use first cloud asset,
|
|
// not the server's object_info default.
|
|
// Production resolves via getAssetFilename (user_metadata.filename →
|
|
// metadata.filename → asset.name). Test fixtures have no metadata
|
|
// filename, so asset.name is the resolved value.
|
|
const nodeId = await comfyPage.page.evaluate(() => {
|
|
const node = window.LiteGraph!.createNode('CheckpointLoaderSimple')
|
|
window.app!.graph.add(node!)
|
|
return node!.id
|
|
})
|
|
|
|
await expect
|
|
.poll(
|
|
async () => {
|
|
return await comfyPage.page.evaluate((id) => {
|
|
const node = window.app!.graph.getNodeById(id)
|
|
const widget = node?.widgets?.find(
|
|
(w: { name: string }) => w.name === 'ckpt_name'
|
|
)
|
|
return String(widget?.value ?? '')
|
|
}, nodeId)
|
|
},
|
|
{ timeout: 10_000 }
|
|
)
|
|
.toBe(CLOUD_ASSETS[0].name)
|
|
})
|
|
})
|