diff --git a/browser_tests/fixtures/ComfyPage.ts b/browser_tests/fixtures/ComfyPage.ts index ccf6dff4403..71d37ea76d7 100644 --- a/browser_tests/fixtures/ComfyPage.ts +++ b/browser_tests/fixtures/ComfyPage.ts @@ -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' @@ -335,9 +335,7 @@ export class ComfyPage { } async nextFrame() { - await this.page.evaluate(() => { - return new Promise(requestAnimationFrame) - }) + await nextFrame(this.page) } async delay(ms: number) { @@ -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 + maskColor?: string + maxDiffPixelRatio?: number + maxDiffPixels?: number + omitBackground?: boolean + scale?: 'css' | 'device' + stylePath?: string | Array + threshold?: number + timeout?: number + } + ): Promise { + 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 diff --git a/browser_tests/fixtures/helpers/AppModeHelper.ts b/browser_tests/fixtures/helpers/AppModeHelper.ts index 8494aab253d..fed409d9596 100644 --- a/browser_tests/fixtures/helpers/AppModeHelper.ts +++ b/browser_tests/fixtures/helpers/AppModeHelper.ts @@ -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() @@ -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() } /** diff --git a/browser_tests/fixtures/helpers/CanvasHelper.ts b/browser_tests/fixtures/helpers/CanvasHelper.ts index 46849205e58..6cae310d76a 100644 --- a/browser_tests/fixtures/helpers/CanvasHelper.ts +++ b/browser_tests/fixtures/helpers/CanvasHelper.ts @@ -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( @@ -10,18 +11,12 @@ export class CanvasHelper { private resetViewButton: Locator ) {} - private async nextFrame(): Promise { - await this.page.evaluate(() => { - return new Promise(requestAnimationFrame) - }) - } - async resetView(): Promise { 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 { @@ -29,7 +24,7 @@ export class CanvasHelper { 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 { @@ -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 { @@ -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 { await this.page.mouse.click(x, y, { button: 'right' }) - await this.nextFrame() + await nextFrame(this.page) } async doubleClick(): Promise { await this.page.mouse.dblclick(10, 10, { delay: 5 }) - await this.nextFrame() + await nextFrame(this.page) } async click(position: Position): Promise { await this.canvas.click({ position }) - await this.nextFrame() + await nextFrame(this.page) } /** @@ -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) } /** @@ -116,12 +111,12 @@ export class CanvasHelper { async mouseDblclickAt(position: Position): Promise { 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 { await this.canvas.click({ position: DefaultGraphPositions.emptySpaceClick }) - await this.nextFrame() + await nextFrame(this.page) } async dragAndDrop(source: Position, target: Position): Promise { @@ -129,7 +124,7 @@ export class CanvasHelper { 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 { @@ -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( @@ -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' }) diff --git a/browser_tests/fixtures/helpers/CommandHelper.ts b/browser_tests/fixtures/helpers/CommandHelper.ts index be300ff11a5..e1c5a669dc9 100644 --- a/browser_tests/fixtures/helpers/CommandHelper.ts +++ b/browser_tests/fixtures/helpers/CommandHelper.ts @@ -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) {} @@ -20,6 +21,7 @@ export class CommandHelper { }, { commandId, metadata } ) + await nextFrame(this.page) } async registerCommand( diff --git a/browser_tests/fixtures/helpers/DragDropHelper.ts b/browser_tests/fixtures/helpers/DragDropHelper.ts index 4ffd59206f8..207fc3af414 100644 --- a/browser_tests/fixtures/helpers/DragDropHelper.ts +++ b/browser_tests/fixtures/helpers/DragDropHelper.ts @@ -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 { - await this.page.evaluate(() => { - return new Promise((resolve) => { - requestAnimationFrame(() => resolve()) - }) - }) - } - async dragAndDropExternalResource( options: { fileName?: string @@ -145,7 +138,7 @@ export class DragDropHelper { await uploadResponsePromise } - await this.nextFrame() + await nextFrame(this.page) } async dragAndDropFile( diff --git a/browser_tests/fixtures/helpers/KeyboardHelper.ts b/browser_tests/fixtures/helpers/KeyboardHelper.ts index b2c30346eb9..d1763675214 100644 --- a/browser_tests/fixtures/helpers/KeyboardHelper.ts +++ b/browser_tests/fixtures/helpers/KeyboardHelper.ts @@ -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 { - await this.page.evaluate(() => new Promise(requestAnimationFrame)) + async press(key: string, locator?: Locator | null): Promise { + const target = locator ?? this.canvas + await target.press(key) + await nextFrame(this.page) + } + + async delete(locator?: Locator | null): Promise { + await this.press('Delete', locator) } async ctrlSend( @@ -16,7 +24,7 @@ export class KeyboardHelper { ): Promise { const target = locator ?? this.page.keyboard await target.press(`Control+${keyToPress}`) - await this.nextFrame() + await nextFrame(this.page) } async selectAll(locator?: Locator | null): Promise { diff --git a/browser_tests/fixtures/helpers/NodeOperationsHelper.ts b/browser_tests/fixtures/helpers/NodeOperationsHelper.ts index ba6b03fef78..450887bbffe 100644 --- a/browser_tests/fixtures/helpers/NodeOperationsHelper.ts +++ b/browser_tests/fixtures/helpers/NodeOperationsHelper.ts @@ -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() } } @@ -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 { @@ -176,7 +173,6 @@ export class NodeOperationsHelper { y: 300 } ) - await this.comfyPage.nextFrame() } async adjustEmptyLatentWidth(): Promise { diff --git a/browser_tests/fixtures/helpers/SettingsHelper.ts b/browser_tests/fixtures/helpers/SettingsHelper.ts index 8ff512d95c0..316ff43870d 100644 --- a/browser_tests/fixtures/helpers/SettingsHelper.ts +++ b/browser_tests/fixtures/helpers/SettingsHelper.ts @@ -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) {} @@ -10,6 +12,7 @@ export class SettingsHelper { }, { id: settingId, value: settingValue } ) + await nextFrame(this.page) } async getSetting(settingId: string): Promise { diff --git a/browser_tests/fixtures/helpers/SubgraphHelper.ts b/browser_tests/fixtures/helpers/SubgraphHelper.ts index f4785bf915b..ea5677a6c18 100644 --- a/browser_tests/fixtures/helpers/SubgraphHelper.ts +++ b/browser_tests/fixtures/helpers/SubgraphHelper.ts @@ -465,11 +465,7 @@ 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 { @@ -477,14 +473,12 @@ export class SubgraphHelper { 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 { 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, diff --git a/browser_tests/fixtures/helpers/WorkflowHelper.ts b/browser_tests/fixtures/helpers/WorkflowHelper.ts index 6cd1ff9627f..92d70643e3f 100644 --- a/browser_tests/fixtures/helpers/WorkflowHelper.ts +++ b/browser_tests/fixtures/helpers/WorkflowHelper.ts @@ -70,6 +70,14 @@ export class WorkflowHelper { ) } + async loadGraphData(workflow: ComfyWorkflowJSON): Promise { + 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`) diff --git a/browser_tests/fixtures/utils/litegraphUtils.ts b/browser_tests/fixtures/utils/litegraphUtils.ts index 1aa6176eb0e..c8abd8eced6 100644 --- a/browser_tests/fixtures/utils/litegraphUtils.ts +++ b/browser_tests/fixtures/utils/litegraphUtils.ts @@ -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 { await this.click('title') @@ -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}` ) diff --git a/browser_tests/fixtures/utils/timing.ts b/browser_tests/fixtures/utils/timing.ts index 28ea02700d2..825d523e2e0 100644 --- a/browser_tests/fixtures/utils/timing.ts +++ b/browser_tests/fixtures/utils/timing.ts @@ -1,3 +1,9 @@ +import type { Page } from '@playwright/test' + export function sleep(ms: number): Promise { return new Promise((resolve) => setTimeout(resolve, ms)) } + +export function nextFrame(page: Page): Promise { + return page.evaluate(() => new Promise(requestAnimationFrame)) +} diff --git a/browser_tests/tests/builderReorder.spec.ts b/browser_tests/tests/builderReorder.spec.ts index 6ddd2e1a51e..ede4cbd8604 100644 --- a/browser_tests/tests/builderReorder.spec.ts +++ b/browser_tests/tests/builderReorder.spec.ts @@ -157,7 +157,10 @@ test.describe('Builder input reordering', { tag: '@ui' }, () => { test('Reordering inputs in one app does not corrupt another app', async ({ comfyPage - }) => { + }, testInfo) => { + // This test creates 2 apps, switches tabs 3 times, and enters builder 3 + // times — the default 15s timeout is insufficient in CI. + testInfo.setTimeout(45_000) const { appMode } = comfyPage const app2Widgets = ['seed', 'steps'] const app1Reordered = ['steps', 'cfg', 'seed'] diff --git a/browser_tests/tests/builderSaveFlow.spec.ts b/browser_tests/tests/builderSaveFlow.spec.ts index 38265f6f6d7..7d98e305f70 100644 --- a/browser_tests/tests/builderSaveFlow.spec.ts +++ b/browser_tests/tests/builderSaveFlow.spec.ts @@ -110,8 +110,7 @@ test.describe('Builder save flow', { tag: ['@ui'] }, () => { await expect(comfyPage.appMode.steps.toolbar).toBeVisible() - await comfyPage.page.keyboard.press('Escape') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('Escape') await expect(comfyPage.appMode.steps.toolbar).toBeHidden() }) diff --git a/browser_tests/tests/canvasModeSelector.spec.ts b/browser_tests/tests/canvasModeSelector.spec.ts index 93e6523933c..2e770d3ce4b 100644 --- a/browser_tests/tests/canvasModeSelector.spec.ts +++ b/browser_tests/tests/canvasModeSelector.spec.ts @@ -29,7 +29,6 @@ test.describe('CanvasModeSelector', { tag: '@canvas' }, () => { test.beforeEach(async ({ comfyPage }) => { await comfyPage.settings.setSetting('Comfy.Graph.CanvasMenu', true) await comfyPage.command.executeCommand('Comfy.Canvas.Unlock') - await comfyPage.nextFrame() }) test.describe('Trigger button', () => { @@ -46,7 +45,6 @@ test.describe('CanvasModeSelector', { tag: '@canvas' }, () => { comfyPage }) => { await comfyPage.command.executeCommand(mode.activateCommand) - await comfyPage.nextFrame() const { trigger } = getLocators(comfyPage.page) const modeIcon = trigger.locator('i[aria-hidden="true"]').first() await expect(modeIcon).toHaveClass(mode.iconPattern) @@ -103,7 +101,6 @@ test.describe('CanvasModeSelector', { tag: '@canvas' }, () => { }) => { if (!mode.isReadOnly) { await comfyPage.command.executeCommand('Comfy.Canvas.Lock') - await comfyPage.nextFrame() } const { trigger, menu, selectItem, handItem } = getLocators( comfyPage.page @@ -156,7 +153,6 @@ test.describe('CanvasModeSelector', { tag: '@canvas' }, () => { comfyPage }) => { await comfyPage.command.executeCommand(mode.activateCommand) - await comfyPage.nextFrame() const { trigger, menu, selectItem, handItem } = getLocators( comfyPage.page ) @@ -208,7 +204,6 @@ test.describe('CanvasModeSelector', { tag: '@canvas' }, () => { comfyPage }) => { await comfyPage.command.executeCommand(mode.activateCommand) - await comfyPage.nextFrame() const { trigger, menu, selectItem, handItem } = getLocators( comfyPage.page ) @@ -229,8 +224,7 @@ test.describe('CanvasModeSelector', { tag: '@canvas' }, () => { await comfyPage.canvasOps.isReadOnly(), 'Precondition: canvas starts unlocked' ).toBe(false) - await comfyPage.canvas.press('KeyH') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('KeyH') expect(await comfyPage.canvasOps.isReadOnly()).toBe(true) const { trigger } = getLocators(comfyPage.page) const modeIcon = trigger.locator('i[aria-hidden="true"]').first() @@ -241,13 +235,11 @@ test.describe('CanvasModeSelector', { tag: '@canvas' }, () => { comfyPage }) => { await comfyPage.command.executeCommand('Comfy.Canvas.Lock') - await comfyPage.nextFrame() expect( await comfyPage.canvasOps.isReadOnly(), 'Precondition: canvas starts locked' ).toBe(true) - await comfyPage.canvas.press('KeyV') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('KeyV') expect(await comfyPage.canvasOps.isReadOnly()).toBe(false) const { trigger } = getLocators(comfyPage.page) const modeIcon = trigger.locator('i[aria-hidden="true"]').first() diff --git a/browser_tests/tests/changeTracker.spec.ts b/browser_tests/tests/changeTracker.spec.ts index 65f969aca7c..b4709ad81b3 100644 --- a/browser_tests/tests/changeTracker.spec.ts +++ b/browser_tests/tests/changeTracker.spec.ts @@ -223,8 +223,7 @@ test.describe('Change Tracker', { tag: '@workflow' }, () => { await beforeChange(comfyPage) await comfyPage.keyboard.bypass() await expect(node).toBeBypassed() - await comfyPage.page.keyboard.press('KeyP') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('KeyP') await expect(node).toBePinned() await afterChange(comfyPage) } diff --git a/browser_tests/tests/cloud-asset-default.spec.ts b/browser_tests/tests/cloud-asset-default.spec.ts index 68e95946401..3b557b2fba7 100644 --- a/browser_tests/tests/cloud-asset-default.spec.ts +++ b/browser_tests/tests/cloud-asset-default.spec.ts @@ -74,18 +74,23 @@ test.describe('Asset-supported node default value', { tag: '@cloud' }, () => { return node!.id }) + // Wait for the asset widget to mount AND its value to resolve. + // The widget type becomes 'asset' before the value is populated, + // so poll for both conditions together to avoid a race where the + // type check passes but the value is still the placeholder. await expect .poll( - async () => { - return await comfyPage.page.evaluate((id) => { + () => + comfyPage.page.evaluate((id) => { const node = window.app!.graph.getNodeById(id) const widget = node?.widgets?.find( (w: { name: string }) => w.name === 'ckpt_name' ) - return String(widget?.value ?? '') - }, nodeId) - }, - { timeout: 10_000 } + if (widget?.type !== 'asset') return 'waiting:type' + const val = String(widget?.value ?? '') + return val === 'Select model' ? 'waiting:value' : val + }, nodeId), + { timeout: 15_000 } ) .toBe(CLOUD_ASSETS[0].name) }) diff --git a/browser_tests/tests/colorPalette.spec.ts b/browser_tests/tests/colorPalette.spec.ts index e490b67a22e..fe3a68f0ed2 100644 --- a/browser_tests/tests/colorPalette.spec.ts +++ b/browser_tests/tests/colorPalette.spec.ts @@ -157,18 +157,15 @@ test.describe('Color Palette', { tag: ['@screenshot', '@settings'] }, () => { await comfyPage.workflow.loadWorkflow('nodes/every_node_color') await comfyPage.settings.setSetting('Comfy.ColorPalette', 'obsidian_dark') - await comfyPage.nextFrame() await expect(comfyPage.canvas).toHaveScreenshot( 'custom-color-palette-obsidian-dark-all-colors.png' ) await comfyPage.settings.setSetting('Comfy.ColorPalette', 'light_red') - await comfyPage.nextFrame() await expect(comfyPage.canvas).toHaveScreenshot( 'custom-color-palette-light-red.png' ) await comfyPage.settings.setSetting('Comfy.ColorPalette', 'dark') - await comfyPage.nextFrame() await expect(comfyPage.canvas).toHaveScreenshot('default-color-palette.png') }) @@ -181,7 +178,6 @@ test.describe('Color Palette', { tag: ['@screenshot', '@settings'] }, () => { await expect(comfyPage.toast.toastErrors).toHaveCount(0) await comfyPage.settings.setSetting('Comfy.ColorPalette', 'obsidian_dark') - await comfyPage.nextFrame() await expect(comfyPage.canvas).toHaveScreenshot( 'custom-color-palette-obsidian-dark.png' ) @@ -190,7 +186,6 @@ test.describe('Color Palette', { tag: ['@screenshot', '@settings'] }, () => { 'Comfy.ColorPalette', 'custom_obsidian_dark' ) - await comfyPage.nextFrame() await expect(comfyPage.canvas).toHaveScreenshot( 'custom-color-palette-obsidian-dark.png' ) @@ -212,15 +207,12 @@ test.describe( // Drag mouse to force canvas to redraw await comfyPage.page.mouse.move(0, 0) - await comfyPage.nextFrame() - - await expect(comfyPage.canvas).toHaveScreenshot('node-opacity-0.5.png') + await comfyPage.expectScreenshot(comfyPage.canvas, 'node-opacity-0.5.png') await comfyPage.settings.setSetting('Comfy.Node.Opacity', 1.0) await comfyPage.page.mouse.move(8, 8) - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot('node-opacity-1.png') + await comfyPage.expectScreenshot(comfyPage.canvas, 'node-opacity-1.png') }) test('should persist color adjustments when changing themes', async ({ @@ -229,8 +221,8 @@ test.describe( await comfyPage.settings.setSetting('Comfy.Node.Opacity', 0.2) await comfyPage.settings.setSetting('Comfy.ColorPalette', 'arc') await comfyPage.page.mouse.move(0, 0) - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot( + await comfyPage.expectScreenshot( + comfyPage.canvas, 'node-opacity-0.2-arc-theme.png' ) }) @@ -240,7 +232,6 @@ test.describe( }) => { await comfyPage.settings.setSetting('Comfy.Node.Opacity', 0.5) await comfyPage.settings.setSetting('Comfy.ColorPalette', 'light') - await comfyPage.nextFrame() await expect .poll(() => comfyPage.page.evaluate(() => { @@ -279,7 +270,6 @@ test.describe( comfyPage }) => { await comfyPage.settings.setSetting('Comfy.ColorPalette', 'light') - await comfyPage.nextFrame() await expect(comfyPage.canvas).toHaveScreenshot( 'node-lightened-colors.png' ) diff --git a/browser_tests/tests/copyPaste.spec.ts b/browser_tests/tests/copyPaste.spec.ts index ce67e4a0d15..c4a66b03f03 100644 --- a/browser_tests/tests/copyPaste.spec.ts +++ b/browser_tests/tests/copyPaste.spec.ts @@ -155,7 +155,6 @@ test.describe('Copy Paste', { tag: ['@screenshot', '@workflow'] }, () => { const loadImageNodes = await comfyPage.nodeOps.getNodeRefsByType('LoadImage') await loadImageNodes[0].click('title') - await comfyPage.nextFrame() const uploadPromise = comfyPage.page.waitForResponse( (resp) => resp.url().includes('/upload/') && resp.status() === 200, diff --git a/browser_tests/tests/defaultKeybindings.spec.ts b/browser_tests/tests/defaultKeybindings.spec.ts index 2d27807ed91..3ecdf0e89a6 100644 --- a/browser_tests/tests/defaultKeybindings.spec.ts +++ b/browser_tests/tests/defaultKeybindings.spec.ts @@ -52,8 +52,7 @@ test.describe('Default Keybindings', { tag: '@keyboard' }, () => { test("'Alt+=' zooms in", async ({ comfyPage }) => { const initialScale = await comfyPage.canvasOps.getScale() - await comfyPage.canvas.press('Alt+Equal') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('Alt+Equal') await expect .poll(() => comfyPage.canvasOps.getScale()) @@ -63,8 +62,7 @@ test.describe('Default Keybindings', { tag: '@keyboard' }, () => { test("'Alt+-' zooms out", async ({ comfyPage }) => { const initialScale = await comfyPage.canvasOps.getScale() - await comfyPage.canvas.press('Alt+Minus') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('Alt+Minus') await expect .poll(() => comfyPage.canvasOps.getScale()) @@ -82,8 +80,7 @@ test.describe('Default Keybindings', { tag: '@keyboard' }, () => { await comfyPage.canvas.click({ position: { x: 400, y: 400 } }) await comfyPage.nextFrame() - await comfyPage.canvas.press('Period') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('Period') await expect .poll(() => comfyPage.canvasOps.getScale()) @@ -93,8 +90,7 @@ test.describe('Default Keybindings', { tag: '@keyboard' }, () => { test("'h' locks canvas", async ({ comfyPage }) => { await expect.poll(() => comfyPage.canvasOps.isReadOnly()).toBe(false) - await comfyPage.canvas.press('KeyH') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('KeyH') await expect.poll(() => comfyPage.canvasOps.isReadOnly()).toBe(true) }) @@ -102,11 +98,9 @@ test.describe('Default Keybindings', { tag: '@keyboard' }, () => { test("'v' unlocks canvas", async ({ comfyPage }) => { // Lock first await comfyPage.command.executeCommand('Comfy.Canvas.Lock') - await comfyPage.nextFrame() await expect.poll(() => comfyPage.canvasOps.isReadOnly()).toBe(true) - await comfyPage.canvas.press('KeyV') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('KeyV') await expect.poll(() => comfyPage.canvasOps.isReadOnly()).toBe(false) }) @@ -121,16 +115,13 @@ test.describe('Default Keybindings', { tag: '@keyboard' }, () => { const node = nodes[0] await node.click('title') - await comfyPage.nextFrame() await expect.poll(() => node.isCollapsed()).toBe(false) - await comfyPage.canvas.press('Alt+KeyC') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('Alt+KeyC') await expect.poll(() => node.isCollapsed()).toBe(true) - await comfyPage.canvas.press('Alt+KeyC') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('Alt+KeyC') await expect.poll(() => node.isCollapsed()).toBe(false) }) @@ -140,7 +131,6 @@ test.describe('Default Keybindings', { tag: '@keyboard' }, () => { const node = nodes[0] await node.click('title') - await comfyPage.nextFrame() // Normal mode is ALWAYS (0) const getMode = () => @@ -150,13 +140,11 @@ test.describe('Default Keybindings', { tag: '@keyboard' }, () => { await expect.poll(() => getMode()).toBe(0) - await comfyPage.canvas.press('Control+KeyM') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('Control+KeyM') // NEVER (2) = muted await expect.poll(() => getMode()).toBe(2) - await comfyPage.canvas.press('Control+KeyM') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('Control+KeyM') await expect.poll(() => getMode()).toBe(0) }) }) @@ -239,16 +227,14 @@ test.describe('Default Keybindings', { tag: '@keyboard' }, () => { test("'Ctrl+s' triggers save workflow", async ({ comfyPage }) => { // On a new unsaved workflow, Ctrl+s triggers Save As dialog. // The dialog appearing proves the keybinding was intercepted by the app. - await comfyPage.page.keyboard.press('Control+s') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('Control+s') // The Save As dialog should appear (p-dialog overlay) const dialogOverlay = comfyPage.page.locator('.p-dialog-mask') await expect(dialogOverlay).toBeVisible() // Dismiss the dialog - await comfyPage.page.keyboard.press('Escape') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('Escape') }) test("'Ctrl+o' triggers open workflow", async ({ comfyPage }) => { @@ -265,8 +251,7 @@ test.describe('Default Keybindings', { tag: '@keyboard' }, () => { } }) - await comfyPage.page.keyboard.press('Control+o') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('Control+o') await expect .poll(() => comfyPage.page.evaluate(() => window.TestCommand)) @@ -288,11 +273,9 @@ test.describe('Default Keybindings', { tag: '@keyboard' }, () => { const initialCount = await comfyPage.nodeOps.getGraphNodesCount() // Select all nodes - await comfyPage.canvas.press('Control+a') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('Control+a') - await comfyPage.page.keyboard.press('Control+Shift+KeyE') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('Control+Shift+KeyE') // After conversion, node count should decrease // (multiple nodes replaced by single subgraph node) diff --git a/browser_tests/tests/dialogs/settingsDialog.spec.ts b/browser_tests/tests/dialogs/settingsDialog.spec.ts index 118941dca30..802171108a7 100644 --- a/browser_tests/tests/dialogs/settingsDialog.spec.ts +++ b/browser_tests/tests/dialogs/settingsDialog.spec.ts @@ -145,15 +145,27 @@ test.describe('Settings dialog', { tag: '@ui' }, () => { const settingRow = dialog.root.locator(`[data-setting-id="${settingId}"]`) await expect(settingRow).toBeVisible() - // Open the dropdown via its combobox role and verify it expanded. - // Retry because the PrimeVue Select may re-render during search - // filtering, causing the first click to land on a stale element. + // Wait for the search filter to fully settle — PrimeVue re-renders + // the entire settings list after typing, and the combobox element is + // replaced during re-render. Wait until the filtered list stabilises + // before interacting with the combobox. + const settingItems = dialog.root.locator('[data-setting-id]') + await expect + .poll(() => settingItems.count(), { timeout: 5000 }) + .toBeLessThanOrEqual(5) + const select = settingRow.getByRole('combobox') + await expect(select).toBeVisible() + await expect(select).toBeEnabled() + + // Open the dropdown via its combobox role and verify it expanded. + // Retry because the PrimeVue Select may still re-render after the + // filter settles, causing the first click to land on a stale element. await expect(async () => { const expanded = await select.getAttribute('aria-expanded') if (expanded !== 'true') await select.click() await expect(select).toHaveAttribute('aria-expanded', 'true') - }).toPass({ timeout: 5000 }) + }).toPass({ timeout: 10_000 }) // Pick the option that is not the current value const targetValue = initialValue === 'Top' ? 'Disabled' : 'Top' diff --git a/browser_tests/tests/graphCanvasMenu.spec.ts b/browser_tests/tests/graphCanvasMenu.spec.ts index d311b8a42f6..332ae1c5770 100644 --- a/browser_tests/tests/graphCanvasMenu.spec.ts +++ b/browser_tests/tests/graphCanvasMenu.spec.ts @@ -24,8 +24,8 @@ test.describe('Graph Canvas Menu', { tag: ['@screenshot', '@canvas'] }, () => { TestIds.canvas.toggleLinkVisibilityButton ) await button.click() - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot( + await comfyPage.expectScreenshot( + comfyPage.canvas, 'canvas-with-hidden-links.png' ) const hiddenLinkRenderMode = await comfyPage.page.evaluate(() => { @@ -36,8 +36,8 @@ test.describe('Graph Canvas Menu', { tag: ['@screenshot', '@canvas'] }, () => { .toBe(hiddenLinkRenderMode) await button.click() - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot( + await comfyPage.expectScreenshot( + comfyPage.canvas, 'canvas-with-visible-links.png' ) await expect diff --git a/browser_tests/tests/groupNode.spec.ts b/browser_tests/tests/groupNode.spec.ts index 0653060ad55..006e86895fb 100644 --- a/browser_tests/tests/groupNode.spec.ts +++ b/browser_tests/tests/groupNode.spec.ts @@ -336,12 +336,9 @@ test.describe('Group Node', { tag: '@node' }, () => { ) await test.step('Load workflow containing a group node pasted from a different workflow', async () => { - await comfyPage.page.evaluate( - (workflow) => - window.app!.loadGraphData(workflow as ComfyWorkflowJSON), - currentGraphState + await comfyPage.workflow.loadGraphData( + currentGraphState as ComfyWorkflowJSON ) - await comfyPage.nextFrame() await verifyNodeLoaded(comfyPage, 1) }) }) diff --git a/browser_tests/tests/interaction.spec.ts b/browser_tests/tests/interaction.spec.ts index 52c84da28ee..b90338ec601 100644 --- a/browser_tests/tests/interaction.spec.ts +++ b/browser_tests/tests/interaction.spec.ts @@ -31,11 +31,9 @@ test.describe('Item Interaction', { tag: ['@screenshot', '@node'] }, () => { test('Can pin/unpin items with keyboard shortcut', async ({ comfyPage }) => { await comfyPage.workflow.loadWorkflow('groups/mixed_graph_items') await comfyPage.canvas.press('Control+a') - await comfyPage.canvas.press('KeyP') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('KeyP') await expect(comfyPage.canvas).toHaveScreenshot('pinned-all.png') - await comfyPage.canvas.press('KeyP') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('KeyP') await expect(comfyPage.canvas).toHaveScreenshot('unpinned-all.png') }) }) @@ -76,13 +74,11 @@ test.describe('Node Interaction', () => { await comfyPage.canvas.click({ position: DefaultGraphPositions.textEncodeNode1 }) - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot('selected-node1.png') + await comfyPage.expectScreenshot(comfyPage.canvas, 'selected-node1.png') await comfyPage.canvas.click({ position: DefaultGraphPositions.textEncodeNode2 }) - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot('selected-node2.png') + await comfyPage.expectScreenshot(comfyPage.canvas, 'selected-node2.png') } ) @@ -174,8 +170,7 @@ test.describe('Node Interaction', () => { await comfyPage.nodeOps.dragTextEncodeNode2() // Move mouse away to avoid hover highlight on the node at the drop position. await comfyPage.canvasOps.moveMouseToEmptyArea() - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot('dragged-node1.png', { + await comfyPage.expectScreenshot(comfyPage.canvas, 'dragged-node1.png', { maxDiffPixels: 50 }) }) @@ -185,7 +180,6 @@ test.describe('Node Interaction', () => { // Pin this suite to the legacy canvas path so Alt+drag exercises // LGraphCanvas, not the Vue node drag handler. await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', false) - await comfyPage.nextFrame() }) test('Can duplicate a regular node via Alt+drag', async ({ comfyPage }) => { @@ -285,7 +279,6 @@ test.describe('Node Interaction', () => { }) => { await comfyPage.settings.setSetting('Comfy.Node.AutoSnapLinkToSlot', true) await comfyPage.settings.setSetting('Comfy.Node.SnapHighlightsNode', true) - await comfyPage.nextFrame() await comfyMouse.move(DefaultGraphPositions.clipTextEncodeNode1InputSlot) await comfyMouse.drag(DefaultGraphPositions.clipTextEncodeNode2InputSlot) @@ -359,8 +352,8 @@ test.describe('Node Interaction', () => { modifiers: ['Control', 'Alt'], position: loadCheckpointClipSlotPos }) - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot( + await comfyPage.expectScreenshot( + comfyPage.canvas, 'batch-disconnect-links-disconnected.png' ) } @@ -410,8 +403,8 @@ test.describe('Node Interaction', () => { await expect.poll(() => targetNode.isCollapsed()).toBe(false) // Move mouse away to avoid hover highlight differences. await comfyPage.canvasOps.moveMouseToEmptyArea() - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot( + await comfyPage.expectScreenshot( + comfyPage.canvas, 'text-encode-toggled-back-open.png' ) } @@ -514,8 +507,7 @@ test.describe('Node Interaction', () => { await comfyPage.page.keyboard.up('Control') await comfyPage.nextFrame() // Confirm group title - await comfyPage.page.keyboard.press('Enter') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('Enter') await expect(comfyPage.canvas).toHaveScreenshot( 'group-selected-nodes.png' ) @@ -1171,8 +1163,8 @@ test.describe('Canvas Navigation', { tag: '@screenshot' }, () => { await comfyPage.page.mouse.down({ button: 'middle' }) await comfyPage.page.mouse.move(150, 150) await comfyPage.page.mouse.up({ button: 'middle' }) - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot( + await comfyPage.expectScreenshot( + comfyPage.canvas, 'legacy-middle-drag-pan.png' ) }) @@ -1180,14 +1172,14 @@ test.describe('Canvas Navigation', { tag: '@screenshot' }, () => { test('Mouse wheel should zoom in/out', async ({ comfyPage }) => { await comfyPage.page.mouse.move(400, 300) await comfyPage.page.mouse.wheel(0, -120) - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot( + await comfyPage.expectScreenshot( + comfyPage.canvas, 'legacy-wheel-zoom-in.png' ) await comfyPage.page.mouse.wheel(0, 240) - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot( + await comfyPage.expectScreenshot( + comfyPage.canvas, 'legacy-wheel-zoom-out.png' ) }) @@ -1247,8 +1239,8 @@ test.describe('Canvas Navigation', { tag: '@screenshot' }, () => { await comfyPage.page.mouse.down({ button: 'middle' }) await comfyPage.page.mouse.move(150, 150) await comfyPage.page.mouse.up({ button: 'middle' }) - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot( + await comfyPage.expectScreenshot( + comfyPage.canvas, 'standard-middle-drag-pan.png' ) }) @@ -1258,16 +1250,16 @@ test.describe('Canvas Navigation', { tag: '@screenshot' }, () => { await comfyPage.page.keyboard.down('Control') await comfyPage.page.mouse.wheel(0, -120) await comfyPage.page.keyboard.up('Control') - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot( + await comfyPage.expectScreenshot( + comfyPage.canvas, 'standard-ctrl-wheel-zoom-in.png' ) await comfyPage.page.keyboard.down('Control') await comfyPage.page.mouse.wheel(0, 240) await comfyPage.page.keyboard.up('Control') - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot( + await comfyPage.expectScreenshot( + comfyPage.canvas, 'standard-ctrl-wheel-zoom-out.png' ) }) @@ -1359,33 +1351,31 @@ test.describe('Canvas Navigation', { tag: '@screenshot' }, () => { ) await comfyPage.canvas.click() - await comfyPage.nextFrame() - - await expect(comfyPage.canvas).toHaveScreenshot('standard-initial.png') + await comfyPage.expectScreenshot(comfyPage.canvas, 'standard-initial.png') await comfyPage.page.mouse.move(400, 300) await comfyPage.page.keyboard.down('Shift') await comfyPage.page.mouse.wheel(0, 120) await comfyPage.page.keyboard.up('Shift') - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot( + await comfyPage.expectScreenshot( + comfyPage.canvas, 'standard-shift-wheel-pan-right.png' ) await comfyPage.page.keyboard.down('Shift') await comfyPage.page.mouse.wheel(0, -240) await comfyPage.page.keyboard.up('Shift') - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot( + await comfyPage.expectScreenshot( + comfyPage.canvas, 'standard-shift-wheel-pan-left.png' ) await comfyPage.page.keyboard.down('Shift') await comfyPage.page.mouse.wheel(0, 120) await comfyPage.page.keyboard.up('Shift') - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot( + await comfyPage.expectScreenshot( + comfyPage.canvas, 'standard-shift-wheel-pan-center.png' ) }) diff --git a/browser_tests/tests/load3d/load3d.spec.ts b/browser_tests/tests/load3d/load3d.spec.ts index ec118a9f6ec..573fa0c5951 100644 --- a/browser_tests/tests/load3d/load3d.spec.ts +++ b/browser_tests/tests/load3d/load3d.spec.ts @@ -112,9 +112,8 @@ test.describe('Load3D', () => { await expect.poll(() => modelFileWidget.getValue()).toContain('cube.obj') await load3d.waitForModelLoaded() - await comfyPage.nextFrame() - - await expect(load3d.node).toHaveScreenshot( + await comfyPage.expectScreenshot( + load3d.node, 'load3d-uploaded-cube-obj.png', { maxDiffPixelRatio: 0.1 } ) @@ -142,9 +141,8 @@ test.describe('Load3D', () => { await expect.poll(() => modelFileWidget.getValue()).toContain('cube.obj') await load3d.waitForModelLoaded() - await comfyPage.nextFrame() - - await expect(load3d.node).toHaveScreenshot( + await comfyPage.expectScreenshot( + load3d.node, 'load3d-dropped-cube-obj.png', { maxDiffPixelRatio: 0.1 } ) diff --git a/browser_tests/tests/minimap.spec.ts b/browser_tests/tests/minimap.spec.ts index cca39aa2eeb..d460e7bf4a7 100644 --- a/browser_tests/tests/minimap.spec.ts +++ b/browser_tests/tests/minimap.spec.ts @@ -143,8 +143,7 @@ test.describe('Minimap', { tag: '@canvas' }, () => { canvas.ds.offset[1] = -600 canvas.setDirty(true, true) }) - await comfyPage.nextFrame() - await expect(minimap).toHaveScreenshot('minimap-after-pan.png') + await comfyPage.expectScreenshot(minimap, 'minimap-after-pan.png') } ) diff --git a/browser_tests/tests/mobileBaseline.spec.ts b/browser_tests/tests/mobileBaseline.spec.ts index 1e1307afa14..f26306502c4 100644 --- a/browser_tests/tests/mobileBaseline.spec.ts +++ b/browser_tests/tests/mobileBaseline.spec.ts @@ -11,8 +11,10 @@ test.describe( await comfyPage.settings.setSetting('Comfy.ConfirmClear', false) await comfyPage.command.executeCommand('Comfy.ClearWorkflow') await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(0) - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot('mobile-empty-canvas.png') + await comfyPage.expectScreenshot( + comfyPage.canvas, + 'mobile-empty-canvas.png' + ) }) test('@mobile default workflow', async ({ comfyPage }) => { @@ -24,7 +26,6 @@ test.describe( test('@mobile graph canvas toolbar visible', async ({ comfyPage }) => { await comfyPage.settings.setSetting('Comfy.Graph.CanvasMenu', true) - await comfyPage.nextFrame() const minimapButton = comfyPage.page.getByTestId( TestIds.canvas.toggleMinimapButton @@ -38,9 +39,8 @@ test.describe( test('@mobile settings dialog', async ({ comfyPage }) => { await comfyPage.settingDialog.open() - await comfyPage.nextFrame() - - await expect(comfyPage.settingDialog.root).toHaveScreenshot( + await comfyPage.expectScreenshot( + comfyPage.settingDialog.root, 'mobile-settings-dialog.png', { mask: [ diff --git a/browser_tests/tests/nodeContextMenuOverflow.spec.ts b/browser_tests/tests/nodeContextMenuOverflow.spec.ts index 081290bcb13..26d503bc12a 100644 --- a/browser_tests/tests/nodeContextMenuOverflow.spec.ts +++ b/browser_tests/tests/nodeContextMenuOverflow.spec.ts @@ -35,7 +35,6 @@ test.describe( await comfyPage.nextFrame() await ksamplerNodes[0].click('title') - await comfyPage.nextFrame() await expect(comfyPage.page.locator('.selection-toolbox')).toBeVisible() diff --git a/browser_tests/tests/nodeGhostPlacement.spec.ts b/browser_tests/tests/nodeGhostPlacement.spec.ts index 3368babea8f..6e4392f21b7 100644 --- a/browser_tests/tests/nodeGhostPlacement.spec.ts +++ b/browser_tests/tests/nodeGhostPlacement.spec.ts @@ -14,7 +14,6 @@ async function setVueMode(comfyPage: ComfyPage, enabled: boolean) { async function addGhostAtCenter(comfyPage: ComfyPage) { await comfyPage.command.executeCommand('Comfy.NewBlankWorkflow') - await comfyPage.nextFrame() const viewport = comfyPage.page.viewportSize()! const centerX = Math.round(viewport.width / 2) @@ -53,7 +52,6 @@ for (const mode of ['litegraph', 'vue'] as const) { test('positions ghost node at cursor', async ({ comfyPage }) => { await comfyPage.command.executeCommand('Comfy.NewBlankWorkflow') - await comfyPage.nextFrame() const viewport = comfyPage.page.viewportSize()! const centerX = Math.round(viewport.width / 2) @@ -110,8 +108,7 @@ for (const mode of ['litegraph', 'vue'] as const) { expect(before).not.toBeNull() expect(before!.ghost).toBe(true) - await comfyPage.page.keyboard.press('Escape') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('Escape') const after = await getNodeById(comfyPage, nodeId) expect(after).toBeNull() @@ -124,8 +121,7 @@ for (const mode of ['litegraph', 'vue'] as const) { expect(before).not.toBeNull() expect(before!.ghost).toBe(true) - await comfyPage.page.keyboard.press('Delete') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('Delete') const after = await getNodeById(comfyPage, nodeId) expect(after).toBeNull() @@ -138,8 +134,7 @@ for (const mode of ['litegraph', 'vue'] as const) { expect(before).not.toBeNull() expect(before!.ghost).toBe(true) - await comfyPage.page.keyboard.press('Backspace') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('Backspace') const after = await getNodeById(comfyPage, nodeId) expect(after).toBeNull() diff --git a/browser_tests/tests/nodeSearchBox.spec.ts b/browser_tests/tests/nodeSearchBox.spec.ts index 7bf5b6e95a3..ad57ae29e33 100644 --- a/browser_tests/tests/nodeSearchBox.spec.ts +++ b/browser_tests/tests/nodeSearchBox.spec.ts @@ -303,8 +303,8 @@ test.describe('Release context menu', { tag: '@node' }, () => { 'CLIP | CLIP' ) await comfyPage.page.mouse.move(10, 10) - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot( + await comfyPage.expectScreenshot( + comfyPage.canvas, 'link-release-context-menu.png' ) } diff --git a/browser_tests/tests/rightClickMenu.spec.ts b/browser_tests/tests/rightClickMenu.spec.ts index ca5b0f54415..49f39860e14 100644 --- a/browser_tests/tests/rightClickMenu.spec.ts +++ b/browser_tests/tests/rightClickMenu.spec.ts @@ -19,8 +19,10 @@ test.describe( await comfyPage.page.getByText('loaders').click() await comfyPage.page.getByText('Load VAE').click() await comfyPage.contextMenu.waitForHidden() - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot('add-node-node-added.png') + await comfyPage.expectScreenshot( + comfyPage.canvas, + 'add-node-node-added.png' + ) }) test('Can add group', async ({ comfyPage }) => { @@ -28,8 +30,8 @@ test.describe( await expect(comfyPage.canvas).toHaveScreenshot('right-click-menu.png') await comfyPage.page.getByText('Add Group', { exact: true }).click() await comfyPage.contextMenu.waitForHidden() - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot( + await comfyPage.expectScreenshot( + comfyPage.canvas, 'add-group-group-added.png' ) }) @@ -45,8 +47,8 @@ test.describe( await comfyPage.nodeOps.promptDialogInput.fill('GroupNode2CLIP') await comfyPage.page.keyboard.press('Enter') await comfyPage.nodeOps.promptDialogInput.waitFor({ state: 'hidden' }) - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot( + await comfyPage.expectScreenshot( + comfyPage.canvas, 'right-click-node-group-node.png' ) }) @@ -60,12 +62,11 @@ test.describe('Node Right Click Menu', { tag: ['@screenshot', '@ui'] }, () => { button: 'right' }) await comfyPage.page.mouse.move(10, 10) - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot('right-click-node.png') + await comfyPage.expectScreenshot(comfyPage.canvas, 'right-click-node.png') await comfyPage.page.getByText('Properties Panel').click() await comfyPage.contextMenu.waitForHidden() - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot( + await comfyPage.expectScreenshot( + comfyPage.canvas, 'right-click-node-properties-panel.png' ) }) @@ -76,12 +77,11 @@ test.describe('Node Right Click Menu', { tag: ['@screenshot', '@ui'] }, () => { button: 'right' }) await comfyPage.page.mouse.move(10, 10) - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot('right-click-node.png') + await comfyPage.expectScreenshot(comfyPage.canvas, 'right-click-node.png') await comfyPage.page.getByText('Collapse').click() await comfyPage.contextMenu.waitForHidden() - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot( + await comfyPage.expectScreenshot( + comfyPage.canvas, 'right-click-node-collapsed.png' ) }) @@ -104,8 +104,8 @@ test.describe('Node Right Click Menu', { tag: ['@screenshot', '@ui'] }, () => { await comfyPage.nextFrame() await comfyPage.page.getByText('Collapse').click() await comfyPage.contextMenu.waitForHidden() - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot( + await comfyPage.expectScreenshot( + comfyPage.canvas, 'right-click-node-collapsed-badge.png' ) }) @@ -116,12 +116,11 @@ test.describe('Node Right Click Menu', { tag: ['@screenshot', '@ui'] }, () => { button: 'right' }) await comfyPage.page.mouse.move(10, 10) - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot('right-click-node.png') + await comfyPage.expectScreenshot(comfyPage.canvas, 'right-click-node.png') await comfyPage.page.getByText('Bypass').click() await comfyPage.contextMenu.waitForHidden() - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot( + await comfyPage.expectScreenshot( + comfyPage.canvas, 'right-click-node-bypassed.png' ) }) @@ -133,8 +132,7 @@ test.describe('Node Right Click Menu', { tag: ['@screenshot', '@ui'] }, () => { button: 'right' }) await comfyPage.page.mouse.move(10, 10) - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot('right-click-node.png') + await comfyPage.expectScreenshot(comfyPage.canvas, 'right-click-node.png') await comfyPage.page.locator('.litemenu-entry:has-text("Pin")').click() await comfyPage.contextMenu.waitForHidden() await comfyPage.nextFrame() @@ -149,8 +147,8 @@ test.describe('Node Right Click Menu', { tag: ['@screenshot', '@ui'] }, () => { button: 'right' }) await comfyPage.page.mouse.move(10, 10) - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot( + await comfyPage.expectScreenshot( + comfyPage.canvas, 'right-click-pinned-node.png' ) await comfyPage.page.locator('.litemenu-entry:has-text("Unpin")').click() @@ -160,8 +158,8 @@ test.describe('Node Right Click Menu', { tag: ['@screenshot', '@ui'] }, () => { button: 'right' }) await comfyPage.page.mouse.move(10, 10) - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot( + await comfyPage.expectScreenshot( + comfyPage.canvas, 'right-click-unpinned-node.png' ) }) @@ -206,8 +204,10 @@ test.describe('Node Right Click Menu', { tag: ['@screenshot', '@ui'] }, () => { await comfyPage.page.locator('.litemenu-entry:has-text("Pin")').click() await comfyPage.page.keyboard.up('Control') await comfyPage.contextMenu.waitForHidden() - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot('selected-nodes-pinned.png') + await comfyPage.expectScreenshot( + comfyPage.canvas, + 'selected-nodes-pinned.png' + ) await comfyPage.canvas.click({ position: DefaultGraphPositions.emptyLatentWidgetClick, button: 'right' @@ -216,8 +216,8 @@ test.describe('Node Right Click Menu', { tag: ['@screenshot', '@ui'] }, () => { await comfyPage.nextFrame() await comfyPage.page.locator('.litemenu-entry:has-text("Unpin")').click() await comfyPage.contextMenu.waitForHidden() - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot( + await comfyPage.expectScreenshot( + comfyPage.canvas, 'selected-nodes-unpinned.png' ) }) diff --git a/browser_tests/tests/selectionRectangle.spec.ts b/browser_tests/tests/selectionRectangle.spec.ts index d848b277ab9..aeff0b31785 100644 --- a/browser_tests/tests/selectionRectangle.spec.ts +++ b/browser_tests/tests/selectionRectangle.spec.ts @@ -11,15 +11,13 @@ test.describe('@canvas Selection Rectangle', { tag: '@vue-nodes' }, () => { const totalCount = await comfyPage.vueNodes.getNodeCount() // Use canvas press for keyboard shortcuts (doesn't need click target) - await comfyPage.canvas.press('Control+a') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('Control+a') await expect(comfyPage.vueNodes.selectedNodes).toHaveCount(totalCount) }) test('Click empty space deselects all', async ({ comfyPage }) => { - await comfyPage.canvas.press('Control+a') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('Control+a') await expect(comfyPage.vueNodes.selectedNodes).not.toHaveCount(0) // Deselect by Ctrl+clicking the already-selected node (reliable cross-env) @@ -70,8 +68,7 @@ test.describe('@canvas Selection Rectangle', { tag: '@vue-nodes' }, () => { // Use Ctrl+A to select all, which is functionally equivalent to // drag-selecting the entire canvas and more reliable in CI - await comfyPage.canvas.press('Control+a') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('Control+a') await expect .poll(() => comfyPage.vueNodes.getNodeCount()) diff --git a/browser_tests/tests/selectionToolbox.spec.ts b/browser_tests/tests/selectionToolbox.spec.ts index 756fa0f727c..c673a2a8792 100644 --- a/browser_tests/tests/selectionToolbox.spec.ts +++ b/browser_tests/tests/selectionToolbox.spec.ts @@ -267,8 +267,7 @@ test.describe('Selection Toolbox', { tag: ['@screenshot', '@ui'] }, () => { .click() // Undo the colorization - await comfyPage.page.keyboard.press('Control+Z') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('Control+Z') // Node should be uncolored again const selectedNode = ( diff --git a/browser_tests/tests/selectionToolboxSubmenus.spec.ts b/browser_tests/tests/selectionToolboxSubmenus.spec.ts index 5ac9380d188..18913ec3a91 100644 --- a/browser_tests/tests/selectionToolboxSubmenus.spec.ts +++ b/browser_tests/tests/selectionToolboxSubmenus.spec.ts @@ -43,7 +43,6 @@ test.describe( await comfyPage.nextFrame() await ksamplerNodes[0].click('title') - await comfyPage.nextFrame() await expect(comfyPage.page.locator('.selection-toolbox')).toBeVisible() diff --git a/browser_tests/tests/sidebar/sidebarSplitterWidth.spec.ts b/browser_tests/tests/sidebar/sidebarSplitterWidth.spec.ts index 246a0f62b8a..6e955335e9b 100644 --- a/browser_tests/tests/sidebar/sidebarSplitterWidth.spec.ts +++ b/browser_tests/tests/sidebar/sidebarSplitterWidth.spec.ts @@ -39,7 +39,6 @@ test.describe('Sidebar splitter width independence', () => { location: 'left' | 'right' ) { await comfyPage.settings.setSetting('Comfy.Sidebar.Location', location) - await comfyPage.nextFrame() await dismissToasts(comfyPage) await comfyPage.menu.nodeLibraryTab.open() } diff --git a/browser_tests/tests/subgraph/subgraphNavigation.spec.ts b/browser_tests/tests/subgraph/subgraphNavigation.spec.ts index ffc8506887b..0061cc9e4f0 100644 --- a/browser_tests/tests/subgraph/subgraphNavigation.spec.ts +++ b/browser_tests/tests/subgraph/subgraphNavigation.spec.ts @@ -49,8 +49,7 @@ test.describe('Subgraph Navigation', { tag: ['@slow', '@subgraph'] }, () => { await expect(breadcrumb).toBeVisible({ timeout: 20_000 }) const initialBreadcrumbText = (await breadcrumb.textContent()) ?? '' - await comfyPage.page.keyboard.press('Escape') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('Escape') await comfyPage.canvas.dblclick({ position: { @@ -64,8 +63,7 @@ test.describe('Subgraph Navigation', { tag: ['@slow', '@subgraph'] }, () => { await comfyPage.page.keyboard.press('Control+a') await comfyPage.page.keyboard.type(UPDATED_SUBGRAPH_TITLE) - await comfyPage.page.keyboard.press('Enter') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('Enter') await subgraphNode.navigateIntoSubgraph() await expect(breadcrumb).toBeVisible() @@ -145,8 +143,7 @@ test.describe('Subgraph Navigation', { tag: ['@slow', '@subgraph'] }, () => { await expect.poll(() => comfyPage.subgraph.isInSubgraph()).toBe(true) - await comfyPage.page.keyboard.press('Escape') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('Escape') await expect .poll(() => comfyPage.subgraph.isInSubgraph(), { message: @@ -154,8 +151,7 @@ test.describe('Subgraph Navigation', { tag: ['@slow', '@subgraph'] }, () => { }) .toBe(true) - await comfyPage.page.keyboard.press('Alt+q') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('Alt+q') await expect.poll(() => comfyPage.subgraph.isInSubgraph()).toBe(false) }) @@ -183,8 +179,7 @@ test.describe('Subgraph Navigation', { tag: ['@slow', '@subgraph'] }, () => { comfyPage.page.getByTestId(TestIds.dialogs.settings) ).toBeVisible() - await comfyPage.page.keyboard.press('Escape') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('Escape') await expect( comfyPage.page.getByTestId(TestIds.dialogs.settings) @@ -192,8 +187,7 @@ test.describe('Subgraph Navigation', { tag: ['@slow', '@subgraph'] }, () => { await expect.poll(() => comfyPage.subgraph.isInSubgraph()).toBe(true) - await comfyPage.page.keyboard.press('Escape') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('Escape') await expect.poll(() => comfyPage.subgraph.isInSubgraph()).toBe(false) }) }) @@ -296,8 +290,7 @@ test.describe('Subgraph Navigation', { tag: ['@slow', '@subgraph'] }, () => { await expect.poll(() => comfyPage.subgraph.isInSubgraph()).toBe(true) - await comfyPage.page.keyboard.press('Escape') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('Escape') await expect .poll(() => diff --git a/browser_tests/tests/subgraph/subgraphOperations.spec.ts b/browser_tests/tests/subgraph/subgraphOperations.spec.ts index 63ba06c88b1..80421804701 100644 --- a/browser_tests/tests/subgraph/subgraphOperations.spec.ts +++ b/browser_tests/tests/subgraph/subgraphOperations.spec.ts @@ -38,13 +38,10 @@ test.describe('Subgraph Operations', { tag: ['@slow', '@subgraph'] }, () => { const nodeToClone = await comfyPage.nodeOps.getNodeRefById(String(nodeId)) await nodeToClone.click('title') - await comfyPage.nextFrame() - await comfyPage.page.keyboard.press('ControlOrMeta+c') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('ControlOrMeta+c') - await comfyPage.page.keyboard.press('ControlOrMeta+v') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('ControlOrMeta+v') await expect .poll(() => comfyPage.subgraph.getNodeCount()) diff --git a/browser_tests/tests/subgraph/subgraphPromotionDom.spec.ts b/browser_tests/tests/subgraph/subgraphPromotionDom.spec.ts index 7b9d36a7a2e..c7df3fe1723 100644 --- a/browser_tests/tests/subgraph/subgraphPromotionDom.spec.ts +++ b/browser_tests/tests/subgraph/subgraphPromotionDom.spec.ts @@ -88,8 +88,7 @@ test.describe('Subgraph Promotion DOM', { tag: ['@subgraph'] }, () => { await expect(subgraphTextarea).toHaveValue(TEST_WIDGET_CONTENT) - await comfyPage.page.keyboard.press('Escape') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('Escape') const backToParentTextarea = comfyPage.page.locator(DOM_WIDGET_SELECTOR) await expect(backToParentTextarea).toBeVisible() diff --git a/browser_tests/tests/subgraph/subgraphSearch.spec.ts b/browser_tests/tests/subgraph/subgraphSearch.spec.ts index 62113ba98ca..7b584cd4e55 100644 --- a/browser_tests/tests/subgraph/subgraphSearch.spec.ts +++ b/browser_tests/tests/subgraph/subgraphSearch.spec.ts @@ -15,8 +15,7 @@ async function exitSubgraphAndPublish( subgraphNode: Awaited>, blueprintName: string ) { - await comfyPage.page.keyboard.press('Escape') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('Escape') await subgraphNode.click('title') await comfyPage.command.executeCommand('Comfy.PublishSubgraph', { diff --git a/browser_tests/tests/subgraph/subgraphSerialization.spec.ts b/browser_tests/tests/subgraph/subgraphSerialization.spec.ts index 4711a5f041f..00722ecbb85 100644 --- a/browser_tests/tests/subgraph/subgraphSerialization.spec.ts +++ b/browser_tests/tests/subgraph/subgraphSerialization.spec.ts @@ -85,8 +85,7 @@ test.describe('Subgraph Serialization', { tag: ['@subgraph'] }, () => { await expect.poll(() => comfyPage.subgraph.isInSubgraph()).toBe(true) - await comfyPage.page.keyboard.press('Escape') - await comfyPage.nextFrame() + await comfyPage.keyboard.press('Escape') await expect.poll(() => comfyPage.subgraph.isInSubgraph()).toBe(false) }) diff --git a/browser_tests/tests/subgraph/subgraphSlots.spec.ts b/browser_tests/tests/subgraph/subgraphSlots.spec.ts index 381b37bc594..c6ac6f119ec 100644 --- a/browser_tests/tests/subgraph/subgraphSlots.spec.ts +++ b/browser_tests/tests/subgraph/subgraphSlots.spec.ts @@ -424,7 +424,6 @@ test.describe('Subgraph Slots', { tag: ['@slow', '@subgraph'] }, () => { await SubgraphHelper.expectWidgetBelowHeader(subgraphNode, seedWidget) await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', false) - await comfyPage.nextFrame() const subgraphNodeRef = await comfyPage.nodeOps.getNodeRefById('19') await subgraphNodeRef.navigateIntoSubgraph() diff --git a/browser_tests/tests/viewport.spec.ts b/browser_tests/tests/viewport.spec.ts index 90ac49343c5..f800047f4b9 100644 --- a/browser_tests/tests/viewport.spec.ts +++ b/browser_tests/tests/viewport.spec.ts @@ -34,9 +34,8 @@ test.describe('Viewport', { tag: ['@screenshot', '@smoke', '@canvas'] }, () => { { message: 'All nodes should be within the visible viewport' } ) .toBe(true) - await comfyPage.nextFrame() - - await expect(comfyPage.canvas).toHaveScreenshot( + await comfyPage.expectScreenshot( + comfyPage.canvas, 'viewport-fits-when-saved-offscreen.png' ) }) diff --git a/browser_tests/tests/vueNodes/groups/groups.spec.ts b/browser_tests/tests/vueNodes/groups/groups.spec.ts index daec3d5a91e..5d55b0b79d8 100644 --- a/browser_tests/tests/vueNodes/groups/groups.spec.ts +++ b/browser_tests/tests/vueNodes/groups/groups.spec.ts @@ -121,8 +121,8 @@ test.describe('Vue Node Groups', { tag: ['@screenshot', '@vue-nodes'] }, () => { await comfyPage.page.getByText('Load Checkpoint').click() await comfyPage.page.getByText('KSampler').click({ modifiers: ['Control'] }) await comfyPage.page.keyboard.press(CREATE_GROUP_HOTKEY) - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot( + await comfyPage.expectScreenshot( + comfyPage.canvas, 'vue-groups-create-group.png' ) }) @@ -131,7 +131,6 @@ test.describe('Vue Node Groups', { tag: ['@screenshot', '@vue-nodes'] }, () => { await comfyPage.workflow.loadWorkflow('groups/oversized_group') await comfyPage.keyboard.selectAll() await comfyPage.command.executeCommand('Comfy.Graph.FitGroupToContents') - await comfyPage.nextFrame() await expect(comfyPage.canvas).toHaveScreenshot( 'vue-groups-fit-to-contents.png' ) diff --git a/browser_tests/tests/vueNodes/nodeStates/bypass.spec.ts b/browser_tests/tests/vueNodes/nodeStates/bypass.spec.ts index 82ad2d6f697..ddf44597949 100644 --- a/browser_tests/tests/vueNodes/nodeStates/bypass.spec.ts +++ b/browser_tests/tests/vueNodes/nodeStates/bypass.spec.ts @@ -24,8 +24,8 @@ test.describe('Vue Node Bypass', { tag: '@vue-nodes' }, () => { .filter({ hasText: 'Load Checkpoint' }) .getByTestId('node-inner-wrapper') await expect(checkpointNode).toHaveClass(BYPASS_CLASS) - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot( + await comfyPage.expectScreenshot( + comfyPage.canvas, 'vue-node-bypassed-state.png' ) diff --git a/browser_tests/tests/vueNodes/nodeStates/mute.spec.ts b/browser_tests/tests/vueNodes/nodeStates/mute.spec.ts index 4bf41ba86f3..df0169329ce 100644 --- a/browser_tests/tests/vueNodes/nodeStates/mute.spec.ts +++ b/browser_tests/tests/vueNodes/nodeStates/mute.spec.ts @@ -5,17 +5,19 @@ import { const MUTE_HOTKEY = 'Control+m' const MUTE_OPACITY = '0.5' +const SELECTED_CLASS = /outline-node-component-outline/ test.describe('Vue Node Mute', { tag: '@vue-nodes' }, () => { test( 'should allow toggling mute on a selected node with hotkey', { tag: '@screenshot' }, async ({ comfyPage }) => { - await comfyPage.page.getByText('Load Checkpoint').click() - await comfyPage.page.keyboard.press(MUTE_HOTKEY) - const checkpointNode = comfyPage.vueNodes.getNodeByTitle('Load Checkpoint') + await comfyPage.page.getByText('Load Checkpoint').click() + await expect(checkpointNode).toHaveClass(SELECTED_CLASS) + + await comfyPage.page.keyboard.press(MUTE_HOTKEY) await expect(checkpointNode).toHaveCSS('opacity', MUTE_OPACITY) await expect(comfyPage.canvas).toHaveScreenshot( 'vue-node-muted-state.png' @@ -29,12 +31,14 @@ test.describe('Vue Node Mute', { tag: '@vue-nodes' }, () => { test('should allow toggling mute on multiple selected nodes with hotkey', async ({ comfyPage }) => { - await comfyPage.page.getByText('Load Checkpoint').click() - await comfyPage.page.getByText('KSampler').click({ modifiers: ['Control'] }) - const checkpointNode = comfyPage.vueNodes.getNodeByTitle('Load Checkpoint') const ksamplerNode = comfyPage.vueNodes.getNodeByTitle('KSampler') + await comfyPage.page.getByText('Load Checkpoint').click() + await expect(checkpointNode).toHaveClass(SELECTED_CLASS) + await comfyPage.page.getByText('KSampler').click({ modifiers: ['Control'] }) + await expect(ksamplerNode).toHaveClass(SELECTED_CLASS) + await comfyPage.page.keyboard.press(MUTE_HOTKEY) await expect(checkpointNode).toHaveCSS('opacity', MUTE_OPACITY) await expect(ksamplerNode).toHaveCSS('opacity', MUTE_OPACITY) diff --git a/browser_tests/tests/vueNodes/rerouteNodeSize.spec.ts b/browser_tests/tests/vueNodes/rerouteNodeSize.spec.ts index 135177bbab5..3800c628947 100644 --- a/browser_tests/tests/vueNodes/rerouteNodeSize.spec.ts +++ b/browser_tests/tests/vueNodes/rerouteNodeSize.spec.ts @@ -1,7 +1,4 @@ -import { - comfyExpect as expect, - comfyPageFixture as test -} from '@e2e/fixtures/ComfyPage' +import { comfyPageFixture as test } from '@e2e/fixtures/ComfyPage' test.describe('Vue Reroute Node Size', { tag: '@vue-nodes' }, () => { test.beforeEach(async ({ comfyPage }) => { @@ -13,8 +10,8 @@ test.describe('Vue Reroute Node Size', { tag: '@vue-nodes' }, () => { 'reroute node visual appearance', { tag: '@screenshot' }, async ({ comfyPage }) => { - await comfyPage.nextFrame() - await expect(comfyPage.canvas).toHaveScreenshot( + await comfyPage.expectScreenshot( + comfyPage.canvas, 'vue-reroute-node-compact.png' ) } diff --git a/browser_tests/tests/workflowPersistence.spec.ts b/browser_tests/tests/workflowPersistence.spec.ts index 124836d151d..5a76125fa36 100644 --- a/browser_tests/tests/workflowPersistence.spec.ts +++ b/browser_tests/tests/workflowPersistence.spec.ts @@ -289,10 +289,8 @@ test.describe('Workflow Persistence', () => { const initialNodeCount = await comfyPage.nodeOps.getNodeCount() await comfyPage.settings.setSetting('Comfy.Locale', 'zh') - await comfyPage.nextFrame() await comfyPage.settings.setSetting('Comfy.Locale', 'en') - await comfyPage.nextFrame() await expect .poll(() => comfyPage.nodeOps.getNodeCount()) @@ -349,7 +347,6 @@ test.describe('Workflow Persistence', () => { // Create B: duplicate, add a node, then save (unmodified after save) await comfyPage.command.executeCommand('Comfy.DuplicateWorkflow') - await comfyPage.nextFrame() await comfyPage.page.evaluate(() => { window.app!.graph.add(window.LiteGraph!.createNode('Note', undefined, {})) @@ -410,7 +407,6 @@ test.describe('Workflow Persistence', () => { // Create B: duplicate and save await comfyPage.command.executeCommand('Comfy.DuplicateWorkflow') - await comfyPage.nextFrame() await comfyPage.menu.topbar.saveWorkflow(nameB) // Add a Note node in B to mark it as modified @@ -487,7 +483,6 @@ test.describe('Workflow Persistence', () => { // Create B as an unsaved workflow with a Note node await comfyPage.command.executeCommand('Comfy.NewBlankWorkflow') - await comfyPage.nextFrame() await comfyPage.page.evaluate(() => { window.app!.graph.add(window.LiteGraph!.createNode('Note', undefined, {}))