Skip to content

Commit c222784

Browse files
committed
test: Also test searchbox filtering
1 parent 4e8f383 commit c222784

File tree

2 files changed

+33
-5
lines changed

2 files changed

+33
-5
lines changed

browser_tests/fixtures/ComfyPage.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,32 @@ dotenv.config()
2727

2828
type WorkspaceStore = ReturnType<typeof useWorkspaceStore>
2929

30+
class ComfyPropertiesPanel {
31+
readonly root: Locator
32+
readonly panelTitle: Locator
33+
readonly searchBox: Locator
34+
35+
constructor(readonly page: Page) {
36+
this.root = page.getByTestId('properties-panel')
37+
this.panelTitle = this.root.locator('h3')
38+
this.searchBox = this.root.getByPlaceholder('Search...')
39+
}
40+
}
41+
3042
class ComfyMenu {
3143
private _nodeLibraryTab: NodeLibrarySidebarTab | null = null
3244
private _workflowsTab: WorkflowsSidebarTab | null = null
3345
private _topbar: Topbar | null = null
3446

3547
public readonly sideToolbar: Locator
36-
public readonly propertiesPanel: Locator
48+
public readonly propertiesPanel: ComfyPropertiesPanel
3749
public readonly themeToggleButton: Locator
3850
public readonly saveButton: Locator
3951

4052
constructor(public readonly page: Page) {
4153
this.sideToolbar = page.locator('.side-tool-bar-container')
4254
this.themeToggleButton = page.locator('.comfy-vue-theme-toggle')
43-
this.propertiesPanel = page.getByTestId('properties-panel')
55+
this.propertiesPanel = new ComfyPropertiesPanel(page)
4456
this.saveButton = page
4557
.locator('button[title="Save the current workflow"]')
4658
.nth(0)

browser_tests/tests/propertiesPanel/propertiesPanel.spec.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,28 @@ test.describe('Properties panel', () => {
88

99
const { propertiesPanel } = comfyPage.menu
1010

11-
await expect(propertiesPanel.getByText('No node(s) selected')).toBeVisible()
11+
await expect(propertiesPanel.panelTitle).toContainText(
12+
'No node(s) selected'
13+
)
1214

1315
await comfyPage.selectNodes(['KSampler', 'CLIP Text Encode (Prompt)'])
1416

15-
await expect(propertiesPanel.getByText('3 nodes selected')).toBeVisible()
17+
await expect(propertiesPanel.panelTitle).toContainText('3 nodes selected')
18+
await expect(propertiesPanel.root.getByText('KSampler')).toHaveCount(1)
19+
await expect(
20+
propertiesPanel.root.getByText('CLIP Text Encode (Prompt)')
21+
).toHaveCount(2)
1622

17-
await expect(propertiesPanel.getByText('KSampler')).toHaveCount(1) // Will be 2 in Vue mode
23+
await propertiesPanel.searchBox.fill('seed')
24+
await expect(propertiesPanel.root.getByText('KSampler')).toHaveCount(1)
25+
await expect(
26+
propertiesPanel.root.getByText('CLIP Text Encode (Prompt)')
27+
).toHaveCount(0)
28+
29+
await propertiesPanel.searchBox.fill('')
30+
await expect(propertiesPanel.root.getByText('KSampler')).toHaveCount(1)
31+
await expect(
32+
propertiesPanel.root.getByText('CLIP Text Encode (Prompt)')
33+
).toHaveCount(2)
1834
})
1935
})

0 commit comments

Comments
 (0)