mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-12 00:42:03 +00:00
## Summary Add Playwright e2e tests for the node replacement feature (swap nodes UI in the errors tab). ## Changes - **What**: 6 e2e test cases across two describe blocks covering single and multi-type node replacement flows. Tests verify swap nodes group visibility, in-place replacement, widget value preservation, Replace All across multiple types, output connection preservation, and success toast display. Includes typed mock data for `/api/node_replacements` and two workflow fixture files with fake missing node types mapped to real core nodes. ## Review Focus - Mock setup pattern in `setupNodeReplacement` — enables feature flag via `page.evaluate` and routes the API endpoint - Workflow fixture design — uses fake node types (E2E_OldSampler, E2E_OldUpscaler) that map to real registered types (KSampler, ImageScaleBy) - Assertion coverage for link preservation after replacement ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-11242-test-add-e2e-tests-for-node-replacement-flows-3426d73d3650811e87d7f0d96fd66433) by [Unito](https://www.unito.io) --------- Co-authored-by: Connor Byrne <c.byrne@comfy.org>
48 lines
1.6 KiB
TypeScript
48 lines
1.6 KiB
TypeScript
import type { NodeReplacementResponse } from '@/platform/nodeReplacement/types'
|
|
|
|
/**
|
|
* Mock node replacement mappings for e2e tests.
|
|
*
|
|
* Maps fake "missing" node types (E2E_OldSampler, E2E_OldUpscaler) to real
|
|
* core node types that are always available in the test server.
|
|
*/
|
|
export const mockNodeReplacements: NodeReplacementResponse = {
|
|
E2E_OldSampler: [
|
|
{
|
|
new_node_id: 'KSampler',
|
|
old_node_id: 'E2E_OldSampler',
|
|
old_widget_ids: ['seed', 'steps', 'cfg', 'sampler_name', 'scheduler'],
|
|
input_mapping: [
|
|
{ new_id: 'model', old_id: 'model' },
|
|
{ new_id: 'positive', old_id: 'positive' },
|
|
{ new_id: 'negative', old_id: 'negative' },
|
|
{ new_id: 'latent_image', old_id: 'latent_image' },
|
|
{ new_id: 'seed', old_id: 'seed' },
|
|
{ new_id: 'steps', old_id: 'steps' },
|
|
{ new_id: 'cfg', old_id: 'cfg' },
|
|
{ new_id: 'sampler_name', old_id: 'sampler_name' },
|
|
{ new_id: 'scheduler', old_id: 'scheduler' }
|
|
],
|
|
output_mapping: [{ new_idx: 0, old_idx: 0 }]
|
|
}
|
|
],
|
|
E2E_OldUpscaler: [
|
|
{
|
|
new_node_id: 'ImageScaleBy',
|
|
old_node_id: 'E2E_OldUpscaler',
|
|
old_widget_ids: ['upscale_method', 'scale_by'],
|
|
input_mapping: [
|
|
{ new_id: 'image', old_id: 'image' },
|
|
{ new_id: 'upscale_method', old_id: 'upscale_method' },
|
|
{ new_id: 'scale_by', old_id: 'scale_by' }
|
|
],
|
|
output_mapping: [{ new_idx: 0, old_idx: 0 }]
|
|
}
|
|
]
|
|
}
|
|
|
|
/** Subset containing only the E2E_OldSampler replacement. */
|
|
export const mockNodeReplacementsSingle: NodeReplacementResponse = {
|
|
E2E_OldSampler: mockNodeReplacements.E2E_OldSampler
|
|
}
|