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>
58 lines
2.1 KiB
TypeScript
58 lines
2.1 KiB
TypeScript
import { expect } from '@playwright/test'
|
|
|
|
import { comfyPageFixture as test } from '@e2e/fixtures/ComfyPage'
|
|
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting('Comfy.UseNewMenu', 'Disabled')
|
|
})
|
|
|
|
test.describe('DOM Widget', { tag: '@widget' }, () => {
|
|
test('Collapsed multiline textarea is not visible', async ({ comfyPage }) => {
|
|
await comfyPage.workflow.loadWorkflow('widgets/collapsed_multiline')
|
|
const textareaWidget = comfyPage.page.locator('.comfy-multiline-input')
|
|
await expect(textareaWidget).toBeHidden()
|
|
})
|
|
|
|
test('Multiline textarea correctly collapses', async ({ comfyPage }) => {
|
|
const multilineTextAreas = comfyPage.page.locator('.comfy-multiline-input')
|
|
const firstMultiline = multilineTextAreas.first()
|
|
const lastMultiline = multilineTextAreas.last()
|
|
|
|
await expect(firstMultiline).toBeVisible()
|
|
await expect(lastMultiline).toBeVisible()
|
|
|
|
const nodes = await comfyPage.nodeOps.getNodeRefsByType('CLIPTextEncode')
|
|
for (const node of nodes) {
|
|
await node.click('collapse')
|
|
}
|
|
await expect(firstMultiline).toBeHidden()
|
|
await expect(lastMultiline).toBeHidden()
|
|
})
|
|
|
|
test(
|
|
'Position update when entering focus mode',
|
|
{ tag: '@screenshot' },
|
|
async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting('Comfy.UseNewMenu', 'Top')
|
|
await comfyPage.command.executeCommand('Workspace.ToggleFocusMode')
|
|
await expect(comfyPage.menu.sideToolbar).toBeHidden()
|
|
await expect(comfyPage.canvas).toHaveScreenshot('focus-mode-on.png')
|
|
}
|
|
)
|
|
|
|
// No DOM widget should be created by creation of interim LGraphNode objects.
|
|
test('Copy node with DOM widget by dragging + alt', async ({ comfyPage }) => {
|
|
const initialCount = await comfyPage.domWidgets.count()
|
|
|
|
// TextEncodeNode1
|
|
await comfyPage.page.mouse.move(618, 191)
|
|
await comfyPage.page.keyboard.down('Alt')
|
|
await comfyPage.page.mouse.down()
|
|
await comfyPage.page.mouse.move(100, 100)
|
|
await comfyPage.page.mouse.up()
|
|
await comfyPage.page.keyboard.up('Alt')
|
|
|
|
await expect(comfyPage.domWidgets).toHaveCount(initialCount + 1)
|
|
})
|
|
})
|