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 <amp@ampcode.com>
This commit is contained in:
Alexander Brown
2026-01-30 19:02:53 -08:00
parent a014e8a5da
commit 2717f8d489

View File

@@ -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()