test: distinguish persisted color from declared default

The workflow asset previously persisted the same value (#00ff00) as the
declared default, so the restore-from-workflow test would pass even if
load regressed and the widget silently fell back to the default. Use a
distinct persisted value (#ff00ff) so the test actually exercises
deserialization.

Tighten the AGENTS.md DevTools guidance to recommend the searchBox-based
add flow over programmatic nodeOps.addNode for tests where adding is
itself the behaviour under test.
This commit is contained in:
Glary-Bot
2026-05-20 20:01:00 +00:00
parent 23964e68a3
commit f4da9a91ac
3 changed files with 4 additions and 3 deletions

View File

@@ -127,7 +127,7 @@ Reserve `toPass()` for blocks with multiple assertions or complex async logic th
When a test needs a node, input shape, or backend behavior that no production node exposes, prefer **adding a node to `tools/devtools/nodes/`** over intercepting `/object_info` from the test.
- Add the new class to the appropriate file (e.g. `inputs.py` for input-shape variants), register it in that file's `NODE_CLASS_MAPPINGS` / `NODE_DISPLAY_NAME_MAPPINGS` with a `DevTools` prefix, and re-export it through `nodes/__init__.py` and `dev_nodes.py`.
- In the spec, create the node via `comfyPage.nodeOps.addNode('DevToolsYourNode')` and assert against the rendered widget (see `vueNodes/widgets/legacy.spec.ts` and `vueNodes/widgets/color/colorWidget.spec.ts`).
- In the spec, prefer real user actions for adding the node: `await comfyPage.page.mouse.dblclick(...)` then `comfyPage.searchBox.fillAndSelectFirstNode('Node Display Name')` (see `vueNodes/widgets/color/colorWidget.spec.ts`). Reach for `comfyPage.nodeOps.addNode(...)` only when the test is not specifically about the add flow and a programmatic shortcut keeps the test focused (e.g. `vueNodes/widgets/legacy.spec.ts`).
- Reserve `page.route(/\/object_info$/, ...)` for cases where the test needs to mutate an existing production node's shape mid-flight (e.g. `propertiesPanel/errorsTabMissingModels.spec.ts`).
Devtools nodes are loaded automatically into the test ComfyUI instance, so no fixture wiring is required.

View File

@@ -17,7 +17,7 @@
"properties": {
"Node name for S&R": "DevToolsNodeWithColorInput"
},
"widgets_values": ["#00ff00"]
"widgets_values": ["#ff00ff"]
}
],
"links": [],

View File

@@ -5,6 +5,7 @@ import {
const COLOR_NODE_DISPLAY_NAME = 'Node With Color Input'
const DECLARED_DEFAULT = '#00ff00'
const PERSISTED_VALUE = '#ff00ff'
test.describe('Vue Color Widget defaults', { tag: '@vue-nodes' }, () => {
test('respects the declared default value in the input spec', async ({
@@ -28,7 +29,7 @@ test.describe('Vue Color Widget defaults', { tag: '@vue-nodes' }, () => {
const node = comfyPage.vueNodes.getNodeByTitle(COLOR_NODE_DISPLAY_NAME)
const colorTrigger = node.getByRole('button', {
name: new RegExp(DECLARED_DEFAULT, 'i')
name: new RegExp(PERSISTED_VALUE, 'i')
})
await expect(colorTrigger).toBeVisible()