mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 06:20:11 +00:00
fix test
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user