mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-25 16:59:45 +00:00
feat: enforce no-explicit-any in browser tests via oxlint
- Add typescript/no-explicit-any override for browser_tests/**/*.ts - Fix 9 violations with proper types instead of any - Add TestGraphAccess interface for typed node access - Add function overloads to getExportedWorkflow for proper return types - Fix floating promise in colorPalette.spec.ts Amp-Thread-ID: https://ampcode.com/threads/T-019c1854-3c3c-723d-8ce6-183ce06fcf1b Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -178,8 +178,8 @@ test.describe('Color Palette', { tag: ['@screenshot', '@settings'] }, () => {
|
||||
})
|
||||
|
||||
test('Can add custom color palette', async ({ comfyPage }) => {
|
||||
await comfyPage.page.evaluate((p) => {
|
||||
;(
|
||||
await comfyPage.page.evaluate(async (p) => {
|
||||
await (
|
||||
window.app!.extensionManager as WorkspaceStore
|
||||
).colorPalette.addCustomColorPalette(p)
|
||||
}, customColorPalettes.obsidian_dark)
|
||||
|
||||
@@ -145,11 +145,11 @@ test.describe('Workflows sidebar', () => {
|
||||
})
|
||||
expect(exportedWorkflow).toBeDefined()
|
||||
for (const node of exportedWorkflow.nodes) {
|
||||
for (const slot of node.inputs) {
|
||||
for (const slot of node.inputs ?? []) {
|
||||
expect(slot.localized_name).toBeUndefined()
|
||||
expect(slot.label).toBeUndefined()
|
||||
}
|
||||
for (const slot of node.outputs) {
|
||||
for (const slot of node.outputs ?? []) {
|
||||
expect(slot.localized_name).toBeUndefined()
|
||||
expect(slot.label).toBeUndefined()
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import {
|
||||
comfyExpect as expect,
|
||||
comfyPageFixture as test
|
||||
} from '../../../fixtures/ComfyPage'
|
||||
import type { TestGraphAccess } from '../../../types/globals'
|
||||
|
||||
test.describe('Vue Widget Reactivity', () => {
|
||||
test.beforeEach(async ({ comfyPage }) => {
|
||||
@@ -13,21 +14,21 @@ test.describe('Vue Widget Reactivity', () => {
|
||||
'css=[data-testid="node-body-4"] > .lg-node-widgets > div'
|
||||
)
|
||||
await comfyPage.page.evaluate(() => {
|
||||
const graph = window.graph as { _nodes_by_id: Record<string, any> }
|
||||
const graph = window.graph as TestGraphAccess
|
||||
const node = graph._nodes_by_id['4']
|
||||
node.widgets.push(node.widgets[0])
|
||||
node.widgets!.push(node.widgets![0])
|
||||
})
|
||||
await expect(loadCheckpointNode).toHaveCount(2)
|
||||
await comfyPage.page.evaluate(() => {
|
||||
const graph = window.graph as { _nodes_by_id: Record<string, any> }
|
||||
const graph = window.graph as TestGraphAccess
|
||||
const node = graph._nodes_by_id['4']
|
||||
node.widgets[2] = node.widgets[0]
|
||||
node.widgets![2] = node.widgets![0]
|
||||
})
|
||||
await expect(loadCheckpointNode).toHaveCount(3)
|
||||
await comfyPage.page.evaluate(() => {
|
||||
const graph = window.graph as { _nodes_by_id: Record<string, any> }
|
||||
const graph = window.graph as TestGraphAccess
|
||||
const node = graph._nodes_by_id['4']
|
||||
node.widgets.splice(0, 0, node.widgets[0])
|
||||
node.widgets!.splice(0, 0, node.widgets![0])
|
||||
})
|
||||
await expect(loadCheckpointNode).toHaveCount(4)
|
||||
})
|
||||
@@ -36,21 +37,21 @@ test.describe('Vue Widget Reactivity', () => {
|
||||
'css=[data-testid="node-body-3"] > .lg-node-widgets > div'
|
||||
)
|
||||
await comfyPage.page.evaluate(() => {
|
||||
const graph = window.graph as { _nodes_by_id: Record<string, any> }
|
||||
const graph = window.graph as TestGraphAccess
|
||||
const node = graph._nodes_by_id['3']
|
||||
node.widgets.pop()
|
||||
node.widgets!.pop()
|
||||
})
|
||||
await expect(loadCheckpointNode).toHaveCount(5)
|
||||
await comfyPage.page.evaluate(() => {
|
||||
const graph = window.graph as { _nodes_by_id: Record<string, any> }
|
||||
const graph = window.graph as TestGraphAccess
|
||||
const node = graph._nodes_by_id['3']
|
||||
node.widgets.length--
|
||||
node.widgets!.length--
|
||||
})
|
||||
await expect(loadCheckpointNode).toHaveCount(4)
|
||||
await comfyPage.page.evaluate(() => {
|
||||
const graph = window.graph as { _nodes_by_id: Record<string, any> }
|
||||
const graph = window.graph as TestGraphAccess
|
||||
const node = graph._nodes_by_id['3']
|
||||
node.widgets.splice(0, 1)
|
||||
node.widgets!.splice(0, 1)
|
||||
})
|
||||
await expect(loadCheckpointNode).toHaveCount(3)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user