mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 06:20:11 +00:00
## Summary Add eslint-plugin-playwright as an oxlint JS plugin scoped to browser_tests/, enforcing Playwright best practices at lint time. ## Changes - **What**: Configure eslint-plugin-playwright@2.10.1 via oxlint's alpha `jsPlugins` field (`.oxlintrc.json` override scoped to `browser_tests/**/*.ts`). 18 recommended rules + `prefer-native-locators` + `require-to-pass-timeout` at error severity. All 173 initial violations resolved (config, auto-fix, manual fixes). `no-force-option` set to off — 28 violations need triage (canvas overlay workarounds vs unnecessary force) in a dedicated PR. - **Dependencies**: `eslint-plugin-playwright@^2.10.1` (devDependency, required by oxlint jsPlugins at runtime) ## Review Focus - `.oxlintrc.json` override structure — this is the first use of oxlint's JS plugins alpha feature in this repo - Manual fixes in spec files: `waitForSelector` → `locator.waitFor`, deprecated page methods → locator equivalents, `toPass()` timeout additions - Compound CSS selectors replaced with `.and()` (Playwright native locator composition) to avoid `prefer-native-locators` suppressions - Lint script changes in `package.json` to include `browser_tests/` in oxlint targets --------- Co-authored-by: Amp <amp@ampcode.com> Co-authored-by: GitHub Action <action@github.com>
58 lines
2.0 KiB
TypeScript
58 lines
2.0 KiB
TypeScript
import type { Page } from '@playwright/test'
|
|
import { expect } from '@playwright/test'
|
|
|
|
import { comfyPageFixture as test } from '@e2e/fixtures/ComfyPage'
|
|
import { TestIds } from '@e2e/fixtures/selectors'
|
|
|
|
/** Locate a workflow label in whatever panel is visible (browse or search). */
|
|
function findWorkflow(page: Page, name: string) {
|
|
return page
|
|
.getByTestId(TestIds.sidebar.workflows)
|
|
.locator('.node-label', { hasText: name })
|
|
}
|
|
|
|
test.describe('Workflow sidebar - search', () => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.workflow.setupWorkflowsDirectory({
|
|
'alpha-workflow.json': 'default.json',
|
|
'beta-workflow.json': 'default.json'
|
|
})
|
|
})
|
|
|
|
test('Search filters saved workflows by name', async ({ comfyPage }) => {
|
|
const tab = comfyPage.menu.workflowsTab
|
|
await tab.open()
|
|
|
|
const searchInput = comfyPage.page.getByPlaceholder('Search Workflow...')
|
|
await searchInput.fill('alpha')
|
|
|
|
await expect(findWorkflow(comfyPage.page, 'alpha-workflow')).toBeVisible()
|
|
await expect(findWorkflow(comfyPage.page, 'beta-workflow')).toBeHidden()
|
|
})
|
|
|
|
test('Clearing search restores all workflows', async ({ comfyPage }) => {
|
|
const tab = comfyPage.menu.workflowsTab
|
|
await tab.open()
|
|
|
|
const searchInput = comfyPage.page.getByPlaceholder('Search Workflow...')
|
|
await searchInput.fill('alpha')
|
|
await expect(findWorkflow(comfyPage.page, 'beta-workflow')).toBeHidden()
|
|
|
|
await searchInput.fill('')
|
|
|
|
await expect(tab.getPersistedItem('alpha-workflow')).toBeVisible()
|
|
await expect(tab.getPersistedItem('beta-workflow')).toBeVisible()
|
|
})
|
|
|
|
test('Search with no matches shows empty results', async ({ comfyPage }) => {
|
|
const tab = comfyPage.menu.workflowsTab
|
|
await tab.open()
|
|
|
|
const searchInput = comfyPage.page.getByPlaceholder('Search Workflow...')
|
|
await searchInput.fill('nonexistent_xyz')
|
|
|
|
await expect(findWorkflow(comfyPage.page, 'alpha-workflow')).toBeHidden()
|
|
await expect(findWorkflow(comfyPage.page, 'beta-workflow')).toBeHidden()
|
|
})
|
|
})
|