Comfy-Org / Comfy-Org/ComfyUI_frontend
browser_tests: audit & consolidate inline page.evaluate graph helpers into shared fixtures
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 699
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 490
Description
## Summary
PR #11407 introduced two inline async helper functions in `browser_tests/tests/subgraph/subgraphCollapseDomWidgets.spec.ts`:
- `toggleSubgraphCollapse(comfyPage, nodeId)` — programmatically collapses a graph node via `page.evaluate(() => node.collapse())`
- `setVueMode(comfyPage, enabled)` — toggles the Vue nodes renderer setting and waits for the mode to take effect
Both helpers are file-local. Per the discussion in PR #11407 ([comment](https://github.com/Comfy-Org/ComfyUI_frontend/pull/11407#discussion_r3107740093)), these should be moved to shared fixtures so all browser tests can converge on a single canonical implementation.
## Scope
### Helpers to centralise
| Helper | Suggested home |
|---|---|
| `toggleSubgraphCollapse` | `browser_tests/fixtures/helpers/SubgraphHelper.ts` (as an instance method, alongside existing `findSubgraphNodeId`, `exitViaBreadcrumb`, etc.) |
| `setVueMode` | A new or existing settings/renderer helper (e.g., `ComfyPage` settings API, or a dedicated `VueNodesHelper`) |
Note: `NodeReference.toggleCollapse()` in `litegraphUtils.ts` already provides a DOM-aware collapse toggle (via Vue button or canvas click). `toggleSubgraphCollapse` is a lower-level, programmatic variant (`node.collapse()`) — the two should be reconciled or clearly differentiated in the shared helper.
### Files to audit
The following browser test files use `getNodeById`, `.collapse()`, or ad-hoc `page.evaluate` calls for node/graph operations that may duplicate what `SubgraphHelper`, `NodeReference`, or `litegraphUtils` already provide:
- `browser_tests/tests/widget.spec.ts`
- `browser_tests/tests/vueNodes/slots.spec.ts`
- `browser_tests/tests/vueNodes/widgets/imageCrop.spec.ts`
- `browser_tests/tests/vueNodes/interactions/links/linkInteraction.spec.ts`
- `browser_tests/tests/vueNodes/interactions/node/contextMenu.spec.ts`
- `browser_tests/tests/subgraph/subgraphSerialization.spec.ts`
- `browser_tests/tests/subgraph/subgraphPromotion.spec.ts`
- `browser_tests/tests/subgraph/subgraphSlots.spec.ts`
- `browser_tests/tests/subgraph/subgraphNested.spec.ts`
- `browser_tests/tests/subgraph/subgraphLifecycle.spec.ts`
- `browser_tests/tests/subgraph/subgraphNavigation.spec.ts`
- `browser_tests/tests/nodeGhostPlacement.spec.ts`
- `browser_tests/tests/load3d/load3d.spec.ts`
- `browser_tests/tests/load3d/gizmoControls.spec.ts`
- `browser_tests/tests/imageCrop.spec.ts`
- `browser_tests/tests/imageCompare.spec.ts`
- `browser_tests/tests/graph.spec.ts`
- `browser_tests/tests/groupNode.spec.ts`
- `browser_tests/tests/defaultKeybindings.spec.ts`
- `browser_tests/tests/cloud-asset-default.spec.ts`
- `browser_tests/fixtures/utils/litegraphUtils.ts`
- `browser_tests/fixtures/helpers/SubgraphHelper.ts`
- `browser_tests/fixtures/helpers/Preview3DPipelineFixture.ts`
## Acceptance criteria
- [ ] `toggleSubgraphCollapse` logic is promoted to `SubgraphHelper` (or equivalent shared fixture) and the inline copy in `subgraphCollapseDomWidgets.spec.ts` is replaced with the shared version.
- [ ] `setVueMode` logic is promoted to a shared settings/renderer helper, and the inline copy in `subgraphCollapseDomWidgets.spec.ts` is replaced.
- [ ] All files listed above are audited; duplicated or equivalent `page.evaluate` graph helpers are either removed in favour of the shared fixtures or documented with a clear reason for staying inline.
- [ ] No new test behaviour is changed — this is a refactor only.
## References
- PR: #11407
- Discussion comment: https://github.com/Comfy-Org/ComfyUI_frontend/pull/11407#discussion_r3107740093
- Requested by: @christian-byrne
┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-11435-browser_tests-audit-consolidate-inline-page-evaluate-graph-helpers-into-shared-fix-3486d73d365081839275f7b22d05f0ba) by [Unito](https://www.unito.io)
Contributor guide
Assessment
This issue has not been assessed yet.