mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-03 20:51:58 +00:00
Backport of #9134 to core/1.40. Conflicts: 25 snapshot PNGs (accepted theirs), 2 Vue files (CSS class ordering — accepted theirs). **Original PR:** https://github.com/Comfy-Org/ComfyUI_frontend/pull/9134 **Pipeline ticket:** 15e1f241-efaa-4fe5-88ca-4ccc7bfb3345 Co-authored-by: Benjamin Lu <benjaminlu1107@gmail.com> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: GitHub Action <action@github.com>
60 lines
1.7 KiB
TypeScript
60 lines
1.7 KiB
TypeScript
import type { Locator, Page } from '@playwright/test'
|
|
|
|
import type { AutoQueueMode } from '../../src/stores/queueStore'
|
|
import { TestIds } from '../fixtures/selectors'
|
|
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(TestIds.topbar.queueButton)
|
|
this.primaryButton = this.root
|
|
this.dropdownButton = actionbar.root.getByTestId(
|
|
TestIds.topbar.queueModeMenuTrigger
|
|
)
|
|
}
|
|
|
|
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
|
|
})
|
|
}
|
|
}
|