From 0ae6e26052e9ff017d328638203f8d932f5650f3 Mon Sep 17 00:00:00 2001 From: snomiao Date: Sat, 13 Sep 2025 09:47:58 +0000 Subject: [PATCH] [fix] Update Playwright and knip configurations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix ComfyPage imports and exports in browser tests - Update knip config to properly handle Playwright fixtures 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- browser_tests/fixtures/ComfyPage.ts | 43 +++++++++++++++-------------- knip.config.ts | 11 +++++++- 2 files changed, 33 insertions(+), 21 deletions(-) diff --git a/browser_tests/fixtures/ComfyPage.ts b/browser_tests/fixtures/ComfyPage.ts index 2c571d686..185cfe643 100644 --- a/browser_tests/fixtures/ComfyPage.ts +++ b/browser_tests/fixtures/ComfyPage.ts @@ -10,8 +10,8 @@ import type { KeyCombo } from '../../src/schemas/keyBindingSchema' import type { useWorkspaceStore } from '../../src/stores/workspaceStore' import { NodeBadgeMode } from '../../src/types/nodeSource' import { ComfyActionbar } from '../helpers/actionbar' -import { ComfyTemplates } from '../helpers/templates' import { LocationMock } from '../helpers/locationMock' +import { ComfyTemplates } from '../helpers/templates' import { ComfyMouse } from './ComfyMouse' import { ComfyNodeSearchBox } from './components/ComfyNodeSearchBox' import { SettingDialog } from './components/SettingDialog' @@ -284,7 +284,8 @@ export class ComfyPage { } = {}) { // Setup location mock if requested if (mockLocation) { - const config = typeof mockLocation === 'boolean' ? undefined : mockLocation + const config = + typeof mockLocation === 'boolean' ? undefined : mockLocation await this.locationMock.setupLocationMock(config) } @@ -1649,32 +1650,33 @@ export const comfyPageFixture = base.extend<{ // Skip user setup for i18n collection tests const isI18nTest = testInfo.file?.includes('collect-i18n') + let userId: string | undefined 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 + userId = await comfyPage.setupUser(username) + comfyPage.userIds[parallelIndex] = userId! } try { - if (!isI18nTest) { + if (!isI18nTest && userId) { await comfyPage.setupSettings({ - 'Comfy.UseNewMenu': 'Disabled', - // Hide canvas menu/info/selection toolbox by default. - 'Comfy.Graph.CanvasInfo': false, - 'Comfy.Graph.CanvasMenu': false, - 'Comfy.Canvas.SelectionToolbox': false, - // Hide all badges by default. - 'Comfy.NodeBadge.NodeIdBadgeMode': NodeBadgeMode.None, - 'Comfy.NodeBadge.NodeSourceBadgeMode': NodeBadgeMode.None, - // Disable tooltips by default to avoid flakiness. - 'Comfy.EnableTooltips': false, - 'Comfy.userId': userId, - // Set tutorial completed to true to avoid loading the tutorial workflow. - 'Comfy.TutorialCompleted': true, - 'Comfy.SnapToGrid.GridSize': testComfySnapToGridGridSize - }) + 'Comfy.UseNewMenu': 'Disabled', + // Hide canvas menu/info/selection toolbox by default. + 'Comfy.Graph.CanvasInfo': false, + 'Comfy.Graph.CanvasMenu': false, + 'Comfy.Canvas.SelectionToolbox': false, + // Hide all badges by default. + 'Comfy.NodeBadge.NodeIdBadgeMode': NodeBadgeMode.None, + 'Comfy.NodeBadge.NodeSourceBadgeMode': NodeBadgeMode.None, + // Disable tooltips by default to avoid flakiness. + 'Comfy.EnableTooltips': false, + 'Comfy.userId': userId, + // Set tutorial completed to true to avoid loading the tutorial workflow. + 'Comfy.TutorialCompleted': true, + 'Comfy.SnapToGrid.GridSize': testComfySnapToGridGridSize + }) } } catch (e) { console.error(e) @@ -1694,6 +1696,7 @@ const makeMatcher = function ( type: string ) { return async function ( + this: any, node: NodeReference, options?: { timeout?: number; intervals?: number[] } ) { diff --git a/knip.config.ts b/knip.config.ts index 9df077d77..44346644f 100644 --- a/knip.config.ts +++ b/knip.config.ts @@ -18,7 +18,16 @@ const config: KnipConfig = { '@primeuix/utils', '@primevue/icons', // Dev - '@trivago/prettier-plugin-sort-imports' + '@trivago/prettier-plugin-sort-imports', + // Babel dependencies used in playwright.i18n.config.ts + '@babel/plugin-transform-modules-commonjs', + '@babel/plugin-transform-typescript', + 'babel-helper-vue-jsx-merge-props', + 'babel-plugin-syntax-jsx', + 'babel-plugin-transform-import-ignore', + 'babel-plugin-transform-vue-jsx', + 'babel-preset-env', + 'babel-preset-typescript-vue3' ], ignore: [ // Auto generated manager types