mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-08 06:30:04 +00:00
## Summary Fix flaky `no_workflow.webp` screenshot test by waiting for async upload and `/view` response before asserting. ## Changes - **What**: In `loadWorkflowInMedia.spec.ts`, added `waitForUpload: true` for `no_workflow.webp` and a `waitForResponse` call for the `/view` endpoint. This ensures the error toast (from the 500 response) is consistently visible before the screenshot assertion. ## Review Focus The fix is scoped to `no_workflow.webp` only (via a `filesWithUpload` Set) since it's the only test file that triggers an upload + `/view` call. Other media files embed workflows and don't hit this path. Fixes #9450 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-9458-test-fix-flaky-no_workflow-webp-screenshot-test-31b6d73d365081b88deaee91769baec1) by [Unito](https://www.unito.io) --------- Co-authored-by: GitHub Action <action@github.com> Co-authored-by: Alexander Brown <drjkl@comfy.org>
69 lines
2.1 KiB
TypeScript
69 lines
2.1 KiB
TypeScript
import { expect } from '@playwright/test'
|
|
|
|
import { comfyPageFixture as test } from '../fixtures/ComfyPage'
|
|
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting('Comfy.UseNewMenu', 'Disabled')
|
|
})
|
|
|
|
test.describe(
|
|
'Load Workflow in Media',
|
|
{ tag: ['@screenshot', '@workflow'] },
|
|
() => {
|
|
const fileNames = [
|
|
'workflow.webp',
|
|
'edited_workflow.webp',
|
|
'no_workflow.webp',
|
|
'large_workflow.webp',
|
|
'workflow_prompt_parameters.png',
|
|
'workflow_itxt.png',
|
|
'workflow.webm',
|
|
// Skipped due to 3d widget unstable visual result.
|
|
// 3d widget shows grid after fully loaded.
|
|
// 'workflow.glb',
|
|
'workflow.mp4',
|
|
'workflow.mov',
|
|
'workflow.m4v',
|
|
'workflow.svg'
|
|
// TODO: Re-enable after fixing test asset to use core nodes only
|
|
// Currently opens missing nodes dialog which is outside scope of AVIF loading functionality
|
|
// 'workflow.avif'
|
|
]
|
|
const filesWithUpload = new Set(['no_workflow.webp'])
|
|
|
|
fileNames.forEach(async (fileName) => {
|
|
test(`Load workflow in ${fileName} (drop from filesystem)`, async ({
|
|
comfyPage
|
|
}) => {
|
|
const waitForUpload = filesWithUpload.has(fileName)
|
|
await comfyPage.dragDrop.dragAndDropFile(
|
|
`workflowInMedia/${fileName}`,
|
|
{ waitForUpload }
|
|
)
|
|
if (waitForUpload) {
|
|
await comfyPage.page.waitForResponse(
|
|
(resp) => resp.url().includes('/view') && resp.status() !== 0,
|
|
{ timeout: 10000 }
|
|
)
|
|
}
|
|
await expect(comfyPage.canvas).toHaveScreenshot(`${fileName}.png`)
|
|
})
|
|
})
|
|
|
|
const urls = [
|
|
'https://comfyanonymous.github.io/ComfyUI_examples/hidream/hidream_dev_example.png'
|
|
]
|
|
urls.forEach(async (url) => {
|
|
test(`Load workflow from URL ${url} (drop from different browser tabs)`, async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.dragDrop.dragAndDropURL(url)
|
|
const readableName = url.split('/').pop()
|
|
await expect(comfyPage.canvas).toHaveScreenshot(
|
|
`dropped_workflow_url_${readableName}.png`
|
|
)
|
|
})
|
|
})
|
|
}
|
|
)
|