mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-19 22:09:37 +00:00
*PR Created by the Glary-Bot Agent* --- ## Summary - Convert ~120 getter-based locators across 18 browser test fixture files to `public readonly` constructor-assigned properties - Removes unnecessary indirection, makes object shape explicit, and improves IDE auto-complete / type inference - Keeps lazy-init getters (`??=`), computed properties, and `private get page()` convenience accessors as getters ## Changes **`browser_tests/fixtures/components/`** (6 files): `ComfyNodeSearchBox`, `ContextMenu`, `SettingDialog`, `SignInDialog`, `SidebarTab` (all 6 classes), `Topbar` **`browser_tests/fixtures/`** (4 files): `ComfyPage` (ComfyMenu.buttons, ComfyPage.visibleToasts), `UserSelectPage`, `ComfyMouse`, `VueNodeHelpers` **`browser_tests/fixtures/helpers/`** (7 files): `AppModeHelper`, `BuilderFooterHelper`, `BuilderSaveAsHelper`, `BuilderSelectHelper`, `BuilderStepsHelper`, `ToastHelper`, `NodeOperationsHelper` **`browser_tests/fixtures/utils/`** (1 file): `vueNodeFixtures` ## Validation - `pnpm typecheck` ✅ - `pnpm typecheck:browser` ✅ - `pnpm exec eslint browser_tests/fixtures/` ✅ - All pre-commit hooks pass (oxfmt, oxlint, eslint, typecheck, typecheck:browser) ✅ - No visual/manual verification needed — changes are test fixture locator declarations only (no UI or runtime behavior change) Fixes #11131 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-11135-refactor-standardize-Page-Object-locators-as-public-readonly-instead-of-getters-33e6d73d3650819690cbc639f3d30daf) by [Unito](https://www.unito.io) --------- Co-authored-by: Glary-Bot <glary-bot@users.noreply.github.com>
58 lines
1.7 KiB
TypeScript
58 lines
1.7 KiB
TypeScript
import type { Locator, Page } from '@playwright/test'
|
|
|
|
import type { ComfyPage } from '@e2e/fixtures/ComfyPage'
|
|
import { TestIds } from '@e2e/fixtures/selectors'
|
|
import { BaseDialog } from '@e2e/fixtures/components/BaseDialog'
|
|
|
|
export class SettingDialog extends BaseDialog {
|
|
public readonly searchBox: Locator
|
|
public readonly categories: Locator
|
|
public readonly contentArea: Locator
|
|
|
|
constructor(
|
|
page: Page,
|
|
public readonly comfyPage: ComfyPage
|
|
) {
|
|
super(page, TestIds.dialogs.settings)
|
|
this.searchBox = this.root.getByPlaceholder(/Search/)
|
|
this.categories = this.root.locator('nav').getByRole('button')
|
|
this.contentArea = this.root.getByRole('main')
|
|
}
|
|
|
|
async open() {
|
|
await this.comfyPage.command.executeCommand('Comfy.ShowSettingsDialog')
|
|
await this.waitForVisible()
|
|
}
|
|
|
|
/**
|
|
* Set the value of a text setting
|
|
* @param id - The id of the setting
|
|
* @param value - The value to set
|
|
*/
|
|
async setStringSetting(id: string, value: string) {
|
|
const settingInputDiv = this.root.locator(`div[id="${id}"]`)
|
|
await settingInputDiv.locator('input').fill(value)
|
|
}
|
|
|
|
/**
|
|
* Toggle the value of a boolean setting
|
|
* @param id - The id of the setting
|
|
*/
|
|
async toggleBooleanSetting(id: string) {
|
|
const settingInputDiv = this.root.locator(`div[id="${id}"]`)
|
|
await settingInputDiv.locator('input').click()
|
|
}
|
|
|
|
category(name: string) {
|
|
return this.root.locator('nav').getByRole('button', { name })
|
|
}
|
|
|
|
async goToAboutPanel() {
|
|
const aboutButton = this.root.locator('nav').getByRole('button', {
|
|
name: 'About'
|
|
})
|
|
await aboutButton.click()
|
|
await this.page.waitForSelector('.about-container')
|
|
}
|
|
}
|