mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-24 14:45:36 +00:00
## Summary Extract shared TitleEditor component and update tests to use it ## Changes - **What**: - add title editor helper - update locations that used `TestIds.node.titleInput` ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-11605-test-extract-title-editor-test-component-34c6d73d3650811da6b0ec493b190c3f) by [Unito](https://www.unito.io)
34 lines
844 B
TypeScript
34 lines
844 B
TypeScript
import type { Locator, Page } from '@playwright/test'
|
|
import { expect } from '@playwright/test'
|
|
|
|
import { TestIds } from '@e2e/fixtures/selectors'
|
|
|
|
/**
|
|
* The node/group title-editing input. Rendered in three scopes: the canvas
|
|
* overlay (page-wide), the properties panel, and the Vue node itself.
|
|
*/
|
|
export class TitleEditor {
|
|
public readonly input: Locator
|
|
|
|
constructor(scope: Page | Locator) {
|
|
this.input = scope.getByTestId(TestIds.node.titleInput)
|
|
}
|
|
|
|
async setTitle(title: string): Promise<void> {
|
|
await this.input.fill(title)
|
|
await this.input.press('Enter')
|
|
}
|
|
|
|
async cancel(): Promise<void> {
|
|
await this.input.press('Escape')
|
|
}
|
|
|
|
async expectVisible(): Promise<void> {
|
|
await expect(this.input).toBeVisible()
|
|
}
|
|
|
|
async expectHidden(): Promise<void> {
|
|
await expect(this.input).toBeHidden()
|
|
}
|
|
}
|