From dae586533faba29fb0286615f52bca4d3a607566 Mon Sep 17 00:00:00 2001 From: snomiao Date: Sun, 31 Aug 2025 15:29:07 +0000 Subject: [PATCH] [fix] Move i18n tests to separate config to avoid CI conflicts --- package.json | 2 +- playwright.config.ts | 11 +++++++---- playwright.i18n.config.ts | 13 +++++++++++++ .../i18n/collect-i18n-general.ts | 2 +- .../i18n/collect-i18n-node-defs.ts | 2 +- 5 files changed, 23 insertions(+), 7 deletions(-) create mode 100644 playwright.i18n.config.ts rename browser_tests/tests/collect-i18n-general.spec.ts => scripts/i18n/collect-i18n-general.ts (98%) rename browser_tests/tests/collect-i18n-node-defs.spec.ts => scripts/i18n/collect-i18n-node-defs.ts (98%) diff --git a/package.json b/package.json index dfd273e00b..e0e08cb208 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "knip": "knip --cache", "knip:no-cache": "knip", "locale": "lobe-i18n locale", - "collect-i18n": "nx run @comfyorg/comfyui-frontend:e2e --grep=\"collect-i18n\"", + "collect-i18n": "playwright test --config=playwright.i18n.config.ts", "json-schema": "tsx scripts/generate-json-schema.ts", "storybook": "nx storybook -p 6006", "build-storybook": "storybook build" diff --git a/playwright.config.ts b/playwright.config.ts index b52daad7fe..2e88b96d18 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -31,21 +31,23 @@ export default defineConfig({ name: 'chromium', use: { ...devices['Desktop Chrome'] }, timeout: 15000, - grepInvert: /@mobile/ // Run all tests except those tagged with @mobile + grepInvert: /@mobile|collect-i18n/ // Run all tests except mobile and i18n collection tests }, { name: 'chromium-2x', use: { ...devices['Desktop Chrome'], deviceScaleFactor: 2 }, timeout: 15000, - grep: /@2x/ // Run all tests tagged with @2x + grep: /@2x/, // Run all tests tagged with @2x + grepInvert: /collect-i18n/ // Exclude i18n collection tests }, { name: 'chromium-0.5x', use: { ...devices['Desktop Chrome'], deviceScaleFactor: 0.5 }, timeout: 15000, - grep: /@0.5x/ // Run all tests tagged with @0.5x + grep: /@0.5x/, // Run all tests tagged with @0.5x + grepInvert: /collect-i18n/ // Exclude i18n collection tests }, // { @@ -62,7 +64,8 @@ export default defineConfig({ { name: 'mobile-chrome', use: { ...devices['Pixel 5'], hasTouch: true }, - grep: /@mobile/ // Run only tests tagged with @mobile + grep: /@mobile/, // Run only tests tagged with @mobile + grepInvert: /collect-i18n/ // Exclude i18n collection tests } // { // name: 'Mobile Safari', diff --git a/playwright.i18n.config.ts b/playwright.i18n.config.ts new file mode 100644 index 0000000000..f45629b068 --- /dev/null +++ b/playwright.i18n.config.ts @@ -0,0 +1,13 @@ +import { defineConfig } from '@playwright/test' + +export default defineConfig({ + testDir: './scripts/i18n', + use: { + baseURL: 'http://localhost:5173', + headless: true + }, + reporter: 'list', + timeout: 60000, + testMatch: /collect-i18n-.*\.ts/ + // Don't use globalSetup/globalTeardown to avoid ComfyUI path dependencies +}) diff --git a/browser_tests/tests/collect-i18n-general.spec.ts b/scripts/i18n/collect-i18n-general.ts similarity index 98% rename from browser_tests/tests/collect-i18n-general.spec.ts rename to scripts/i18n/collect-i18n-general.ts index 5944a15482..b235e8158a 100644 --- a/browser_tests/tests/collect-i18n-general.spec.ts +++ b/scripts/i18n/collect-i18n-general.ts @@ -1,11 +1,11 @@ import * as fs from 'fs' +import { comfyPageFixture as test } from '../../browser_tests/fixtures/ComfyPage' import { CORE_MENU_COMMANDS } from '../../src/constants/coreMenuCommands' import { SERVER_CONFIG_ITEMS } from '../../src/constants/serverConfig' import type { ComfyCommandImpl } from '../../src/stores/commandStore' import type { FormItem, SettingParams } from '../../src/types/settingTypes' import { formatCamelCase, normalizeI18nKey } from '../../src/utils/formatUtil' -import { comfyPageFixture as test } from '../fixtures/ComfyPage' const localePath = './src/locales/en/main.json' const commandsPath = './src/locales/en/commands.json' diff --git a/browser_tests/tests/collect-i18n-node-defs.spec.ts b/scripts/i18n/collect-i18n-node-defs.ts similarity index 98% rename from browser_tests/tests/collect-i18n-node-defs.spec.ts rename to scripts/i18n/collect-i18n-node-defs.ts index 6873b7e582..006e519b98 100644 --- a/browser_tests/tests/collect-i18n-node-defs.spec.ts +++ b/scripts/i18n/collect-i18n-node-defs.ts @@ -1,7 +1,7 @@ import * as fs from 'fs' +import { comfyPageFixture as test } from '../../browser_tests/fixtures/ComfyPage' import { normalizeI18nKey } from '../../src/utils/formatUtil' -import { comfyPageFixture as test } from '../fixtures/ComfyPage' const localePath = './src/locales/en/main.json' const nodeDefsPath = './src/locales/en/nodeDefs.json'