mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +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>
99 lines
3.3 KiB
TypeScript
99 lines
3.3 KiB
TypeScript
import {
|
|
comfyExpect as expect,
|
|
comfyPageFixture as test
|
|
} from '@e2e/fixtures/ComfyPage'
|
|
|
|
test.describe('Advanced Widget Visibility', () => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', true)
|
|
await comfyPage.settings.setSetting(
|
|
'Comfy.Node.AlwaysShowAdvancedWidgets',
|
|
false
|
|
)
|
|
|
|
// Add a ModelSamplingFlux node which has both advanced (max_shift,
|
|
// base_shift) and non-advanced (width, height) widgets.
|
|
await comfyPage.page.evaluate(() => {
|
|
const node = window.LiteGraph!.createNode('ModelSamplingFlux')!
|
|
node.pos = [500, 200]
|
|
window.app!.graph.add(node)
|
|
})
|
|
await comfyPage.vueNodes.waitForNodes()
|
|
})
|
|
|
|
function getNode(
|
|
comfyPage: Parameters<Parameters<typeof test>[2]>[0]['comfyPage']
|
|
) {
|
|
return comfyPage.vueNodes.getNodeByTitle('ModelSamplingFlux')
|
|
}
|
|
|
|
function getWidgets(
|
|
comfyPage: Parameters<Parameters<typeof test>[2]>[0]['comfyPage']
|
|
) {
|
|
return getNode(comfyPage).locator('.lg-node-widget')
|
|
}
|
|
|
|
test('should hide advanced widgets by default', async ({ comfyPage }) => {
|
|
const node = getNode(comfyPage)
|
|
const widgets = getWidgets(comfyPage)
|
|
|
|
// Non-advanced widgets (width, height) should be visible
|
|
await expect(widgets).toHaveCount(2)
|
|
await expect(node.getByLabel('width', { exact: true })).toBeVisible()
|
|
await expect(node.getByLabel('height', { exact: true })).toBeVisible()
|
|
|
|
// Advanced widgets should not be rendered
|
|
await expect(node.getByLabel('max_shift', { exact: true })).toBeHidden()
|
|
await expect(node.getByLabel('base_shift', { exact: true })).toBeHidden()
|
|
|
|
// "Show advanced inputs" button should be present
|
|
await expect(node.getByText('Show advanced inputs')).toBeVisible()
|
|
})
|
|
|
|
test('should show advanced widgets when per-node toggle is clicked', async ({
|
|
comfyPage
|
|
}) => {
|
|
const node = getNode(comfyPage)
|
|
const widgets = getWidgets(comfyPage)
|
|
|
|
await expect(widgets).toHaveCount(2)
|
|
|
|
// Click the toggle button to show advanced widgets
|
|
await node.getByText('Show advanced inputs').click()
|
|
|
|
await expect(widgets).toHaveCount(4)
|
|
await expect(node.getByLabel('max_shift', { exact: true })).toBeVisible()
|
|
await expect(node.getByLabel('base_shift', { exact: true })).toBeVisible()
|
|
|
|
// Button text should change to "Hide advanced inputs"
|
|
await expect(node.getByText('Hide advanced inputs')).toBeVisible()
|
|
|
|
// Click again to hide
|
|
await node.getByText('Hide advanced inputs').click()
|
|
await expect(widgets).toHaveCount(2)
|
|
})
|
|
|
|
test('should show advanced widgets when global setting is enabled', async ({
|
|
comfyPage
|
|
}) => {
|
|
const node = getNode(comfyPage)
|
|
const widgets = getWidgets(comfyPage)
|
|
|
|
await expect(widgets).toHaveCount(2)
|
|
|
|
// Enable the global setting
|
|
await comfyPage.settings.setSetting(
|
|
'Comfy.Node.AlwaysShowAdvancedWidgets',
|
|
true
|
|
)
|
|
|
|
// All 4 widgets should now be visible
|
|
await expect(widgets).toHaveCount(4)
|
|
await expect(node.getByLabel('max_shift', { exact: true })).toBeVisible()
|
|
await expect(node.getByLabel('base_shift', { exact: true })).toBeVisible()
|
|
|
|
// The toggle button should not be shown when global setting is active
|
|
await expect(node.getByText('Show advanced inputs')).toBeHidden()
|
|
})
|
|
})
|