Files
ComfyUI_frontend/browser_tests/helpers/templates.ts
snomiao 8bfb1009ce [style] migrate to @prettier/plugin-oxc for faster formatting
Replace @trivago/prettier-plugin-sort-imports with @prettier/plugin-oxc
and @ianvs/prettier-plugin-sort-imports for improved performance.

Changes:
- Add @prettier/plugin-oxc (Rust-based fast parser)
- Add @ianvs/prettier-plugin-sort-imports (import sorting compatible with oxc)
- Remove @trivago/prettier-plugin-sort-imports
- Update .prettierrc to use new plugins and compatible import order config
- Reformat all files with new plugin configuration

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-19 00:02:04 +00:00

35 lines
852 B
TypeScript

import path from 'path'
import type { Locator, Page } from '@playwright/test'
import type {
TemplateInfo,
WorkflowTemplates
} from '../../src/platform/workflow/templates/types/template'
export class ComfyTemplates {
readonly content: Locator
constructor(readonly page: Page) {
this.content = page.getByTestId('template-workflows-content')
}
async loadTemplate(id: string) {
await this.content
.getByTestId(`template-workflow-${id}`)
.getByRole('img')
.click()
}
async getAllTemplates(): Promise<TemplateInfo[]> {
const templates: WorkflowTemplates[] = await this.page.evaluate(() =>
window['app'].api.getCoreWorkflowTemplates()
)
return templates.flatMap((t) => t.templates)
}
getTemplatePath(filename: string): string {
return path.join('public', 'templates', filename)
}
}