mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-21 21:09:00 +00:00
test: add e2e coverage for primitive combo refresh
Adds an E2E test that loads a Primitive wired to KSampler.sampler_name, presses 'r' (Refresh Node Definitions), and asserts the primitive's combo options stay a non-empty array containing the connected input's values. Reproduces the regression this PR fixes — before the fix, the options array was clobbered with undefined.
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"last_node_id": 2,
|
||||
"last_link_id": 1,
|
||||
"nodes": [
|
||||
{
|
||||
"id": 2,
|
||||
"type": "KSampler",
|
||||
"pos": [521, 41],
|
||||
"size": [315, 262],
|
||||
"flags": {},
|
||||
"order": 1,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{ "name": "model", "type": "MODEL", "link": null },
|
||||
{ "name": "positive", "type": "CONDITIONING", "link": null },
|
||||
{ "name": "negative", "type": "CONDITIONING", "link": null },
|
||||
{ "name": "latent_image", "type": "LATENT", "link": null },
|
||||
{
|
||||
"name": "sampler_name",
|
||||
"type": "COMBO",
|
||||
"link": 1,
|
||||
"widget": { "name": "sampler_name" }
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{ "name": "LATENT", "type": "LATENT", "links": null, "shape": 3 }
|
||||
],
|
||||
"properties": { "Node name for S&R": "KSampler" },
|
||||
"widgets_values": [0, "randomize", 20, 8, "euler", "normal", 1]
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"type": "PrimitiveNode",
|
||||
"pos": [15, 46],
|
||||
"size": [400, 110],
|
||||
"flags": {},
|
||||
"order": 0,
|
||||
"mode": 0,
|
||||
"inputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "COMBO",
|
||||
"type": "COMBO",
|
||||
"links": [1],
|
||||
"slot_index": 0,
|
||||
"widget": { "name": "sampler_name" }
|
||||
}
|
||||
],
|
||||
"properties": { "Run widget replace on values": false },
|
||||
"widgets_values": ["euler", "fixed"]
|
||||
}
|
||||
],
|
||||
"links": [[1, 1, 0, 2, 4, "COMBO"]],
|
||||
"groups": [],
|
||||
"config": {},
|
||||
"extra": { "ds": { "scale": 1, "offset": [0, 0] } },
|
||||
"version": 0.4
|
||||
}
|
||||
@@ -59,6 +59,54 @@ test.describe('Primitive Node', { tag: ['@screenshot', '@node'] }, () => {
|
||||
)
|
||||
})
|
||||
|
||||
test('Preserves combo options on the primitive after pressing R to refresh', async ({
|
||||
comfyPage
|
||||
}) => {
|
||||
const getPrimitiveComboState = async () =>
|
||||
comfyPage.page.evaluate(() => {
|
||||
const primitive = window.app!.graph!.nodes.find(
|
||||
(node) => node.type === 'PrimitiveNode'
|
||||
)
|
||||
const widget = primitive?.widgets?.[0]
|
||||
const values = widget?.options?.values
|
||||
return {
|
||||
isArray: Array.isArray(values),
|
||||
length: Array.isArray(values) ? values.length : 0,
|
||||
includesEuler: Array.isArray(values)
|
||||
? values.includes('euler')
|
||||
: false,
|
||||
value: widget?.value
|
||||
}
|
||||
})
|
||||
|
||||
await comfyPage.workflow.loadWorkflow(
|
||||
'primitive/primitive_combo_sampler_name'
|
||||
)
|
||||
|
||||
await expect
|
||||
.poll(() => getPrimitiveComboState())
|
||||
.toMatchObject({
|
||||
isArray: true,
|
||||
includesEuler: true,
|
||||
value: 'euler'
|
||||
})
|
||||
const before = await getPrimitiveComboState()
|
||||
expect(before.length).toBeGreaterThan(0)
|
||||
|
||||
await comfyPage.canvas.click()
|
||||
await comfyPage.page.keyboard.press('r')
|
||||
|
||||
await expect
|
||||
.poll(() => getPrimitiveComboState())
|
||||
.toMatchObject({
|
||||
isArray: true,
|
||||
includesEuler: true,
|
||||
value: 'euler'
|
||||
})
|
||||
const after = await getPrimitiveComboState()
|
||||
expect(after.length).toBeGreaterThan(0)
|
||||
})
|
||||
|
||||
test('Report missing nodes when connect to missing node', async ({
|
||||
comfyPage
|
||||
}) => {
|
||||
|
||||
Reference in New Issue
Block a user