mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +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>
67 lines
2.4 KiB
TypeScript
67 lines
2.4 KiB
TypeScript
import type { Locator, Page } from '@playwright/test'
|
|
|
|
import type { ComfyPage } from '@e2e/fixtures/ComfyPage'
|
|
|
|
export class BuilderSaveAsHelper {
|
|
/** The save-as dialog (scoped by aria-labelledby). */
|
|
public readonly dialog: Locator
|
|
/** The post-save success dialog (scoped by aria-labelledby). */
|
|
public readonly successDialog: Locator
|
|
public readonly title: Locator
|
|
public readonly radioGroup: Locator
|
|
public readonly nameInput: Locator
|
|
public readonly saveButton: Locator
|
|
public readonly successMessage: Locator
|
|
public readonly viewAppButton: Locator
|
|
public readonly closeButton: Locator
|
|
/** The X button to dismiss the success dialog without any action. */
|
|
public readonly dismissButton: Locator
|
|
public readonly exitBuilderButton: Locator
|
|
public readonly overwriteDialog: Locator
|
|
public readonly overwriteButton: Locator
|
|
|
|
constructor(private readonly comfyPage: ComfyPage) {
|
|
this.dialog = this.page.locator('[aria-labelledby="builder-save"]')
|
|
this.successDialog = this.page.locator(
|
|
'[aria-labelledby="builder-save-success"]'
|
|
)
|
|
this.title = this.dialog.getByText('Save as')
|
|
this.radioGroup = this.dialog.getByRole('radiogroup')
|
|
this.nameInput = this.dialog.getByRole('textbox')
|
|
this.saveButton = this.dialog.getByRole('button', { name: 'Save' })
|
|
this.successMessage = this.successDialog.getByText('Successfully saved')
|
|
this.viewAppButton = this.successDialog.getByRole('button', {
|
|
name: 'View app'
|
|
})
|
|
this.closeButton = this.successDialog
|
|
.getByRole('button', { name: 'Close', exact: true })
|
|
.filter({ hasText: 'Close' })
|
|
this.dismissButton = this.successDialog.locator(
|
|
'button.p-dialog-close-button'
|
|
)
|
|
this.exitBuilderButton = this.successDialog.getByRole('button', {
|
|
name: 'Exit builder'
|
|
})
|
|
this.overwriteDialog = this.page.getByRole('dialog', {
|
|
name: 'Overwrite existing file?'
|
|
})
|
|
this.overwriteButton = this.overwriteDialog.getByRole('button', {
|
|
name: 'Overwrite'
|
|
})
|
|
}
|
|
|
|
private get page(): Page {
|
|
return this.comfyPage.page
|
|
}
|
|
|
|
viewTypeRadio(viewType: 'App' | 'Node graph'): Locator {
|
|
return this.dialog.getByRole('radio', { name: viewType })
|
|
}
|
|
|
|
async fillAndSave(workflowName: string, viewType: 'App' | 'Node graph') {
|
|
await this.nameInput.fill(workflowName)
|
|
await this.viewTypeRadio(viewType).click()
|
|
await this.saveButton.click()
|
|
}
|
|
}
|