mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-04 05:02:17 +00:00
test: add basic E2E tests for Load3D node (#10731)
## Summary Add Playwright tests covering widget rendering, controls menu interaction, background color change, and recording controls visibility. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-10731-test-add-basic-E2E-tests-for-Load3D-node-3336d73d36508194bff9eb2a7c9356b9) by [Unito](https://www.unito.io)
This commit is contained in:
40
browser_tests/tests/load3d/Load3DHelper.ts
Normal file
40
browser_tests/tests/load3d/Load3DHelper.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
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"]')
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user