mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-24 16:54:03 +00:00
Per Playwright best practices, assertions belong in tests, not fixtures.
Fixture methods should use waitFor() for preconditions instead.
- vueNodeFixtures.ts: setTitle(), cancelTitleEdit() use waitFor()
- Topbar.ts: closeTopbarMenu() uses waitFor({ state: 'hidden' })
- ComfyPage.ts: ConfirmDialog.click(), closeDialog(), clickDialogButton(),
closeToasts() all converted to waitFor()
- templates.ts: renamed waitForMinimumCardCount to expectMinimumCardCount
to clarify it contains an assertion (uses expect().toPass() pattern)
Amp-Thread-ID: https://ampcode.com/threads/T-019c11f8-acd2-7429-8bec-525ad47a47c4
Co-authored-by: Amp <amp@ampcode.com>
66 lines
1.6 KiB
TypeScript
66 lines
1.6 KiB
TypeScript
import type { Locator } from '@playwright/test'
|
|
|
|
/** DOM-centric helper for a single Vue-rendered node on the canvas. */
|
|
export class VueNodeFixture {
|
|
constructor(private readonly locator: Locator) {}
|
|
|
|
get header(): Locator {
|
|
return this.locator.locator('[data-testid^="node-header-"]')
|
|
}
|
|
|
|
get title(): Locator {
|
|
return this.locator.locator('[data-testid="node-title"]')
|
|
}
|
|
|
|
get titleInput(): Locator {
|
|
return this.locator.locator('[data-testid="node-title-input"]')
|
|
}
|
|
|
|
get body(): Locator {
|
|
return this.locator.locator('[data-testid^="node-body-"]')
|
|
}
|
|
|
|
get collapseButton(): Locator {
|
|
return this.locator.locator('[data-testid="node-collapse-button"]')
|
|
}
|
|
|
|
get collapseIcon(): Locator {
|
|
return this.collapseButton.locator('i')
|
|
}
|
|
|
|
get root(): Locator {
|
|
return this.locator
|
|
}
|
|
|
|
async getTitle(): Promise<string> {
|
|
return (await this.title.textContent()) ?? ''
|
|
}
|
|
|
|
async setTitle(value: string): Promise<void> {
|
|
await this.header.dblclick()
|
|
const input = this.titleInput
|
|
await input.waitFor({ state: 'visible' })
|
|
await input.fill(value)
|
|
await input.press('Enter')
|
|
}
|
|
|
|
async cancelTitleEdit(): Promise<void> {
|
|
await this.header.dblclick()
|
|
const input = this.titleInput
|
|
await input.waitFor({ state: 'visible' })
|
|
await input.press('Escape')
|
|
}
|
|
|
|
async toggleCollapse(): Promise<void> {
|
|
await this.collapseButton.click()
|
|
}
|
|
|
|
async getCollapseIconClass(): Promise<string> {
|
|
return (await this.collapseIcon.getAttribute('class')) ?? ''
|
|
}
|
|
|
|
boundingBox(): ReturnType<Locator['boundingBox']> {
|
|
return this.locator.boundingBox()
|
|
}
|
|
}
|