mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-19 03:49:33 +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)
28 lines
930 B
TypeScript
28 lines
930 B
TypeScript
import type { Locator, Page } from '@playwright/test'
|
|
|
|
import { BaseDialog } from '@e2e/fixtures/components/BaseDialog'
|
|
import { TestIds } from '@e2e/fixtures/selectors'
|
|
|
|
export class NodeTemplatesManageDialog extends BaseDialog {
|
|
public readonly rows: Locator
|
|
/**
|
|
* Hidden `<input type="file">` used by the Import button. Attached to
|
|
* `document.body` (not inside the dialog) by the legacy extension, so it
|
|
* cannot be scoped via `this.root`.
|
|
*/
|
|
public readonly importInput: Locator
|
|
|
|
constructor(page: Page) {
|
|
super(page, TestIds.nodeTemplates.manageDialog)
|
|
this.rows = this.root.locator('.templateManagerRow')
|
|
this.importInput = page.locator('input[type="file"][accept=".json"]')
|
|
}
|
|
|
|
rowByName(name: string): Locator {
|
|
const escaped = name.replace(/\\/g, '\\\\').replace(/"/g, '\\"')
|
|
return this.rows.filter({
|
|
has: this.page.locator(`input[data-name="${escaped}"]`)
|
|
})
|
|
}
|
|
}
|