mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-19 13:59:28 +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>
109 lines
3.3 KiB
TypeScript
109 lines
3.3 KiB
TypeScript
import { expect } from '@playwright/test'
|
|
|
|
import { comfyPageFixture as test } from '@e2e/fixtures/ComfyPage'
|
|
import { TestIds } from '@e2e/fixtures/selectors'
|
|
import {
|
|
interceptClipboardWrite,
|
|
getClipboardText
|
|
} from '@e2e/helpers/clipboardSpy'
|
|
import { openErrorsTabViaSeeErrors } from '@e2e/tests/propertiesPanel/ErrorsTabHelper'
|
|
|
|
test.describe('Errors tab - Missing models', { tag: '@ui' }, () => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting('Comfy.UseNewMenu', 'Top')
|
|
await comfyPage.settings.setSetting(
|
|
'Comfy.RightSidePanel.ShowErrorsTab',
|
|
true
|
|
)
|
|
await expect
|
|
.poll(async () => {
|
|
return await comfyPage.page.evaluate(async (url: string) => {
|
|
const response = await fetch(`${url}/api/devtools/cleanup_fake_model`)
|
|
return response.ok
|
|
}, comfyPage.url)
|
|
})
|
|
.toBeTruthy()
|
|
})
|
|
|
|
test('Should show missing models group in errors tab', async ({
|
|
comfyPage
|
|
}) => {
|
|
await openErrorsTabViaSeeErrors(comfyPage, 'missing/missing_models')
|
|
|
|
await expect(
|
|
comfyPage.page.getByTestId(TestIds.dialogs.missingModelsGroup)
|
|
).toBeVisible()
|
|
})
|
|
|
|
test('Should display model name with referencing node count', async ({
|
|
comfyPage
|
|
}) => {
|
|
await openErrorsTabViaSeeErrors(comfyPage, 'missing/missing_models')
|
|
|
|
const modelsGroup = comfyPage.page.getByTestId(
|
|
TestIds.dialogs.missingModelsGroup
|
|
)
|
|
await expect(modelsGroup).toContainText(/fake_model\.safetensors\s*\(\d+\)/)
|
|
})
|
|
|
|
test('Should expand model row to show referencing nodes', async ({
|
|
comfyPage
|
|
}) => {
|
|
await openErrorsTabViaSeeErrors(
|
|
comfyPage,
|
|
'missing/missing_models_with_nodes'
|
|
)
|
|
|
|
const locateButton = comfyPage.page.getByTestId(
|
|
TestIds.dialogs.missingModelLocate
|
|
)
|
|
await expect(locateButton.first()).toBeHidden()
|
|
|
|
const expandButton = comfyPage.page.getByTestId(
|
|
TestIds.dialogs.missingModelExpand
|
|
)
|
|
await expect(expandButton.first()).toBeVisible()
|
|
await expandButton.first().click()
|
|
|
|
await expect(locateButton.first()).toBeVisible()
|
|
})
|
|
|
|
test('Should copy model name to clipboard', async ({ comfyPage }) => {
|
|
await openErrorsTabViaSeeErrors(comfyPage, 'missing/missing_models')
|
|
await interceptClipboardWrite(comfyPage.page)
|
|
|
|
const copyButton = comfyPage.page.getByTestId(
|
|
TestIds.dialogs.missingModelCopyName
|
|
)
|
|
await expect(copyButton.first()).toBeVisible()
|
|
await copyButton.first().click()
|
|
|
|
const copiedText = await getClipboardText(comfyPage.page)
|
|
expect(copiedText).toContain('fake_model.safetensors')
|
|
})
|
|
|
|
test.describe('OSS-specific', { tag: '@oss' }, () => {
|
|
test('Should show Copy URL button for non-asset models', async ({
|
|
comfyPage
|
|
}) => {
|
|
await openErrorsTabViaSeeErrors(comfyPage, 'missing/missing_models')
|
|
|
|
const copyUrlButton = comfyPage.page.getByTestId(
|
|
TestIds.dialogs.missingModelCopyUrl
|
|
)
|
|
await expect(copyUrlButton.first()).toBeVisible()
|
|
})
|
|
|
|
test('Should show Download button for downloadable models', async ({
|
|
comfyPage
|
|
}) => {
|
|
await openErrorsTabViaSeeErrors(comfyPage, 'missing/missing_models')
|
|
|
|
const downloadButton = comfyPage.page.getByTestId(
|
|
TestIds.dialogs.missingModelDownload
|
|
)
|
|
await expect(downloadButton.first()).toBeVisible()
|
|
})
|
|
})
|
|
})
|