mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +00:00
52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
import { expect } from '@playwright/test'
|
|
import type { Locator } from '@playwright/test'
|
|
|
|
export class Load3DHelper {
|
|
constructor(readonly node: Locator) {}
|
|
|
|
get canvas(): Locator {
|
|
return this.node.locator('canvas')
|
|
}
|
|
|
|
get menuButton(): Locator {
|
|
return this.node.getByRole('button', { name: /show menu/i })
|
|
}
|
|
|
|
get recordingButton(): Locator {
|
|
return this.node.getByRole('button', { name: /start recording/i })
|
|
}
|
|
|
|
get colorInput(): Locator {
|
|
return this.node.locator('input[type="color"]')
|
|
}
|
|
|
|
get openViewerButton(): Locator {
|
|
return this.node.getByRole('button', { name: /open in 3d viewer/i })
|
|
}
|
|
|
|
getUploadButton(label: string): Locator {
|
|
return this.node.getByText(label)
|
|
}
|
|
|
|
getMenuCategory(name: string): Locator {
|
|
return this.node.getByText(name, { exact: true })
|
|
}
|
|
|
|
async openMenu(): Promise<void> {
|
|
await this.menuButton.click()
|
|
}
|
|
|
|
async setBackgroundColor(hex: string): Promise<void> {
|
|
await this.colorInput.evaluate((el, value) => {
|
|
;(el as HTMLInputElement).value = value
|
|
el.dispatchEvent(new Event('input', { bubbles: true }))
|
|
}, hex)
|
|
}
|
|
|
|
async waitForModelLoaded(): Promise<void> {
|
|
await expect(this.node.getByTestId('loading-overlay')).toBeHidden({
|
|
timeout: 30000
|
|
})
|
|
}
|
|
}
|