Comfy-Org / Comfy-Org/ComfyUI_frontend

refactor: extract shared Playwright route-stubbing utilities into scripts/browser_tests/routeTestUtils.ts

Open
#11,204 0 comments 0 reactions 1 assignee Claimed by @benceruleanlu View on GitHub
area:testing developer experience
Dominant language
TypeScript
Stars
2k
Forks
702
Avg merge
1d 8h
Merged PRs (30d)
512

Description

## Summary

`scripts/browser_tests/AssetScenarioHelper.test.ts` and `scripts/browser_tests/InMemoryJobsBackend.test.ts` share approximately 80 lines of identical test plumbing that should be extracted into a shared module to avoid duplication and improve maintainability.

## Duplicated symbols to extract

- Types: `RouteHandler`, `RegisteredRoute`, `PageStub`, `FulfillOptions`
- Functions: `createPageStub`, `createRouteInvocation`, `bodyToText`, `invokeJsonRoute`

## Proposed solution

Create `scripts/browser_tests/routeTestUtils.ts` containing the shared utilities, then update both test files to import from that module instead of duplicating the definitions.

## References

- PR: https://github.com/Comfy-Org/ComfyUI_frontend/pull/10630
- Review comment: https://github.com/Comfy-Org/ComfyUI_frontend/pull/10630#discussion_r3076182887
- Requested by: @DrJKL

┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-11204-refactor-extract-shared-Playwright-route-stubbing-utilities-into-scripts-browser_tes-3416d73d36508108a12cf6f8e5303d9e) 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.