Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into less-annoying-tooltips
Browse files Browse the repository at this point in the history
  • Loading branch information
pythongosssss committed Sep 25, 2024
2 parents a0317c0 + 941f71f commit a881ec1
Show file tree
Hide file tree
Showing 38 changed files with 1,147 additions and 277 deletions.
1 change: 0 additions & 1 deletion .github/workflows/test-browser-exp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ name: Update Playwright Expectations
on:
pull_request:
types: [ labeled ]
branches: [ main, master ]

jobs:
test:
Expand Down
25 changes: 21 additions & 4 deletions browser_tests/ComfyPage.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Page, Locator } from '@playwright/test'
import { test as base } from '@playwright/test'
import { expect } from '@playwright/test'
import dotenv from 'dotenv'
dotenv.config()
import * as fs from 'fs'
Expand Down Expand Up @@ -138,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 Expand Up @@ -705,8 +715,8 @@ export class ComfyPage {
await dialog.accept(groupNodeName)
})
await this.canvas.press('Control+a')
await this.rightClickEmptyLatentNode()
await this.page.getByText('Convert to Group Node').click()
const node = await this.getFirstNodeRef()
await node!.clickContextMenuOption('Convert to Group Node')
await this.nextFrame()
}
async convertOffsetToCanvas(pos: [number, number]) {
Expand All @@ -721,13 +731,20 @@ export class ComfyPage {
return Promise.all(
(
await this.page.evaluate((type) => {
return window['app'].graph._nodes
return window['app'].graph.nodes
.filter((n) => n.type === type)
.map((n) => n.id)
}, type)
).map((id: NodeId) => this.getNodeRefById(id))
)
}
async getFirstNodeRef(): Promise<NodeReference | null> {
const id = await this.page.evaluate(() => {
return window['app'].graph.nodes[0]?.id
})
if (!id) return null
return this.getNodeRefById(id)
}
}
class NodeSlotReference {
constructor(
Expand Down Expand Up @@ -867,7 +884,7 @@ class NodeReference {
await this.clickContextMenuOption('Convert to Group Node')
await this.comfyPage.nextFrame()
const nodes = await this.comfyPage.getNodeRefsByType(
`workflow/${groupNodeName}`
`workflow>${groupNodeName}`
)
if (nodes.length !== 1) {
throw new Error(`Did not find single group node (found=${nodes.length})`)
Expand Down
Loading

0 comments on commit a881ec1

Please sign in to comment.