mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-02 06:19:58 +00:00
Phase 2 of ComfyPage refactor: - Add ToastHelper, DragDropHelper, CommandHelper instances to ComfyPage - Remove migrated methods from ComfyPage (command, toast, dragDrop, workflow, canvasOps, nodeOps methods) - Update all test files to use new helper paths - Keep visibleToasts as passthrough getter for backward compatibility Amp-Thread-ID: https://ampcode.com/threads/T-019c1666-ed27-773c-976a-07cc805d7a6c Co-authored-by: Amp <amp@ampcode.com>
50 lines
1.3 KiB
TypeScript
50 lines
1.3 KiB
TypeScript
import type { Page } from '@playwright/test'
|
|
|
|
import type { ComfyPage } from '../ComfyPage'
|
|
import { TestIds } from '../selectors'
|
|
import { BaseDialog } from './BaseDialog'
|
|
|
|
export class SettingDialog extends BaseDialog {
|
|
constructor(
|
|
page: Page,
|
|
public readonly comfyPage: ComfyPage
|
|
) {
|
|
super(page, TestIds.dialogs.settings)
|
|
}
|
|
|
|
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.page.locator(
|
|
`div.settings-container 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.page.locator(
|
|
`div.settings-container div[id="${id}"]`
|
|
)
|
|
await settingInputDiv.locator('input').click()
|
|
}
|
|
|
|
async goToAboutPanel() {
|
|
await this.page.getByTestId('settings-tab-about').click()
|
|
await this.page
|
|
.getByTestId(TestIds.dialogs.about)
|
|
.waitFor({ state: 'visible' })
|
|
}
|
|
}
|