Skip to content

Commit

Permalink
Move groupnode test teardown logic to afterEach
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-byrne committed Sep 25, 2024
1 parent 2387a5e commit 8c39f33
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
9 changes: 9 additions & 0 deletions browser_tests/ComfyPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,15 @@ class NodeLibrarySidebarTab {
await this.nodeLibraryTree.waitFor({ state: 'visible' })
}

async close() {
if (!this.tabButton.isVisible()) {
return
}

await this.tabButton.click()
await this.nodeLibraryTree.waitFor({ state: 'hidden' })
}

folderSelector(folderName: string) {
return `.p-tree-node-content:has(> .tree-explorer-node-label:has(.tree-folder .node-label:has-text("${folderName}")))`
}
Expand Down
13 changes: 7 additions & 6 deletions browser_tests/groupNode.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ test.describe('Group Node', () => {
await libraryTab.open()
})

test.afterEach(async ({ comfyPage }) => {
await comfyPage.setSetting('Comfy.NodeLibrary.Bookmarks.V2', [])
await libraryTab.close()
})

test('Is added to node library sidebar', async ({ comfyPage }) => {
expect(await libraryTab.getFolder('group nodes').count()).toBe(1)
})
Expand All @@ -29,8 +34,8 @@ test.describe('Group Node', () => {
const initialNodeCount = await comfyPage.getGraphNodesCount()

// Add group node from node library sidebar
await libraryTab.getFolder(groupNodeCategory).first().click()
await libraryTab.getNode(groupNodeName).first().click()
await libraryTab.getFolder(groupNodeCategory).click()
await libraryTab.getNode(groupNodeName).click()

// Verify the node is added to the canvas
expect(await comfyPage.getGraphNodesCount()).toBe(initialNodeCount + 1)
Expand All @@ -41,7 +46,6 @@ test.describe('Group Node', () => {
await libraryTab
.getNode(groupNodeName)
.locator('.bookmark-button')
.first()
.click()

// Verify the node is added to the bookmarks tab
Expand All @@ -62,15 +66,13 @@ test.describe('Group Node', () => {
expect(
await comfyPage.getSetting('Comfy.NodeLibrary.Bookmarks.V2')
).toHaveLength(0)
await comfyPage.setSetting('Comfy.NodeLibrary.Bookmarks.V2', [])
})

test('Displays preview on bookmark hover', async ({ comfyPage }) => {
await libraryTab.getFolder(groupNodeCategory).click()
await libraryTab
.getNode(groupNodeName)
.locator('.bookmark-button')
.first()
.click()
await comfyPage.page.hover('.p-tree-node-label.tree-explorer-node-label')
expect(await comfyPage.page.isVisible('.node-lib-node-preview')).toBe(
Expand All @@ -81,7 +83,6 @@ test.describe('Group Node', () => {
.locator('.bookmark-button')
.first()
.click()
await comfyPage.setSetting('Comfy.NodeLibrary.Bookmarks.V2', [])
})
})

Expand Down

0 comments on commit 8c39f33

Please sign in to comment.