Comfy-Org / Comfy-Org/ComfyUI_frontend
refactor(browser-tests): encapsulate collapsed-node drag as a Page Object method
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 699
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 490
Description
## Summary
In `browser_tests/tests/collapsedNodeLinks.spec.ts` (introduced in PR #10641), the "links follow collapsed node after drag" test performs inline low-level mouse operations to drag a collapsed node:
```typescript
const box = await node.boundingBox()
expect(box).not.toBeNull()
await comfyPage.page.mouse.move(box!.x + box!.width / 2, box!.y + box!.height / 2)
await comfyPage.page.mouse.down()
await comfyPage.page.mouse.move(
box!.x + box!.width / 2 + 200,
box!.y + box!.height / 2 + 100,
{ steps: 10 }
)
await comfyPage.page.mouse.up()
```
This pattern should be encapsulated in a Page Object (e.g., a `drag(offsetX, offsetY)` or `dragTo(x, y)` method on the node fixture/locator wrapper) so it can be reused across tests without repeating low-level mouse mechanics.
## Suggested approach
Add a `dragBy(offsetX: number, offsetY: number, steps?: number)` (or similar) method to the appropriate node fixture or Page Object class (e.g., `VueNodeFixture` or its equivalent in `browser_tests/fixtures/`) that:
1. Computes the node's bounding box center.
2. Moves the mouse to that center.
3. Presses and holds the mouse button.
4. Moves to the target offset position.
5. Releases the mouse button.
Tests can then call `await node.dragBy(200, 100)` instead of repeating the low-level sequence.
## References
- PR: https://github.com/Comfy-Org/ComfyUI_frontend/pull/10641
- Comment: https://github.com/Comfy-Org/ComfyUI_frontend/pull/10641#discussion_r3012062584
- Requested by: @DrJKL
┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-10757-refactor-browser-tests-encapsulate-collapsed-node-drag-as-a-Page-Object-method-3336d73d365081f1b6d2c5661be43c03) by [Unito](https://www.unito.io)
Contributor guide
Assessment
This issue has not been assessed yet.