mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-07 16:40:05 +00:00
Amp-Thread-ID: https://ampcode.com/threads/T-019c137b-34ba-736a-afb6-0a41baf9358f Co-authored-by: Amp <amp@ampcode.com>
32 lines
752 B
TypeScript
32 lines
752 B
TypeScript
import type { Locator, Page } from '@playwright/test'
|
|
|
|
export class BaseDialog {
|
|
readonly root: Locator
|
|
readonly closeButton: Locator
|
|
|
|
constructor(
|
|
public readonly page: Page,
|
|
testId?: string
|
|
) {
|
|
this.root = testId ? page.getByTestId(testId) : page.locator('.p-dialog')
|
|
this.closeButton = this.root.locator('.p-dialog-close-button')
|
|
}
|
|
|
|
async isVisible(): Promise<boolean> {
|
|
return this.root.isVisible()
|
|
}
|
|
|
|
async waitForVisible(): Promise<void> {
|
|
await this.root.waitFor({ state: 'visible' })
|
|
}
|
|
|
|
async waitForHidden(): Promise<void> {
|
|
await this.root.waitFor({ state: 'hidden' })
|
|
}
|
|
|
|
async close(): Promise<void> {
|
|
await this.closeButton.click({ force: true })
|
|
await this.waitForHidden()
|
|
}
|
|
}
|