mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-19 22:09:37 +00:00
## Summary Complete the @e2e/ path alias migration started in #10735 by converting all 354 remaining relative imports and adding a lint rule to prevent backsliding. ## Changes - **What**: Migrate all relative imports in browser_tests/ to use `@e2e/` (intra-directory) and `@/` (src/ imports) path aliases. Add `no-restricted-imports` ESLint rule banning `./` and `../` imports in `browser_tests/**/*.ts`. Suppress pre-existing oxlint `no-eval` and `no-console` warnings exposed by touching those files. ## Review Focus - ESLint flat-config merging: the `@playwright/test` ban and relative-import ban are in two separate blocks to avoid last-match-wins collision with the `useI18n`/`useVirtualList` blocks higher in the config. - The `['./**', '../**']` glob patterns (not `['./*', '../*']`) are needed to catch multi-level relative paths like `../../../src/foo`. Follows up on #10735 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-10958-test-migrate-browser_tests-to-e2e-path-alias-and-add-lint-rule-33c6d73d365081649d1be771eac986fd) by [Unito](https://www.unito.io) Co-authored-by: Amp <amp@ampcode.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).not.toBeVisible()
|
|
}
|
|
}
|
|
|
|
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('')
|
|
}
|
|
}
|