Compare commits

...

7 Commits

Author SHA1 Message Date
Benjamin Lu
afede497c4 test: use queue button page object in e2e 2026-05-04 14:29:44 -07:00
Benjamin Lu
f74807b389 test: avoid duplicate queue button e2e setup 2026-05-04 14:27:08 -07:00
bymyself
eacd6e31bb test: assert mode change via Run button label, not menu close
The dropdown deliberately stays open after selecting a mode
(`@select.prevent` on DropdownMenuItem in ComfyQueueButton.vue,
introduced in #9134 as part of the Figma run-controls redesign).

The previous test asserted the menu hides after selection, which
contradicts the implementation and failed in CI. Replace it with a
behavior-meaningful assertion: selecting 'Run (On Change)' updates the
Run button label, proving the mode change took effect.
2026-05-02 14:05:21 -07:00
bymyself
7394e5f806 fix: type mock prompt response with PromptResponse and remove invalid number field
Addresses review feedback:
https://github.com/Comfy-Org/ComfyUI_frontend/pull/11209#discussion_r3076341266
2026-05-02 14:05:21 -07:00
bymyself
b38f316aff fix: assert all expected queue modes, not just first item
Addresses review feedback:
https://github.com/Comfy-Org/ComfyUI_frontend/pull/11209#discussion_r3076279737
2026-05-02 14:05:21 -07:00
bymyself
319a16feb6 fix: use menuitem role instead of menuitemradio for queue mode menu
DropdownMenuItem from reka-ui renders with role='menuitem', not
'menuitemradio'. The failing tests used the wrong ARIA role selector.
2026-05-02 14:05:21 -07:00
bymyself
db9bab4ed4 test: add E2E tests for queue button modes 2026-05-02 14:05:21 -07:00
2 changed files with 82 additions and 1 deletions

View File

@@ -36,13 +36,31 @@ class ComfyQueueButton {
}
public async toggleOptions() {
return await this.openOptions()
}
public async openOptions() {
await this.dropdownButton.click()
return new ComfyQueueButtonOptions(this.actionbar.page)
}
}
class ComfyQueueButtonOptions {
constructor(public readonly page: Page) {}
public readonly menu: Locator
public readonly modeItems: Locator
constructor(public readonly page: Page) {
this.menu = page.getByRole('menu')
this.modeItems = this.menu.getByRole('menuitem')
}
public modeItem(name: string) {
return this.menu.getByRole('menuitem', { name, exact: true })
}
public async selectMode(name: string) {
await this.modeItem(name).click()
}
public async setMode(mode: AutoQueueMode) {
await this.page.evaluate((mode) => {

View File

@@ -0,0 +1,63 @@
import { expect } from '@playwright/test'
import type { PromptResponse } from '@/schemas/apiSchema'
import { comfyPageFixture as test } from '@e2e/fixtures/ComfyPage'
const queueModeLabels = ['Run', 'Run (On Change)', 'Run (Instant)']
const runOnChangeLabel = queueModeLabels[1]
test.describe('Queue button modes', { tag: '@ui' }, () => {
test('Run button is visible in topbar', async ({ comfyPage }) => {
await expect(comfyPage.actionbar.queueButton.primaryButton).toBeVisible()
})
test('Queue mode trigger menu is visible', async ({ comfyPage }) => {
await expect(comfyPage.actionbar.queueButton.dropdownButton).toBeVisible()
})
test('Clicking queue mode trigger opens mode menu', async ({ comfyPage }) => {
const options = await comfyPage.actionbar.queueButton.openOptions()
await expect(options.menu).toBeVisible()
})
test('Queue mode menu shows available modes', async ({ comfyPage }) => {
const options = await comfyPage.actionbar.queueButton.openOptions()
await expect(options.menu).toBeVisible()
await expect(options.modeItems).toHaveText(queueModeLabels)
})
test('Selecting a non-default mode updates the Run button label', async ({
comfyPage
}) => {
const queueButton = comfyPage.actionbar.queueButton
const options = await queueButton.openOptions()
await expect(options.menu).toBeVisible()
await options.selectMode(runOnChangeLabel)
await expect(queueButton.primaryButton).toContainText(runOnChangeLabel)
})
test('Run button sends prompt when clicked', async ({ comfyPage }) => {
let promptQueued = false
const mockResponse: PromptResponse = {
prompt_id: 'test-id',
node_errors: {},
error: ''
}
await comfyPage.page.route('**/api/prompt', async (route) => {
promptQueued = true
await route.fulfill({
status: 200,
body: JSON.stringify(mockResponse)
})
})
await comfyPage.actionbar.queueButton.primaryButton.click()
await expect.poll(() => promptQueued).toBe(true)
})
})