Skip to content

Commit 268094a

Browse files
DrJKLampagentactions-usergithub-actionscoderabbitai[bot]
authored
test(browser): refactor browser tests for reliability and maintainability (#8510)
## Summary Major refactoring of browser tests to improve reliability, maintainability, and type safety. ## Changes ### Test Infrastructure Decomposition - Decomposed `ComfyPage.ts` (~1000 lines) into focused helpers: - `CanvasHelper`, `DebugHelper`, `SubgraphHelper`, `NodeOperationsHelper` - `SettingsHelper`, `WorkflowHelper`, `ClipboardHelper`, `KeyboardHelper` - Created `ContextMenu` page object, `BaseDialog` base class, and `BottomPanel` page object - Extracted `DefaultGraphPositions` constants ### Locator Stability - Added `data-testid` attributes to Vue components (sidebar, dialogs, node library) - Created centralized `selectors.ts` with test ID constants - Replaced fragile CSS selectors (`.nth()`, `:nth-child()`) with `getByTestId`/`getByRole` ### Performance & Reliability - Removed `setTimeout` anti-patterns (replaced with `waitForFunction`) - Replaced `waitForTimeout` with retrying assertions - Replaced hardcoded coordinates with computed `NodeReference` positions - Enforced LF line endings for all text files ### Type Safety - Enabled `no-explicit-any` lint rule for browser_tests via oxlint - Purged `as any` casts from browser_tests - Added Window type augmentation for standardized window access - Added proper type annotations throughout ### Bug Fixes - Restored `ExtensionManager` API contract - Removed test-only settings from production schema - Fixed flaky selectors and missing test setup ## Testing - All browser tests pass - Typecheck passes <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Tests** * Overhauled browser E2E test infrastructure with many new helpers/fixtures, updated test APIs, and CI test container image bumped for consistency. * **Chores** * Standardized line endings and applied stricter lint rules for browser tests; workspace dependency version updated. * **Documentation** * Updated Playwright and TypeScript testing guidance and test-run commands. * **UI** * Added stable data-testids to multiple components to improve testability. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Amp <amp@ampcode.com> Co-authored-by: GitHub Action <action@github.com> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 5c0cf7c commit 268094a

143 files changed

Lines changed: 4073 additions & 3021 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
1-
# Default
2-
* text=auto
3-
4-
# Force TS to LF to make the unixy scripts not break on Windows
5-
*.cjs text eol=lf
6-
*.js text eol=lf
7-
*.json text eol=lf
8-
*.mjs text eol=lf
9-
*.mts text eol=lf
10-
*.snap text eol=lf
11-
*.ts text eol=lf
12-
*.vue text eol=lf
13-
*.yaml text eol=lf
14-
*.yml text eol=lf
1+
# Force all text files to use LF line endings
2+
* text=auto eol=lf
153

164
# Generated files
175
packages/registry-types/src/comfyRegistryTypes.ts linguist-generated=true

.github/workflows/ci-tests-e2e.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
runs-on: ubuntu-latest
3838
timeout-minutes: 60
3939
container:
40-
image: ghcr.io/comfy-org/comfyui-ci-container:0.0.10
40+
image: ghcr.io/comfy-org/comfyui-ci-container:0.0.12
4141
credentials:
4242
username: ${{ github.actor }}
4343
password: ${{ secrets.GITHUB_TOKEN }}
@@ -85,7 +85,7 @@ jobs:
8585
needs: setup
8686
runs-on: ubuntu-latest
8787
container:
88-
image: ghcr.io/comfy-org/comfyui-ci-container:0.0.10
88+
image: ghcr.io/comfy-org/comfyui-ci-container:0.0.12
8989
credentials:
9090
username: ${{ github.actor }}
9191
password: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/pr-update-playwright-expectations.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
needs: setup
7878
runs-on: ubuntu-latest
7979
container:
80-
image: ghcr.io/comfy-org/comfyui-ci-container:0.0.10
80+
image: ghcr.io/comfy-org/comfyui-ci-container:0.0.12
8181
credentials:
8282
username: ${{ github.actor }}
8383
password: ${{ secrets.GITHUB_TOKEN }}

.oxlintrc.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,17 @@
110110
"rules": {
111111
"no-console": "allow"
112112
}
113+
},
114+
{
115+
"files": ["browser_tests/**/*.ts"],
116+
"rules": {
117+
"typescript/no-explicit-any": "error",
118+
"no-async-promise-executor": "error",
119+
"no-control-regex": "error",
120+
"no-useless-rename": "error",
121+
"no-unused-private-class-members": "error",
122+
"unicorn/no-empty-file": "error"
123+
}
113124
}
114125
]
115126
}

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ The project uses **Nx** for build orchestration and task management
4444
- `pnpm build`: Type-check then production build to `dist/`
4545
- `pnpm preview`: Preview the production build locally
4646
- `pnpm test:unit`: Run Vitest unit tests
47-
- `pnpm test:browser`: Run Playwright E2E tests (`browser_tests/`)
47+
- `pnpm test:browser:local`: Run Playwright E2E tests (`browser_tests/`)
4848
- `pnpm lint` / `pnpm lint:fix`: Lint (ESLint)
4949
- `pnpm format` / `pnpm format:check`: oxfmt
5050
- `pnpm typecheck`: Vue TSC type checking

browser_tests/AGENTS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,9 @@ See `@docs/guidance/playwright.md` for Playwright best practices (auto-loaded fo
66

77
- `assets/` - Test data (JSON workflows, fixtures)
88
- Tests use premade JSON workflows to load desired graph state
9+
10+
## After Making Changes
11+
12+
- Run `pnpm typecheck:browser` after modifying TypeScript files in this directory
13+
- Run `pnpm exec eslint browser_tests/path/to/file.ts` to lint specific files
14+
- Run `pnpm exec oxlint browser_tests/path/to/file.ts` to check with oxlint

0 commit comments

Comments
 (0)