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:
dante01yoon
2026-04-02 22:52:24 +09:00
parent 0be22ec64a
commit f0a5e6d22c
2 changed files with 15 additions and 69 deletions

View File

@@ -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)
})
})

View File

@@ -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