mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-25 08:49:36 +00:00
test(browser): add BaseDialog class (Phase 5.2)
Amp-Thread-ID: https://ampcode.com/threads/T-019c137b-34ba-736a-afb6-0a41baf9358f Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
31
browser_tests/fixtures/components/BaseDialog.ts
Normal file
31
browser_tests/fixtures/components/BaseDialog.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
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()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user