Fix saved workflow cleanup in menu tests (#1142)

* Fix saved workflow cleanup in menu tests

* Clear workflow dir before each test
This commit is contained in:
bymyself
2024-10-07 06:35:15 -07:00
committed by GitHub
parent c83ce863d7
commit a95a6f9b47

View File

@@ -389,6 +389,8 @@ test.describe('Menu', () => {
// Open the sidebar // Open the sidebar
const tab = comfyPage.menu.workflowsTab const tab = comfyPage.menu.workflowsTab
await tab.open() await tab.open()
await comfyPage.setupWorkflowsDirectory({})
}) })
test('Can create new blank workflow', async ({ comfyPage }) => { test('Can create new blank workflow', async ({ comfyPage }) => {
@@ -441,7 +443,9 @@ test.describe('Menu', () => {
test('Can close saved-workflows from the open workflows section', async ({ test('Can close saved-workflows from the open workflows section', async ({
comfyPage comfyPage
}) => { }) => {
await comfyPage.menu.topbar.saveWorkflow('deault') await comfyPage.menu.topbar.saveWorkflow(
`tempWorkflow-${test.info().title}`
)
const closeButton = comfyPage.page.locator( const closeButton = comfyPage.page.locator(
'.comfyui-workflows-open .p-button-icon.pi-times' '.comfyui-workflows-open .p-button-icon.pi-times'
) )
@@ -458,13 +462,7 @@ test.describe('Menu', () => {
'Comfy.Workflow.WorkflowTabsPosition', 'Comfy.Workflow.WorkflowTabsPosition',
'Topbar' 'Topbar'
) )
}) await comfyPage.setupWorkflowsDirectory({})
test.afterEach(async ({ comfyPage }) => {
// Delete the saved workflow for cleanup.
await comfyPage.page.evaluate(async () => {
window['app'].workflowManager.activeWorkflow.delete()
})
}) })
test('Can show opened workflows', async ({ comfyPage }) => { test('Can show opened workflows', async ({ comfyPage }) => {
@@ -474,12 +472,10 @@ test.describe('Menu', () => {
}) })
test('Can close saved-workflow tabs', async ({ comfyPage }) => { test('Can close saved-workflow tabs', async ({ comfyPage }) => {
const savedWorkflowName = 'default' const workflowName = `tempWorkflow-${test.info().title}`
await comfyPage.menu.topbar.saveWorkflow(savedWorkflowName) await comfyPage.menu.topbar.saveWorkflow(workflowName)
expect(await comfyPage.menu.topbar.getTabNames()).toEqual([ expect(await comfyPage.menu.topbar.getTabNames()).toEqual([workflowName])
savedWorkflowName await comfyPage.menu.topbar.closeWorkflowTab(workflowName)
])
await comfyPage.menu.topbar.closeWorkflowTab('default')
expect(await comfyPage.menu.topbar.getTabNames()).toEqual([ expect(await comfyPage.menu.topbar.getTabNames()).toEqual([
'Unsaved Workflow (2)' 'Unsaved Workflow (2)'
]) ])