Comfy-Org / Comfy-Org/ComfyUI_frontend

Refactor subgraph E2E tests to use Page Object pattern for node/widget locators

Open
#12,222 1 comment 1 reaction 1 assignee Claimed by @DrJKL View on GitHub
area:subgraph area:testing developer experience
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

## Summary

Currently, subgraph E2E tests set up locators directly at the top of each test using raw node IDs (e.g., `comfyPage.vueNodes.getNodeLocator('2')`) and widget names (e.g., `comfyPage.vueNodes.getWidgetByName('New Subgraph', 'steps')`). This mixes contracts (ID vs. name) and obscures the relationship between nodes and their widgets.

## Desired Change

Introduce a proper Page Object pattern so locators chain off of node objects, for example:

```ts
const subgraphNode = comfyPage.getNode({ name: 'New Subgraph' })
const steps = subgraphNode.getWidget({ name: 'steps' })
const cfg = subgraphNode.getWidget({ name: 'cfg' })
```

This would:
- Remove the need to pass raw numeric IDs alongside human-readable names in the same test.
- Make the node↔widget relationship explicit and discoverable.
- Reduce boilerplate at the top of tests.

## Context

Raised during review of PR #11806 (add subgraph fixtures and tests). The change was acknowledged as the right direction but deferred as out of scope for that PR.

**PR:** https://github.com/Comfy-Org/ComfyUI_frontend/pull/11806
**Comment:** https://github.com/Comfy-Org/ComfyUI_frontend/pull/11806#discussion_r3224053011

Requested by @DrJKL.

┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-12222-Refactor-subgraph-E2E-tests-to-use-Page-Object-pattern-for-node-widget-locators-35f6d73d365081bab6c1d1984f98d5cd) by [Unito](https://www.unito.io)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.