mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-01 11:10:00 +00:00
- Revert extensionManager type from WorkspaceStore to ExtensionManager - Remove WorkspaceStore export from workspaceStore.ts - Add WorkspaceStore type to browser_tests/types/globals.d.ts - Update browser tests to use specific 'as WorkspaceStore' casts - Consolidate Window augmentation into single globals.d.ts file Amp-Thread-ID: https://ampcode.com/threads/T-019c1854-3c3c-723d-8ce6-183ce06fcf1b Co-authored-by: Amp <amp@ampcode.com>
57 lines
1.7 KiB
TypeScript
57 lines
1.7 KiB
TypeScript
import type { Locator, Page } from '@playwright/test'
|
|
|
|
import type { AutoQueueMode } from '../../src/stores/queueStore'
|
|
import type { WorkspaceStore } from '../types/globals'
|
|
|
|
export class ComfyActionbar {
|
|
public readonly root: Locator
|
|
public readonly queueButton: ComfyQueueButton
|
|
public readonly propertiesButton: Locator
|
|
|
|
constructor(public readonly page: Page) {
|
|
this.root = page.locator('.actionbar-container')
|
|
this.queueButton = new ComfyQueueButton(this)
|
|
this.propertiesButton = this.root.getByLabel('Toggle properties panel')
|
|
}
|
|
|
|
async isDocked() {
|
|
const className = await this.root
|
|
.locator('.actionbar')
|
|
.getAttribute('class')
|
|
return className?.includes('static') ?? false
|
|
}
|
|
}
|
|
|
|
class ComfyQueueButton {
|
|
public readonly root: Locator
|
|
public readonly primaryButton: Locator
|
|
public readonly dropdownButton: Locator
|
|
constructor(public readonly actionbar: ComfyActionbar) {
|
|
this.root = actionbar.root.getByTestId('queue-button')
|
|
this.primaryButton = this.root.locator('.p-splitbutton-button')
|
|
this.dropdownButton = this.root.locator('.p-splitbutton-dropdown')
|
|
}
|
|
|
|
public async toggleOptions() {
|
|
await this.dropdownButton.click()
|
|
return new ComfyQueueButtonOptions(this.actionbar.page)
|
|
}
|
|
}
|
|
|
|
class ComfyQueueButtonOptions {
|
|
constructor(public readonly page: Page) {}
|
|
|
|
public async setMode(mode: AutoQueueMode) {
|
|
await this.page.evaluate((mode) => {
|
|
;(window.app!.extensionManager as WorkspaceStore).queueSettings.mode =
|
|
mode
|
|
}, mode)
|
|
}
|
|
|
|
public async getMode() {
|
|
return await this.page.evaluate(() => {
|
|
return (window.app!.extensionManager as WorkspaceStore).queueSettings.mode
|
|
})
|
|
}
|
|
}
|