Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
728b3fe
refactor: internalize nextFrame() in SettingsHelper.setSetting()
DrJKL Apr 11, 2026
b24b565
refactor: internalize nextFrame() in CommandHelper.executeCommand()
DrJKL Apr 11, 2026
b64d0a8
refactor: add WorkflowHelper.loadGraphData() with internalized nextFr…
DrJKL Apr 11, 2026
86b409c
refactor: remove redundant nextFrame() from NodeReference and helpers
DrJKL Apr 11, 2026
7562ca2
refactor: add KeyboardHelper.press() and delete() with internalized n…
DrJKL Apr 11, 2026
7985306
refactor: add ComfyPage.expectScreenshot() with internalized nextFrame()
DrJKL Apr 11, 2026
e63757c
test: harden 3 flaky e2e tests with real readiness checks
DrJKL Apr 13, 2026
3648dd6
test: harden 3 flaky e2e tests (round 2)
DrJKL Apr 13, 2026
e25faeb
fix: replace silent .catch() with toBeHidden() in enterBuilder
DrJKL Apr 13, 2026
3264d1c
Merge branch 'main' into drjkl/audit-nextframe
DrJKL Apr 13, 2026
4f1311a
fix: revert toBeHidden() back to best-effort .catch() in enterBuilder
DrJKL Apr 13, 2026
506dd8d
Merge remote-tracking branch 'origin/main' into drjkl/audit-nextframe
DrJKL Apr 13, 2026
4862b80
fix: harden flaky mute hotkey e2e tests with selection readiness gate
DrJKL Apr 13, 2026
aee953d
Merge branch 'main' into drjkl/audit-nextframe
DrJKL Apr 13, 2026
4d138c3
Merge branch 'main' into drjkl/audit-nextframe
DrJKL Apr 13, 2026
1213d17
Merge branch 'main' into drjkl/audit-nextframe
DrJKL Apr 14, 2026
6575ebf
refactor(e2e): consolidate nextFrame into shared util
DrJKL Apr 14, 2026
0b1692a
fix: use toHaveScreenshot assertion options for expectScreenshot
DrJKL Apr 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions browser_tests/fixtures/ComfyPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ComfyMouse } from '@e2e/fixtures/ComfyMouse'
import { TestIds } from '@e2e/fixtures/selectors'
import { comfyExpect } from '@e2e/fixtures/utils/customMatchers'
import { assetPath } from '@e2e/fixtures/utils/paths'
import { sleep } from '@e2e/fixtures/utils/timing'
import { nextFrame, sleep } from '@e2e/fixtures/utils/timing'
import { VueNodeHelpers } from '@e2e/fixtures/VueNodeHelpers'
import { BottomPanel } from '@e2e/fixtures/components/BottomPanel'
import { ComfyNodeSearchBox } from '@e2e/fixtures/components/ComfyNodeSearchBox'
Expand Down Expand Up @@ -335,9 +335,7 @@ export class ComfyPage {
}

async nextFrame() {
await this.page.evaluate(() => {
return new Promise<number>(requestAnimationFrame)
})
await nextFrame(this.page)
}

async delay(ms: number) {
Expand Down Expand Up @@ -392,6 +390,27 @@ export class ComfyPage {
return this.page.locator('.dom-widget')
}

async expectScreenshot(
locator: Locator,
name: string | string[],
options?: {
animations?: 'disabled' | 'allow'
caret?: 'hide' | 'initial'
mask?: Array<Locator>
maskColor?: string
maxDiffPixelRatio?: number
maxDiffPixels?: number
omitBackground?: boolean
scale?: 'css' | 'device'
stylePath?: string | Array<string>
threshold?: number
timeout?: number
}
): Promise<void> {
await this.nextFrame()
await comfyExpect(locator).toHaveScreenshot(name, options)
}

async setFocusMode(focusMode: boolean) {
await this.page.evaluate((focusMode) => {
;(window.app!.extensionManager as WorkspaceStore).focusMode = focusMode
Expand Down
10 changes: 9 additions & 1 deletion browser_tests/fixtures/helpers/AppModeHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,15 @@ export class AppModeHelper {

/** Enter builder mode via the "Workflow actions" dropdown. */
async enterBuilder() {
// Wait for any workflow-tab popover to dismiss before clicking —
// the popover overlay can intercept the "Workflow actions" click.
// Best-effort: the popover may or may not exist; if it stays visible
// past the timeout we still proceed with the click.
await this.page
.locator('.workflow-popover-fade')
.waitFor({ state: 'hidden', timeout: 5000 })
.catch(() => {})

await this.page
.getByRole('button', { name: 'Workflow actions' })
.first()
Expand All @@ -108,7 +117,6 @@ export class AppModeHelper {
async toggleAppMode() {
await this.comfyPage.workflow.waitForActiveWorkflow()
await this.comfyPage.command.executeCommand('Comfy.ToggleLinear')
await this.comfyPage.nextFrame()
}

/**
Expand Down
35 changes: 15 additions & 20 deletions browser_tests/fixtures/helpers/CanvasHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { Locator, Page } from '@playwright/test'

import { DefaultGraphPositions } from '@e2e/fixtures/constants/defaultGraphPositions'
import type { Position } from '@e2e/fixtures/types'
import { nextFrame } from '@e2e/fixtures/utils/timing'

export class CanvasHelper {
constructor(
Expand All @@ -10,26 +11,20 @@ export class CanvasHelper {
private resetViewButton: Locator
) {}

private async nextFrame(): Promise<void> {
await this.page.evaluate(() => {
return new Promise<number>(requestAnimationFrame)
})
}

async resetView(): Promise<void> {
if (await this.resetViewButton.isVisible()) {
await this.resetViewButton.click()
}
await this.page.mouse.move(10, 10)
await this.nextFrame()
await nextFrame(this.page)
}

async zoom(deltaY: number, steps: number = 1): Promise<void> {
await this.page.mouse.move(10, 10)
for (let i = 0; i < steps; i++) {
await this.page.mouse.wheel(0, deltaY)
}
await this.nextFrame()
await nextFrame(this.page)
}

async pan(offset: Position, safeSpot?: Position): Promise<void> {
Expand All @@ -38,7 +33,7 @@ export class CanvasHelper {
await this.page.mouse.down()
await this.page.mouse.move(offset.x + safeSpot.x, offset.y + safeSpot.y)
await this.page.mouse.up()
await this.nextFrame()
await nextFrame(this.page)
}

async panWithTouch(offset: Position, safeSpot?: Position): Promise<void> {
Expand All @@ -56,22 +51,22 @@ export class CanvasHelper {
type: 'touchEnd',
touchPoints: []
})
await this.nextFrame()
await nextFrame(this.page)
}

async rightClick(x: number = 10, y: number = 10): Promise<void> {
await this.page.mouse.click(x, y, { button: 'right' })
await this.nextFrame()
await nextFrame(this.page)
}

async doubleClick(): Promise<void> {
await this.page.mouse.dblclick(10, 10, { delay: 5 })
await this.nextFrame()
await nextFrame(this.page)
}

async click(position: Position): Promise<void> {
await this.canvas.click({ position })
await this.nextFrame()
await nextFrame(this.page)
}

/**
Expand Down Expand Up @@ -107,7 +102,7 @@ export class CanvasHelper {
} finally {
for (const mod of modifiers) await this.page.keyboard.up(mod)
}
await this.nextFrame()
await nextFrame(this.page)
}

/**
Expand All @@ -116,20 +111,20 @@ export class CanvasHelper {
async mouseDblclickAt(position: Position): Promise<void> {
const abs = await this.toAbsolute(position)
await this.page.mouse.dblclick(abs.x, abs.y)
await this.nextFrame()
await nextFrame(this.page)
}

async clickEmptySpace(): Promise<void> {
await this.canvas.click({ position: DefaultGraphPositions.emptySpaceClick })
await this.nextFrame()
await nextFrame(this.page)
}

async dragAndDrop(source: Position, target: Position): Promise<void> {
await this.page.mouse.move(source.x, source.y)
await this.page.mouse.down()
await this.page.mouse.move(target.x, target.y, { steps: 100 })
await this.page.mouse.up()
await this.nextFrame()
await nextFrame(this.page)
}

async moveMouseToEmptyArea(): Promise<void> {
Expand All @@ -152,7 +147,7 @@ export class CanvasHelper {
await this.page.evaluate((s) => {
window.app!.canvas.ds.scale = s
}, scale)
await this.nextFrame()
await nextFrame(this.page)
}

async convertOffsetToCanvas(
Expand Down Expand Up @@ -236,12 +231,12 @@ export class CanvasHelper {
// Sweep forward
for (let i = 0; i < steps; i++) {
await this.page.mouse.move(centerX + i * dx, centerY + i * dy)
await this.nextFrame()
await nextFrame(this.page)
}
// Sweep back
for (let i = steps; i > 0; i--) {
await this.page.mouse.move(centerX + i * dx, centerY + i * dy)
await this.nextFrame()
await nextFrame(this.page)
}

await this.page.mouse.up({ button: 'middle' })
Expand Down
2 changes: 2 additions & 0 deletions browser_tests/fixtures/helpers/CommandHelper.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { Page } from '@playwright/test'

import type { KeyCombo } from '@/platform/keybindings/types'
import { nextFrame } from '@e2e/fixtures/utils/timing'

export class CommandHelper {
constructor(private readonly page: Page) {}
Expand All @@ -20,6 +21,7 @@ export class CommandHelper {
},
{ commandId, metadata }
)
await nextFrame(this.page)
}

async registerCommand(
Expand Down
11 changes: 2 additions & 9 deletions browser_tests/fixtures/helpers/DragDropHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,11 @@ import type { Page } from '@playwright/test'
import type { Position } from '@e2e/fixtures/types'
import { getMimeType } from '@e2e/fixtures/helpers/mimeTypeUtil'
import { assetPath } from '@e2e/fixtures/utils/paths'
import { nextFrame } from '@e2e/fixtures/utils/timing'

export class DragDropHelper {
constructor(private readonly page: Page) {}

private async nextFrame(): Promise<void> {
await this.page.evaluate(() => {
return new Promise<void>((resolve) => {
requestAnimationFrame(() => resolve())
})
})
}

async dragAndDropExternalResource(
options: {
fileName?: string
Expand Down Expand Up @@ -145,7 +138,7 @@ export class DragDropHelper {
await uploadResponsePromise
}

await this.nextFrame()
await nextFrame(this.page)
}

async dragAndDropFile(
Expand Down
14 changes: 11 additions & 3 deletions browser_tests/fixtures/helpers/KeyboardHelper.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
import type { Locator, Page } from '@playwright/test'

import { nextFrame } from '@e2e/fixtures/utils/timing'

export class KeyboardHelper {
constructor(
private readonly page: Page,
private readonly canvas: Locator
) {}

private async nextFrame(): Promise<void> {
await this.page.evaluate(() => new Promise<number>(requestAnimationFrame))
async press(key: string, locator?: Locator | null): Promise<void> {
const target = locator ?? this.canvas
await target.press(key)
await nextFrame(this.page)
}

async delete(locator?: Locator | null): Promise<void> {
await this.press('Delete', locator)
}

async ctrlSend(
Expand All @@ -16,7 +24,7 @@ export class KeyboardHelper {
): Promise<void> {
const target = locator ?? this.page.keyboard
await target.press(`Control+${keyToPress}`)
await this.nextFrame()
await nextFrame(this.page)
}

async selectAll(locator?: Locator | null): Promise<void> {
Expand Down
4 changes: 0 additions & 4 deletions browser_tests/fixtures/helpers/NodeOperationsHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,11 @@ export class NodeOperationsHelper {
{ x: bottomRight.x - 2, y: bottomRight.y - 1 },
target
)
await this.comfyPage.nextFrame()
if (revertAfter) {
await this.comfyPage.canvasOps.dragAndDrop(
{ x: target.x - 2, y: target.y - 1 },
bottomRight
)
await this.comfyPage.nextFrame()
}
}

Expand All @@ -158,7 +156,6 @@ export class NodeOperationsHelper {
}
await node.clickContextMenuOption('Convert to Group Node')
await this.fillPromptDialog(groupNodeName)
await this.comfyPage.nextFrame()
}

async fillPromptDialog(value: string): Promise<void> {
Expand All @@ -176,7 +173,6 @@ export class NodeOperationsHelper {
y: 300
}
)
await this.comfyPage.nextFrame()
}

async adjustEmptyLatentWidth(): Promise<void> {
Expand Down
3 changes: 3 additions & 0 deletions browser_tests/fixtures/helpers/SettingsHelper.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import type { Page } from '@playwright/test'

import { nextFrame } from '@e2e/fixtures/utils/timing'

export class SettingsHelper {
constructor(private readonly page: Page) {}

Expand All @@ -10,6 +12,7 @@ export class SettingsHelper {
},
{ id: settingId, value: settingValue }
)
await nextFrame(this.page)
}

async getSetting<T = unknown>(settingId: string): Promise<T> {
Expand Down
8 changes: 1 addition & 7 deletions browser_tests/fixtures/helpers/SubgraphHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -465,26 +465,20 @@ export class SubgraphHelper {
const serialized = await this.page.evaluate(() =>
window.app!.graph!.serialize()
)
await this.page.evaluate(
(workflow: ComfyWorkflowJSON) => window.app!.loadGraphData(workflow),
serialized as ComfyWorkflowJSON
)
await this.comfyPage.nextFrame()
await this.comfyPage.workflow.loadGraphData(serialized as ComfyWorkflowJSON)
}

async convertDefaultKSamplerToSubgraph(): Promise<NodeReference> {
await this.comfyPage.workflow.loadWorkflow('default')
const ksampler = await this.comfyPage.nodeOps.getNodeRefById('3')
await ksampler.click('title')
const subgraphNode = await ksampler.convertToSubgraph()
await this.comfyPage.nextFrame()
return subgraphNode
}

async packAllInteriorNodes(hostNodeId: string): Promise<void> {
await this.comfyPage.vueNodes.enterSubgraph(hostNodeId)
await this.comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', false)
await this.comfyPage.nextFrame()
await this.comfyPage.canvas.dispatchEvent('pointerdown', {
bubbles: true,
cancelable: true,
Expand Down
8 changes: 8 additions & 0 deletions browser_tests/fixtures/helpers/WorkflowHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ export class WorkflowHelper {
)
}

async loadGraphData(workflow: ComfyWorkflowJSON): Promise<void> {
await this.comfyPage.page.evaluate(
(wf) => window.app!.loadGraphData(wf),
workflow
)
await this.comfyPage.nextFrame()
}

async loadWorkflow(workflowName: string) {
await this.comfyPage.workflowUploadInput.setInputFiles(
assetPath(`${workflowName}.json`)
Expand Down
2 changes: 0 additions & 2 deletions browser_tests/fixtures/utils/litegraphUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,6 @@ export class NodeReference {
async copy() {
await this.click('title')
await this.comfyPage.clipboard.copy()
await this.comfyPage.nextFrame()
}
async delete(): Promise<void> {
await this.click('title')
Expand Down Expand Up @@ -434,7 +433,6 @@ export class NodeReference {
async convertToGroupNode(groupNodeName: string = 'GroupNode') {
await this.clickContextMenuOption('Convert to Group Node')
await this.comfyPage.nodeOps.fillPromptDialog(groupNodeName)
await this.comfyPage.nextFrame()
const nodes = await this.comfyPage.nodeOps.getNodeRefsByType(
`workflow>${groupNodeName}`
)
Expand Down
6 changes: 6 additions & 0 deletions browser_tests/fixtures/utils/timing.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
import type { Page } from '@playwright/test'

export function sleep(ms: number): Promise<void> {
return new Promise((resolve) => setTimeout(resolve, ms))
}

export function nextFrame(page: Page): Promise<number> {
return page.evaluate(() => new Promise<number>(requestAnimationFrame))
}
Loading
Loading