From 2717f8d4897476b0ec63a8babcad65f52c208ba4 Mon Sep 17 00:00:00 2001 From: Alexander Brown <448862+DrJKL@users.noreply.github.com> Date: Fri, 30 Jan 2026 19:02:53 -0800 Subject: [PATCH] test: migrate brittle :nth-child() selectors to getByRole('radio') - Replace 4 CSS selectors with semantic locators in nodeLibrary.spec.ts - Uses PrimeVue SelectButton's accessible radio button names - Part of Playwright best practices remediation Amp-Thread-ID: https://ampcode.com/threads/T-019c11ff-0d10-771a-abaf-7d8d908800b3 Co-authored-by: Amp --- browser_tests/tests/sidebar/nodeLibrary.spec.ts | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/browser_tests/tests/sidebar/nodeLibrary.spec.ts b/browser_tests/tests/sidebar/nodeLibrary.spec.ts index 8bdd67a9b..9f6cf33a4 100644 --- a/browser_tests/tests/sidebar/nodeLibrary.spec.ts +++ b/browser_tests/tests/sidebar/nodeLibrary.spec.ts @@ -197,12 +197,8 @@ test.describe('Node library sidebar', () => { const tab = comfyPage.menu.nodeLibraryTab await tab.getFolder('foo').click({ button: 'right' }) await comfyPage.page.getByLabel('Customize').click() - await comfyPage.page - .locator('.icon-field .p-selectbutton > *:nth-child(2)') - .click() - await comfyPage.page - .locator('.color-field .p-selectbutton > *:nth-child(2)') - .click() + await comfyPage.page.getByRole('radio', { name: 'Folder' }).click() + await comfyPage.page.getByRole('radio', { name: 'Blue' }).click() await comfyPage.page.getByRole('button', { name: 'Confirm' }).click() await comfyPage.nextFrame() expect( @@ -220,9 +216,7 @@ test.describe('Node library sidebar', () => { const tab = comfyPage.menu.nodeLibraryTab await tab.getFolder('foo').click({ button: 'right' }) await comfyPage.page.getByLabel('Customize').click() - await comfyPage.page - .locator('.icon-field .p-selectbutton > *:nth-child(2)') - .click() + await comfyPage.page.getByRole('radio', { name: 'Folder' }).click() await comfyPage.page.getByRole('button', { name: 'Confirm' }).click() await comfyPage.nextFrame() expect( @@ -258,9 +252,7 @@ test.describe('Node library sidebar', () => { await comfyPage.page.locator('.p-colorpicker-color-background').click() // Finalize the customization - await comfyPage.page - .locator('.icon-field .p-selectbutton > *:nth-child(2)') - .click() + await comfyPage.page.getByRole('radio', { name: 'Folder' }).click() await comfyPage.page.getByRole('button', { name: 'Confirm' }).click() await comfyPage.nextFrame()