Comfy-Org / Comfy-Org/ComfyUI_frontend

refactor: migrate inline panToNode canvas panning logic to NodeOperationsHelper.panToNode()

Open
#11,200 0 comments 0 reactions 1 assignee Claimed by @dante01yoon View on GitHub
area:testing developer experience
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

## Summary

PR #10968 extracted the repeated canvas-panning pattern into `NodeOperationsHelper.panToNode()` in `browser_tests/fixtures/helpers/NodeOperationsHelper.ts`. Several existing test files still inline the same logic and should be migrated to call the shared utility instead.

## Locations to migrate

The following files contain the duplicated inline pattern:
```ts
canvas.ds.offset[0] = -pos.x + canvas.canvas.width / 2
canvas.ds.offset[1] = -pos.y + canvas.canvas.height / 2 + 100
canvas.setDirty(true, true)
```

1. `browser_tests/tests/selectionToolboxActions.spec.ts` (~line 21–26)
2. `browser_tests/tests/nodeHelp.spec.ts` (~line 16–21)

Please also audit `browser_tests/tests/selectionToolboxMoreActions.spec.ts` (added in PR #10968) for any local helper functions that inline the same pattern and should delegate to `comfyPage.nodeOps.panToNode()` (or whichever accessor exposes `NodeOperationsHelper`).

## Action

Replace each inline occurrence with a call to `NodeOperationsHelper.panToNode(nodeRef)` (available via `comfyPage`'s node ops helper) to remove duplication and ensure consistent panning behaviour across all E2E tests.

## References
- PR introducing the utility: https://github.com/Comfy-Org/ComfyUI_frontend/pull/10968
- Comment requesting this issue: https://github.com/Comfy-Org/ComfyUI_frontend/pull/10968#discussion_r3075880863
- Requested by: @DrJKL

┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-11200-refactor-migrate-inline-panToNode-canvas-panning-logic-to-NodeOperationsHelper-panTo-3416d73d3650812d8d93dcb30b54662b) 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.