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>
101 lines
2.6 KiB
TypeScript
101 lines
2.6 KiB
TypeScript
import type { Locator, Page } from '@playwright/test'
|
|
import { expect } from '@playwright/test'
|
|
|
|
import { TestIds } from '@e2e/fixtures/selectors'
|
|
|
|
export class PropertiesPanelHelper {
|
|
readonly root: Locator
|
|
readonly panelTitle: Locator
|
|
readonly searchBox: Locator
|
|
readonly closeButton: Locator
|
|
|
|
constructor(readonly page: Page) {
|
|
this.root = page.getByTestId(TestIds.propertiesPanel.root)
|
|
this.panelTitle = this.root.locator('h3')
|
|
this.searchBox = this.root.getByPlaceholder(/^Search/)
|
|
this.closeButton = this.root.locator('button[aria-pressed]')
|
|
}
|
|
|
|
get tabs(): Locator {
|
|
return this.root.locator('nav button')
|
|
}
|
|
|
|
getTab(label: string): Locator {
|
|
return this.root.locator('nav button', { hasText: label })
|
|
}
|
|
|
|
get titleEditIcon(): Locator {
|
|
return this.panelTitle.locator('i[class*="lucide--pencil"]')
|
|
}
|
|
|
|
get titleInput(): Locator {
|
|
return this.root.getByTestId(TestIds.node.titleInput)
|
|
}
|
|
|
|
getNodeStateButton(state: 'Normal' | 'Bypass' | 'Mute'): Locator {
|
|
return this.root.locator('button', { hasText: state })
|
|
}
|
|
|
|
getColorSwatch(colorName: string): Locator {
|
|
return this.root.locator(`[data-testid="${colorName}"]`)
|
|
}
|
|
|
|
get pinnedSwitch(): Locator {
|
|
return this.root.locator('[data-p-checked]').first()
|
|
}
|
|
|
|
get subgraphEditButton(): Locator {
|
|
return this.root.locator('button:has(i[class*="lucide--settings-2"])')
|
|
}
|
|
|
|
get contentArea(): Locator {
|
|
return this.root.locator('.scrollbar-thin')
|
|
}
|
|
|
|
get errorsTabIcon(): Locator {
|
|
return this.root.locator('nav i[class*="lucide--octagon-alert"]')
|
|
}
|
|
|
|
get viewAllSettingsButton(): Locator {
|
|
return this.root.getByRole('button', { name: /view all settings/i })
|
|
}
|
|
|
|
get collapseToggleButton(): Locator {
|
|
return this.root.locator(
|
|
'button:has(i[class*="lucide--chevrons-down-up"]), button:has(i[class*="lucide--chevrons-up-down"])'
|
|
)
|
|
}
|
|
|
|
async open(actionbar: Locator): Promise<void> {
|
|
if (!(await this.root.isVisible())) {
|
|
await actionbar.click()
|
|
await expect(this.root).toBeVisible()
|
|
}
|
|
}
|
|
|
|
async close(): Promise<void> {
|
|
if (await this.root.isVisible()) {
|
|
await this.closeButton.click()
|
|
await expect(this.root).toBeHidden()
|
|
}
|
|
}
|
|
|
|
async switchToTab(label: string): Promise<void> {
|
|
await this.getTab(label).click()
|
|
}
|
|
|
|
async editTitle(newTitle: string): Promise<void> {
|
|
await this.titleEditIcon.click()
|
|
await this.titleInput.fill(newTitle)
|
|
await this.titleInput.press('Enter')
|
|
}
|
|
|
|
async searchWidgets(query: string): Promise<void> {
|
|
await this.searchBox.fill(query)
|
|
}
|
|
|
|
async clearSearch(): Promise<void> {
|
|
await this.searchBox.fill('')
|
|
}
|
|
}
|