mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-19 22:09:37 +00:00
fix(test): use DuplicateWorkflow + middle-click pattern, rm duplicate file
- loadWorkflow replaces current tab content (no new tab created), causing closeWorkflowTab to timeout on missing tab locator - closeWorkflowTab relies on hover-dependent X button; middle-click is the proven close mechanism used by all sibling tests - git rm the duplicate workflowTabSave.spec.ts (lint-staged restored it)
This commit is contained in:
@@ -1,62 +0,0 @@
|
||||
import { expect } from '@playwright/test'
|
||||
|
||||
import { comfyPageFixture as test } from '../../fixtures/ComfyPage'
|
||||
|
||||
test.describe('Workflow tab save on close', () => {
|
||||
test.beforeEach(async ({ comfyPage }) => {
|
||||
await comfyPage.settings.setSetting(
|
||||
'Comfy.Workflow.WorkflowTabsPosition',
|
||||
'Topbar'
|
||||
)
|
||||
})
|
||||
|
||||
test.afterEach(async ({ comfyPage }) => {
|
||||
await comfyPage.workflow.setupWorkflowsDirectory({})
|
||||
})
|
||||
|
||||
test('Closing an inactive tab preserves the active workflow content', async ({
|
||||
comfyPage
|
||||
}) => {
|
||||
test.info().annotations.push({
|
||||
type: 'regression',
|
||||
description:
|
||||
'PR #10745 — closing inactive tab saved active graph into the closing tab'
|
||||
})
|
||||
|
||||
await comfyPage.workflow.setupWorkflowsDirectory({
|
||||
'wf-A.json': 'default.json',
|
||||
'wf-B.json': 'nodes/single_ksampler.json'
|
||||
})
|
||||
|
||||
const workflowsTab = comfyPage.menu.workflowsTab
|
||||
await workflowsTab.open()
|
||||
|
||||
// Open workflow A (default = 7 nodes)
|
||||
await workflowsTab.getPersistedItem('wf-A').dblclick()
|
||||
await comfyPage.workflow.waitForWorkflowIdle()
|
||||
const nodeCountA = await comfyPage.nodeOps.getNodeCount()
|
||||
expect(nodeCountA).toBeGreaterThan(1)
|
||||
|
||||
// Open workflow B (single_ksampler = 1 node)
|
||||
await workflowsTab.getPersistedItem('wf-B').dblclick()
|
||||
await comfyPage.workflow.waitForWorkflowIdle()
|
||||
await expect
|
||||
.poll(() => comfyPage.nodeOps.getNodeCount(), { timeout: 5000 })
|
||||
.toBe(1)
|
||||
|
||||
// Switch to A (making B the inactive tab)
|
||||
await comfyPage.menu.topbar.getWorkflowTab('wf-A').click()
|
||||
await comfyPage.workflow.waitForWorkflowIdle()
|
||||
await expect
|
||||
.poll(() => comfyPage.nodeOps.getNodeCount(), { timeout: 5000 })
|
||||
.toBe(nodeCountA)
|
||||
|
||||
// Close inactive B tab
|
||||
await comfyPage.menu.topbar.closeWorkflowTab('wf-B')
|
||||
|
||||
// A should still have its own node count (not B's)
|
||||
await expect
|
||||
.poll(() => comfyPage.nodeOps.getNodeCount(), { timeout: 5000 })
|
||||
.toBe(nodeCountA)
|
||||
})
|
||||
})
|
||||
@@ -345,12 +345,18 @@ test.describe('Workflow Persistence', () => {
|
||||
await comfyPage.menu.topbar.saveWorkflow(nameA)
|
||||
const nodeCountA = await comfyPage.nodeOps.getNodeCount()
|
||||
|
||||
// Create B with a different node count
|
||||
await comfyPage.workflow.loadWorkflow('nodes/single_ksampler')
|
||||
await comfyPage.menu.topbar.saveWorkflow(nameB)
|
||||
const nodeCountB = await comfyPage.nodeOps.getNodeCount()
|
||||
// Create B: duplicate, add a node, then save (unmodified after save)
|
||||
await comfyPage.command.executeCommand('Comfy.DuplicateWorkflow')
|
||||
await comfyPage.nextFrame()
|
||||
|
||||
expect(nodeCountA).not.toBe(nodeCountB)
|
||||
await comfyPage.page.evaluate(() => {
|
||||
window.app!.graph.add(window.LiteGraph!.createNode('Note', undefined, {}))
|
||||
})
|
||||
await comfyPage.nextFrame()
|
||||
await comfyPage.menu.topbar.saveWorkflow(nameB)
|
||||
|
||||
const nodeCountB = await comfyPage.nodeOps.getNodeCount()
|
||||
expect(nodeCountB).toBe(nodeCountA + 1)
|
||||
|
||||
// Switch to A (making B inactive and unmodified)
|
||||
await comfyPage.menu.topbar.getWorkflowTab(nameA).click()
|
||||
@@ -359,8 +365,10 @@ test.describe('Workflow Persistence', () => {
|
||||
.poll(() => comfyPage.nodeOps.getNodeCount(), { timeout: 3000 })
|
||||
.toBe(nodeCountA)
|
||||
|
||||
// Close inactive B — no save dialog expected
|
||||
await comfyPage.menu.topbar.closeWorkflowTab(nameB)
|
||||
// Close inactive B via middle-click — no save dialog expected
|
||||
await comfyPage.menu.topbar.getWorkflowTab(nameB).click({
|
||||
button: 'middle'
|
||||
})
|
||||
await comfyPage.nextFrame()
|
||||
|
||||
// A should still have its own content
|
||||
|
||||
Reference in New Issue
Block a user