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>
110 lines
3.3 KiB
TypeScript
110 lines
3.3 KiB
TypeScript
import { expect } from '@playwright/test'
|
|
|
|
import { comfyPageFixture as test } from '@e2e/fixtures/ComfyPage'
|
|
import { createMockJob } from '@e2e/fixtures/helpers/AssetsHelper'
|
|
import { TestIds } from '@e2e/fixtures/selectors'
|
|
import type { RawJobListItem } from '@/platform/remote/comfyui/jobs/jobTypes'
|
|
|
|
const now = Date.now()
|
|
|
|
const MOCK_JOBS: RawJobListItem[] = [
|
|
createMockJob({
|
|
id: 'job-completed-1',
|
|
status: 'completed',
|
|
create_time: now - 60_000,
|
|
execution_start_time: now - 60_000,
|
|
execution_end_time: now - 50_000,
|
|
outputs_count: 2
|
|
}),
|
|
createMockJob({
|
|
id: 'job-completed-2',
|
|
status: 'completed',
|
|
create_time: now - 120_000,
|
|
execution_start_time: now - 120_000,
|
|
execution_end_time: now - 115_000,
|
|
outputs_count: 1
|
|
}),
|
|
createMockJob({
|
|
id: 'job-failed-1',
|
|
status: 'failed',
|
|
create_time: now - 30_000,
|
|
execution_start_time: now - 30_000,
|
|
execution_end_time: now - 28_000,
|
|
outputs_count: 0
|
|
})
|
|
]
|
|
|
|
test.describe('Queue overlay', () => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.assets.mockOutputHistory(MOCK_JOBS)
|
|
await comfyPage.settings.setSetting('Comfy.Queue.QPOV2', false)
|
|
await comfyPage.setup()
|
|
})
|
|
|
|
test.afterEach(async ({ comfyPage }) => {
|
|
await comfyPage.assets.clearMocks()
|
|
})
|
|
|
|
test('Toggle button opens expanded queue overlay', async ({ comfyPage }) => {
|
|
const toggle = comfyPage.page.getByTestId(TestIds.queue.overlayToggle)
|
|
await toggle.click()
|
|
|
|
// Expanded overlay should show job items
|
|
await expect(comfyPage.page.locator('[data-job-id]').first()).toBeVisible()
|
|
})
|
|
|
|
test('Overlay shows filter tabs (All, Completed)', async ({ comfyPage }) => {
|
|
const toggle = comfyPage.page.getByTestId(TestIds.queue.overlayToggle)
|
|
await toggle.click()
|
|
|
|
await expect(
|
|
comfyPage.page.getByRole('button', { name: 'All', exact: true })
|
|
).toBeVisible()
|
|
await expect(
|
|
comfyPage.page.getByRole('button', { name: 'Completed', exact: true })
|
|
).toBeVisible()
|
|
})
|
|
|
|
test('Overlay shows Failed tab when failed jobs exist', async ({
|
|
comfyPage
|
|
}) => {
|
|
const toggle = comfyPage.page.getByTestId(TestIds.queue.overlayToggle)
|
|
await toggle.click()
|
|
|
|
await expect(comfyPage.page.locator('[data-job-id]').first()).toBeVisible()
|
|
|
|
await expect(
|
|
comfyPage.page.getByRole('button', { name: 'Failed', exact: true })
|
|
).toBeVisible()
|
|
})
|
|
|
|
test('Completed filter shows only completed jobs', async ({ comfyPage }) => {
|
|
const toggle = comfyPage.page.getByTestId(TestIds.queue.overlayToggle)
|
|
await toggle.click()
|
|
|
|
await expect(comfyPage.page.locator('[data-job-id]').first()).toBeVisible()
|
|
|
|
await comfyPage.page
|
|
.getByRole('button', { name: 'Completed', exact: true })
|
|
.click()
|
|
|
|
await expect(
|
|
comfyPage.page.locator('[data-job-id="job-completed-1"]')
|
|
).toBeVisible()
|
|
await expect(
|
|
comfyPage.page.locator('[data-job-id="job-failed-1"]')
|
|
).toBeHidden()
|
|
})
|
|
|
|
test('Toggling overlay again closes it', async ({ comfyPage }) => {
|
|
const toggle = comfyPage.page.getByTestId(TestIds.queue.overlayToggle)
|
|
await toggle.click()
|
|
|
|
await expect(comfyPage.page.locator('[data-job-id]').first()).toBeVisible()
|
|
|
|
await toggle.click()
|
|
|
|
await expect(comfyPage.page.locator('[data-job-id]').first()).toBeHidden()
|
|
})
|
|
})
|