Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix group node tests teardown #965

Merged
merged 1 commit into from
Sep 25, 2024
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
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
Loading