mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-03 14:54:37 +00:00
Amp-Thread-ID: https://ampcode.com/threads/T-019c137b-34ba-736a-afb6-0a41baf9358f Co-authored-by: Amp <amp@ampcode.com>
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import type { Page } from '@playwright/test'
|
|
|
|
export class ContextMenu {
|
|
constructor(public readonly page: Page) {}
|
|
|
|
get primeVueMenu() {
|
|
return this.page.locator('.p-contextmenu, .p-menu')
|
|
}
|
|
|
|
get litegraphMenu() {
|
|
return this.page.locator('.litemenu')
|
|
}
|
|
|
|
get menuItems() {
|
|
return this.page.locator('.p-menuitem, .litemenu-entry')
|
|
}
|
|
|
|
async clickMenuItem(name: string): Promise<void> {
|
|
await this.page.getByRole('menuitem', { name }).click()
|
|
}
|
|
|
|
async clickLitegraphMenuItem(name: string): Promise<void> {
|
|
await this.page.locator(`.litemenu-entry:has-text("${name}")`).click()
|
|
}
|
|
|
|
async isVisible(): Promise<boolean> {
|
|
const primeVueVisible = await this.primeVueMenu
|
|
.isVisible()
|
|
.catch(() => false)
|
|
const litegraphVisible = await this.litegraphMenu
|
|
.isVisible()
|
|
.catch(() => false)
|
|
return primeVueVisible || litegraphVisible
|
|
}
|
|
|
|
async waitForHidden(): Promise<void> {
|
|
await Promise.all([
|
|
this.primeVueMenu.waitFor({ state: 'hidden' }).catch(() => {}),
|
|
this.litegraphMenu.waitFor({ state: 'hidden' }).catch(() => {})
|
|
])
|
|
}
|
|
}
|