mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-09 15:10:17 +00:00
fix(browser_tests): replace .nth() with semantic selectors
- Remove unused saveButton selector from ComfyMenu - Replace widgetTextBox .nth(1) with node-scoped selector - Replace .nth(3) toast selector with .p-toast-message filter - Replace .nth(1) category selector with getByTestId - Replace .nth(1) node selector with getNodeInFolder() helper - Add nodeSelector(), folderSelector(), getNodeInFolder() methods - Add saveButton and nodeLibrary TestIds to selectors.ts Amp-Thread-ID: https://ampcode.com/threads/T-019c155c-92e1-76f3-b6ce-7fc3ffa11582 Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -183,9 +183,8 @@ test.describe('Node library sidebar', () => {
|
||||
])
|
||||
const tab = comfyPage.menu.nodeLibraryTab
|
||||
await tab.getFolder('sampling').click()
|
||||
await comfyPage.page
|
||||
.locator(tab.nodeSelector('KSampler (Advanced)'))
|
||||
.nth(1)
|
||||
await tab
|
||||
.getNodeInFolder('KSampler (Advanced)', 'sampling')
|
||||
.locator('.bookmark-button')
|
||||
.click()
|
||||
expect(
|
||||
|
||||
@@ -109,19 +109,16 @@ test.describe('Settings Search functionality', { tag: '@settings' }, () => {
|
||||
const settingsDialog = comfyPage.page.locator('.settings-container')
|
||||
await expect(settingsDialog).toBeVisible()
|
||||
|
||||
// Get categories and click on different ones
|
||||
const categories = comfyPage.page.locator(
|
||||
'.settings-sidebar .p-listbox-option'
|
||||
// Click on a specific category (Appearance) to verify category switching
|
||||
const appearanceCategory = comfyPage.page.getByTestId(
|
||||
'settings-tab-Appearance'
|
||||
)
|
||||
const categoryCount = await categories.count()
|
||||
await appearanceCategory.click()
|
||||
|
||||
if (categoryCount > 1) {
|
||||
// Click on the second category
|
||||
await categories.nth(1).click()
|
||||
|
||||
// Verify the category is selected
|
||||
await expect(categories.nth(1)).toHaveClass(/p-listbox-option-selected/)
|
||||
}
|
||||
// Verify the category is selected by checking if its parent option has the selected class
|
||||
await expect(appearanceCategory.locator('xpath=ancestor::li')).toHaveClass(
|
||||
/p-listbox-option-selected/
|
||||
)
|
||||
})
|
||||
|
||||
test('settings content area is visible', async ({ comfyPage }) => {
|
||||
|
||||
@@ -103,10 +103,9 @@ test.describe('Version Mismatch Warnings', { tag: '@slow' }, () => {
|
||||
await comfyPage.setup()
|
||||
|
||||
// Locate the warning toast and dismiss it
|
||||
const warningToast = comfyPage.page
|
||||
.locator('div')
|
||||
.filter({ hasText: 'Version Compatibility' })
|
||||
.nth(3)
|
||||
const warningToast = comfyPage.page.locator('.p-toast-message').filter({
|
||||
hasText: 'Version Compatibility'
|
||||
})
|
||||
await warningToast.waitFor({ state: 'visible' })
|
||||
const dismissButton = warningToast.getByRole('button', { name: 'Close' })
|
||||
await dismissButton.click()
|
||||
|
||||
Reference in New Issue
Block a user