mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-25 08:49:36 +00:00
fix: Improve i18n collection script setup
- Move setup-browser-globals import to top to fix location undefined error - Skip user setup for i18n tests to avoid duplicate user conflicts - Run i18n tests serially with workers=1 to prevent race conditions - Add unique test-based usernames for better test isolation
This commit is contained in:
@@ -1644,13 +1644,22 @@ export const comfyPageFixture = base.extend<{
|
||||
comfyPage: async ({ page, request }, use, testInfo) => {
|
||||
const comfyPage = new ComfyPage(page, request)
|
||||
|
||||
const { parallelIndex } = testInfo
|
||||
const username = `playwright-test-${parallelIndex}`
|
||||
const userId = await comfyPage.setupUser(username)
|
||||
comfyPage.userIds[parallelIndex] = userId
|
||||
const { parallelIndex, workerIndex, title } = testInfo
|
||||
|
||||
// Skip user setup for i18n collection tests
|
||||
const isI18nTest = testInfo.file?.includes('collect-i18n')
|
||||
|
||||
if (!isI18nTest) {
|
||||
// Use a combination of workerIndex and test title hash for unique usernames
|
||||
const testHash = title.replace(/[^a-zA-Z0-9]/g, '').substring(0, 8)
|
||||
const username = `playwright-test-${workerIndex}-${testHash}`
|
||||
const userId = await comfyPage.setupUser(username)
|
||||
comfyPage.userIds[parallelIndex] = userId
|
||||
}
|
||||
|
||||
try {
|
||||
await comfyPage.setupSettings({
|
||||
if (!isI18nTest) {
|
||||
await comfyPage.setupSettings({
|
||||
'Comfy.UseNewMenu': 'Disabled',
|
||||
// Hide canvas menu/info/selection toolbox by default.
|
||||
'Comfy.Graph.CanvasInfo': false,
|
||||
@@ -1666,6 +1675,7 @@ export const comfyPageFixture = base.extend<{
|
||||
'Comfy.TutorialCompleted': true,
|
||||
'Comfy.SnapToGrid.GridSize': testComfySnapToGridGridSize
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ const config: any = defineConfig({
|
||||
},
|
||||
reporter: 'list',
|
||||
timeout: 60000,
|
||||
workers: 1, // Run tests serially to avoid duplicate user creation
|
||||
testMatch: /collect-i18n-.*\.ts/,
|
||||
// Start dev server before running tests
|
||||
webServer: {
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import * as fs from 'fs'
|
||||
// Setup browser globals before any other imports that might use them
|
||||
import './setup-browser-globals.js'
|
||||
|
||||
import * as fs from 'fs'
|
||||
import { comfyPageFixture as test } from '../browser_tests/fixtures/ComfyPage'
|
||||
import type { ComfyNodeDef } from '../src/schemas/nodeDefSchema'
|
||||
import type { ComfyApi } from '../src/scripts/api'
|
||||
import { ComfyNodeDefImpl } from '../src/stores/nodeDefStore'
|
||||
import { normalizeI18nKey } from '../src/utils/formatUtil'
|
||||
import './setup-browser-globals.js'
|
||||
|
||||
const localePath = './src/locales/en/main.json'
|
||||
const nodeDefsPath = './src/locales/en/nodeDefs.json'
|
||||
|
||||
Reference in New Issue
Block a user