diff --git a/browser_tests/fixtures/components/ComfyNodeSearchBox.ts b/browser_tests/fixtures/components/ComfyNodeSearchBox.ts index 8bc8949d58..c93cd56cee 100644 --- a/browser_tests/fixtures/components/ComfyNodeSearchBox.ts +++ b/browser_tests/fixtures/components/ComfyNodeSearchBox.ts @@ -55,15 +55,22 @@ export class ComfyNodeSearchBox { async fillAndSelectFirstNode( nodeName: string, - options?: { suggestionIndex: number } + options?: { suggestionIndex?: number; exact?: boolean } ) { await this.input.waitFor({ state: 'visible' }) await this.input.fill(nodeName) await this.dropdown.waitFor({ state: 'visible' }) - await this.dropdown - .locator('li') - .nth(options?.suggestionIndex || 0) - .click() + if (options?.exact) { + await this.dropdown + .locator(`li[aria-label="${nodeName}"]`) + .first() + .click() + } else { + await this.dropdown + .locator('li') + .nth(options?.suggestionIndex || 0) + .click() + } } async addFilter(filterValue: string, filterType: string) { diff --git a/browser_tests/tests/nodeSearchBox.spec.ts b/browser_tests/tests/nodeSearchBox.spec.ts index fc6d3ccb4f..f772a02023 100644 --- a/browser_tests/tests/nodeSearchBox.spec.ts +++ b/browser_tests/tests/nodeSearchBox.spec.ts @@ -110,7 +110,9 @@ test.describe('Node search box', { tag: '@node' }, () => { await comfyPage.canvasOps.disconnectEdge() await expect(comfyPage.searchBox.input).toHaveCount(1) await comfyPage.page.locator('.p-chip-remove-icon').click() - await comfyPage.searchBox.fillAndSelectFirstNode('KSampler') + await comfyPage.searchBox.fillAndSelectFirstNode('KSampler', { + exact: true + }) await expect(comfyPage.canvas).toHaveScreenshot( 'added-node-no-connection.png' )