|
1 | 1 | import * as fs from 'fs'
|
2 | 2 |
|
| 3 | +import type { ComfyNodeDef } from '@/schemas/nodeDefSchema' |
| 4 | + |
3 | 5 | import { comfyPageFixture as test } from '../browser_tests/fixtures/ComfyPage'
|
4 |
| -import type { ComfyNodeDef } from '../src/schemas/nodeDefSchema' |
5 |
| -import type { ComfyApi } from '../src/scripts/api' |
6 |
| -import { ComfyNodeDefImpl } from '../src/stores/nodeDefStore' |
| 6 | +import type { ComfyNodeDefImpl } from '../src/stores/nodeDefStore' |
7 | 7 | import { normalizeI18nKey } from '../src/utils/formatUtil'
|
8 | 8 |
|
9 | 9 | const localePath = './src/locales/en/main.json'
|
10 | 10 | const nodeDefsPath = './src/locales/en/nodeDefs.json'
|
11 | 11 |
|
12 | 12 | test('collect-i18n-node-defs', async ({ comfyPage }) => {
|
13 | 13 | // Mock view route
|
14 |
| - comfyPage.page.route('**/view**', async (route) => { |
| 14 | + await comfyPage.page.route('**/view**', async (route) => { |
15 | 15 | await route.fulfill({
|
16 | 16 | body: JSON.stringify({})
|
17 | 17 | })
|
18 | 18 | })
|
19 | 19 |
|
20 |
| - const nodeDefs: ComfyNodeDefImpl[] = ( |
21 |
| - Object.values( |
22 |
| - await comfyPage.page.evaluate(async () => { |
23 |
| - const api = window['app'].api as ComfyApi |
24 |
| - return await api.getNodeDefs() |
25 |
| - }) |
26 |
| - ) as ComfyNodeDef[] |
| 20 | + // Note: Don't mock the object_info API endpoint - let it hit the actual backend |
| 21 | + |
| 22 | + const nodeDefs: ComfyNodeDefImpl[] = await comfyPage.page.evaluate( |
| 23 | + async () => { |
| 24 | + const api = window['app'].api |
| 25 | + const rawNodeDefs = await api.getNodeDefs() |
| 26 | + const { ComfyNodeDefImpl } = await import('../src/stores/nodeDefStore') |
| 27 | + |
| 28 | + return ( |
| 29 | + Object.values(rawNodeDefs) |
| 30 | + // Ignore DevTools nodes (used for internal testing) |
| 31 | + .filter((def: ComfyNodeDef) => !def.name.startsWith('DevTools')) |
| 32 | + .map((def: ComfyNodeDef) => new ComfyNodeDefImpl(def)) |
| 33 | + ) |
| 34 | + } |
27 | 35 | )
|
28 |
| - // Ignore DevTools nodes (used for internal testing) |
29 |
| - .filter((def) => !def.name.startsWith('DevTools')) |
30 |
| - .map((def) => new ComfyNodeDefImpl(def)) |
31 | 36 |
|
32 | 37 | console.log(`Collected ${nodeDefs.length} node definitions`)
|
33 | 38 |
|
|
0 commit comments