Skip to content
Closed
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
5bc5050
fix: Fix Playwright i18n collection by handling TypeScript declare fi…
snomiao Sep 1, 2025
c183026
fix(i18n.yaml): update job condition to include 'sno-fix' branches fo…
snomiao Sep 2, 2025
61f9628
chore(i18n.yaml): format YAML file for consistency and readability by…
snomiao Sep 2, 2025
83de398
Update locales [skip ci]
invalid-email-address Sep 2, 2025
4c2715e
refactor: Replace script-based litegraph preprocessing with integrate…
snomiao Sep 2, 2025
29add8f
Merge branch 'main' into sno-fix-playwright-babel
snomiao Sep 2, 2025
ea917ba
fix: Remove ComfyPageNoUser fixture and revert to standard fixture
snomiao Sep 2, 2025
4e56bae
Update locales [skip ci]
invalid-email-address Sep 2, 2025
2403b47
refactor: Use glob pattern to find litegraph files with declare keywords
snomiao Sep 2, 2025
0a3f878
refactor: Use async fs/promises for better performance
snomiao Sep 2, 2025
3700457
Merge branch 'main' into sno-fix-playwright-babel
snomiao Sep 2, 2025
f037567
style: Apply Prettier formatting
snomiao Sep 2, 2025
2a611cb
Update locales [skip ci]
invalid-email-address Sep 2, 2025
adbfd59
Merge branch 'main' into sno-fix-playwright-babel
snomiao Sep 3, 2025
32b8a1e
Update locales [skip ci]
invalid-email-address Sep 3, 2025
457cbbd
[bugfix] Add i18n setup files to knip ignore list
snomiao Sep 3, 2025
4bd68c8
Merge branch 'main' into sno-fix-playwright-babel
snomiao Sep 3, 2025
e4bc294
[bugfix] Remove sno-fix branch condition from i18n workflow
snomiao Sep 3, 2025
c7e9f83
Update locales [skip ci]
invalid-email-address Sep 3, 2025
728828e
Merge branch 'sno-fix-playwright-babel' of github.com:Comfy-Org/Comfy…
snomiao Sep 3, 2025
09ec3ad
chore(package.json): remove unused Babel dependencies to clean up the…
snomiao Sep 3, 2025
8afd007
[bugfix] Fix i18n workflow condition, simplify setup/teardown, and re…
snomiao Sep 3, 2025
33dd251
[chore] Update pnpm lockfile to match package.json dependencies
snomiao Sep 3, 2025
bbb6396
[bugfix] Revert i18n files and fix git checkout in browser test workflow
snomiao Sep 4, 2025
4aec5fe
Merge branch 'main' into sno-fix-playwright-babel
snomiao Sep 5, 2025
be87bd0
Merge branch 'main' into sno-fix-playwright-babel - Resolved conflict…
snomiao Sep 11, 2025
595b5f0
Merge remote-tracking branch 'origin/main' into sno-fix-playwright-babel
snomiao Sep 11, 2025
c393c48
Merge branches 'sno-fix-playwright-babel' and 'main' of github.com:Co…
snomiao Sep 12, 2025
b1c6622
fix(revert): test-browser-exp changes
snomiao Sep 12, 2025
1869484
fix(knip.config.ts): revert changes
snomiao Sep 12, 2025
450f156
fix(knip.config.ts): revert changes
snomiao Sep 12, 2025
ad111f0
refactor(tests): update global setup and teardown functions to accept…
snomiao Sep 12, 2025
98318c8
chore(knip.config.ts): add i18n related test files to the configurati…
snomiao Sep 12, 2025
a79d87d
refactor(knip.config.ts): simplify and reorganize configuration for b…
snomiao Sep 12, 2025
4984e96
feat(knip.config.ts): add tailwind configuration to support Tailwind …
snomiao Sep 12, 2025
08d4c07
feat(knip.config.ts): add tailwindcss and tailwindcss-primeui to the …
snomiao Sep 12, 2025
9d7eac2
perf(i18nSetup): optimize file reading to reduce I/O operations
snomiao Sep 12, 2025
85b51b1
fix(i18nSetup.ts): improve error message for better clarity on prepro…
snomiao Sep 12, 2025
9ac1a0a
style(globalTeardownWithI18n.ts): change import statement to use type…
snomiao Sep 12, 2025
f4d2185
Merge branch 'main' into sno-fix-playwright-babel
snomiao Sep 12, 2025
6ef3650
chore(i18n.yaml): update job condition to include sno-fix-playwright-…
snomiao Sep 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions browser_tests/globalSetupWithI18n.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { FullConfig } from '@playwright/test'

import { preprocessLitegraph } from './i18nSetup'

export default async function globalSetup(config: FullConfig) {
await preprocessLitegraph()
}
7 changes: 7 additions & 0 deletions browser_tests/globalTeardownWithI18n.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { FullConfig } from '@playwright/test'

import { restoreLitegraph } from './i18nSetup'

export default async function globalTeardown(config: FullConfig) {
await restoreLitegraph()
}
81 changes: 81 additions & 0 deletions browser_tests/i18nSetup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/**
* Setup for i18n collection tests
* Handles preprocessing of litegraph files that contain TypeScript 'declare' keywords
*/
import { promises as fs } from 'fs'
import { glob } from 'glob'
import * as path from 'path'
import { fileURLToPath } from 'url'

const __dirname = path.dirname(fileURLToPath(import.meta.url))
const rootDir = path.resolve(__dirname, '..')
const litegraphSrcDir = path.join(rootDir, 'src/lib/litegraph/src')

const backupMap = new Map<string, string>()

export async function preprocessLitegraph() {
console.log('Preprocessing litegraph files for i18n collection...')

// Search for all .ts files in litegraph src directory
const pattern = path.join(litegraphSrcDir, '**/*.ts')
const files = await glob(pattern, {
ignore: ['**/*.test.ts', '**/*.spec.ts', '**/node_modules/**']
})

let processedCount = 0

// Process files in parallel - read once and process if needed
await Promise.all(
files.map(async (filePath) => {
try {
const originalContent = await fs.readFile(filePath, 'utf-8')

// Check for class property declarations with 'declare' keyword
if (!/^\s*declare\s+/m.test(originalContent)) {
return // Skip files without declare keywords
}

// Store original content in memory
backupMap.set(filePath, originalContent)

// Remove 'declare' keyword from class properties
const modifiedContent = originalContent.replace(
/^(\s*)declare\s+/gm,
'$1// @ts-ignore - removed declare for Playwright\n$1'
)

// Write modified content
await fs.writeFile(filePath, modifiedContent)
console.log(` ✓ Processed ${path.relative(litegraphSrcDir, filePath)}`)
processedCount++
} catch (error: unknown) {
console.warn(
` ⚠ Could not preprocess file for litegraph ${filePath}: ${String((error as Error)?.message || error)}`
)
}
})
)

if (processedCount === 0) {
console.log(' ℹ No files with declare keywords found')
} else {
console.log(` Processed ${processedCount} files with declare keywords`)
}
}

export async function restoreLitegraph() {
if (backupMap.size === 0) {
return
}

console.log('Restoring original litegraph files...')

await Promise.all(
Array.from(backupMap.entries()).map(async ([filePath, originalContent]) => {
await fs.writeFile(filePath, originalContent)
console.log(` ✓ Restored ${path.relative(litegraphSrcDir, filePath)}`)
})
)

backupMap.clear()
}
4 changes: 3 additions & 1 deletion knip.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ const config: KnipConfig = {
'@primeuix/utils',
'@primevue/icons',
// Dev
'@trivago/prettier-plugin-sort-imports'
'@trivago/prettier-plugin-sort-imports',
'tailwindcss',
'tailwindcss-primeui'
],
ignore: [
// Auto generated manager types
Expand Down
8 changes: 7 additions & 1 deletion playwright.i18n.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,11 @@ export default defineConfig({
},
reporter: 'list',
timeout: 60000,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we are here, should we increase the timeout as well?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as for timeout, is 1 min not enough?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I never got timeout error for i18n yet

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The concept of a test timetout just doesn't apply to this, because we are not using it as a test. So we would want to give it a lot of time. It's fine I guess.

testMatch: /collect-i18n-.*\.ts/
testMatch: /collect-i18n-.*\.ts/,
// Run tests sequentially to avoid conflicts
workers: 1,
fullyParallel: false,
// Use combined setup that includes litegraph preprocessing
globalSetup: './browser_tests/globalSetupWithI18n.ts',
globalTeardown: './browser_tests/globalTeardownWithI18n.ts'
})
Loading
Loading