mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-22 05:19:03 +00:00
## 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)
27 lines
878 B
TypeScript
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()}`
|
|
)
|
|
}
|
|
}
|