This commit is contained in:
pythongosssss
2026-02-25 07:21:17 -08:00
parent edd99ead6d
commit 7bc57bc84c
2 changed files with 24 additions and 11 deletions

View File

@@ -6,13 +6,27 @@ export class ComfyNodeSearchBoxV2 {
readonly dialog: Locator
readonly input: Locator
readonly results: Locator
readonly filterOptions: Locator
constructor(readonly page: Page) {
this.dialog = page.getByRole('search')
this.input = this.dialog.locator('input[type="text"]')
this.results = this.dialog.getByTestId('result-item')
this.filterOptions = this.dialog.getByTestId('filter-option')
}
get filterChips(): Locator {
return this.dialog.getByTestId('filter-chip')
}
get filterPopover(): Locator {
return this.dialog.getByRole('dialog')
}
get filterPopoverOptions(): Locator {
return this.filterPopover.getByRole('option')
}
get filterPopoverSearch(): Locator {
return this.filterPopover.getByRole('textbox', { name: 'Search' })
}
categoryButton(categoryId: string): Locator {

View File

@@ -93,23 +93,22 @@ test.describe('Node search box V2', { tag: '@node' }, () => {
await comfyPage.canvasOps.doubleClick()
await expect(searchBoxV2.input).toBeVisible()
// Click "Input" filter chip in the filter bar
// Click "Input" filter chip to open the popover
await searchBoxV2.filterBarButton('Input').click()
// Filter options should appear
await expect(searchBoxV2.filterOptions.first()).toBeVisible()
await expect(searchBoxV2.filterPopover).toBeVisible()
// Type to narrow and select MODEL
await searchBoxV2.input.fill('MODEL')
await searchBoxV2.filterOptions
await searchBoxV2.filterPopoverSearch.fill('MODEL')
await searchBoxV2.filterPopoverOptions
.filter({ hasText: 'MODEL' })
.first()
.click()
// Close the popover by pressing Escape
await searchBoxV2.filterPopoverSearch.press('Escape')
// Filter chip should appear and results should be filtered
await expect(
searchBoxV2.dialog.getByText('Input:', { exact: false }).locator('..')
).toContainText('MODEL')
await expect(searchBoxV2.filterChips.first()).toContainText('MODEL')
await expect(searchBoxV2.results.first()).toBeVisible()
})
})