Files
ComfyUI_frontend/browser_tests/fixtures/helpers/UserDataHelper.ts
pythongosssss 0052cdadd4 test: e2e coverage for node templates (#11564)
## Summary

Add E2E tests for node templates

## Changes

- **What**: 
- add tests for save, insert, delete, import export
- vue and litegraph
- add testid to dialog
- update `clickLitegraphMenuItem` to enable clicking children with the
same name as parent

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-11564-test-e2e-coverage-for-node-templates-34b6d73d365081a39ce5c713f05a2a92)
by [Unito](https://www.unito.io)
2026-04-23 19:33:18 +00:00

27 lines
878 B
TypeScript

import type { APIRequestContext } from '@playwright/test'
/**
* Interact with the ComfyUI per-user storage (`/api/userdata/...`) from
* outside the browser context. Useful for test setup/teardown that needs
* to reset server-persisted state (node templates, keybinding presets, etc.)
* without reloading the app.
*/
export class UserDataHelper {
constructor(
private readonly request: APIRequestContext,
private readonly userId: string,
private readonly baseUrl: string
) {}
async delete(file: string): Promise<void> {
const res = await this.request.fetch(
`${this.baseUrl}/api/userdata/${encodeURIComponent(file)}`,
{ method: 'DELETE', headers: { 'Comfy-User': this.userId } }
)
if (!res.ok() && res.status() !== 404)
throw new Error(
`Failed to delete userdata file "${file}": HTTP ${res.status()}`
)
}
}