mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-21 14:59:39 +00:00
- Add pinIndicator, innerWrapper, titleEditorInput, mainImage to TestIds.node - Add pinIndicator getter to VueNodeFixture - Add data-testid to TitleEditor overlay via input-attrs - Replace .lg-node-header with [data-testid^="node-header-"] - Replace .p-contextmenu with comfyPage.contextMenu.primeVueMenu - Replace .node-title-editor input with getByTestId(TestIds.node.titleEditorInput) - Replace hardcoded PIN_INDICATOR with TestIds.node.pinIndicator - Replace .image-preview img with TestIds.node.mainImage - Use NodeLibrarySidebarTab fixture for node library interaction Fixes #10750 Fixes #10749
72 lines
1.7 KiB
TypeScript
72 lines
1.7 KiB
TypeScript
import type { Locator } from '@playwright/test'
|
|
|
|
import { TestIds } from '../selectors'
|
|
|
|
/** 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 pinIndicator(): Locator {
|
|
return this.locator.getByTestId(TestIds.node.pinIndicator)
|
|
}
|
|
|
|
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()
|
|
}
|
|
}
|