mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-19 22:09:37 +00:00
test: resolve painter clear viewport timeout and harden triggerSerialization
- Replaces forced click bypass on painter clear button with native dispatchEvent to fix out-of-viewport timeouts - Hardens triggerSerialization helper with explicit object existence checks and concrete error messages
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import type { Locator, Page } from '@playwright/test'
|
||||
import type { TestGraphAccess } from '../types/globals'
|
||||
import type { TestGraphAccess } from '@e2e/types/globals'
|
||||
|
||||
export async function drawStroke(
|
||||
page: Page,
|
||||
@@ -36,12 +36,31 @@ export async function hasCanvasContent(canvas: Locator): Promise<boolean> {
|
||||
|
||||
export async function triggerSerialization(page: Page): Promise<void> {
|
||||
await page.evaluate(async () => {
|
||||
const graph = window.graph! as TestGraphAccess
|
||||
const node = graph._nodes_by_id['1']
|
||||
const widget = node.widgets?.find((w) => w.name === 'mask')
|
||||
if (!widget?.serializeValue) {
|
||||
throw new Error('mask widget with serializeValue not found on node 1')
|
||||
const graph = window.graph as TestGraphAccess | undefined
|
||||
if (!graph) {
|
||||
throw new Error(
|
||||
'Global window.graph is absent. Ensure workflow fixture is loaded.'
|
||||
)
|
||||
}
|
||||
|
||||
const node = graph._nodes_by_id?.['1']
|
||||
if (!node) {
|
||||
throw new Error(
|
||||
'Target node with ID "1" not found in graph._nodes_by_id.'
|
||||
)
|
||||
}
|
||||
|
||||
const widget = node.widgets?.find((w) => w.name === 'mask')
|
||||
if (!widget) {
|
||||
throw new Error('Widget "mask" not found on target node 1.')
|
||||
}
|
||||
|
||||
if (typeof widget.serializeValue !== 'function') {
|
||||
throw new Error(
|
||||
'mask widget on node 1 does not have a serializeValue function.'
|
||||
)
|
||||
}
|
||||
|
||||
await widget.serializeValue(node, 0)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ test.describe('Painter', { tag: '@widget' }, () => {
|
||||
.toBe(true)
|
||||
|
||||
const clearButton = painterWidget.getByTestId('painter-clear-button')
|
||||
await clearButton.click({ force: true })
|
||||
await clearButton.dispatchEvent('click')
|
||||
|
||||
await expect
|
||||
.poll(() => hasCanvasContent(canvas), {
|
||||
|
||||
Reference in New Issue
Block a user