Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
28 changes: 28 additions & 0 deletions browser_tests/tests/workflowPersistence.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1316,3 +1316,31 @@ test.describe('Workflow Persistence', () => {
.toBeLessThanOrEqual(101)
})
})

const workflowListing404Test = test.extend({
initialLocalStorage: {
'Comfy.Workflow.LastOpenPaths:personal': JSON.stringify({
workspaceId: 'personal',
paths: ['workflows/missing.json'],
activeIndex: 0
})
},
page: async ({ page }, use) => {
await page.route('**/api/userdata?dir=workflows&*', (route) =>
route.fulfill({ status: 404 })
)
await use(page)
}
})

workflowListing404Test(
'Loads the default workflow when the workflow listing returns 404',
async ({ comfyPage }) => {
await expect
.poll(() => comfyPage.menu.topbar.getTabNames())
.toEqual(['Unsaved Workflow'])
await expect
.poll(() => comfyPage.nodeOps.getGraphNodesCount())
.toBeGreaterThan(0)
}
)
3 changes: 2 additions & 1 deletion src/components/graph/GraphCanvas.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ vi.mock<unknown>(import('@/scripts/app'), () => {
rootGraphInternal = graph
},
ui: { settings: { dispatchChange: vi.fn() } },
setup: vi.fn()
setup: vi.fn(),
loadGraphData: vi.fn()
}
}
})
Expand Down
2 changes: 2 additions & 0 deletions src/components/graph/GraphCanvas.vue
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,8 @@ onMounted(async () => {
startupOutcome = await workflowPersistence.initializeWorkflow()
await workflowPersistence.restoreWorkflowTabsState()
urlTemplateId = await workflowPersistence.loadTemplateFromUrlIfPresent()
if (!workflowStore.activeWorkflow)
await useWorkflowService().loadDefaultWorkflow()
await useFirstRunEntry().handleStartupOutcome(startupOutcome)
})
bootstrapOutcome = 'completed'
Expand Down
Loading