mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-07 16:40:05 +00:00
* fix delete hotkey with vue nodes * add playwright test for deletion and selection with vue nodes * add unit test for keybinding service event forwarding * [refactor] improve type safety and remove wrapper functions in VueNodeHelpers - addresses @DrJKL review comments - Replace type cast with proper type predicate in getNodeIds method - Remove unnecessary getNodeCount() and getSelectedNodeCount() wrapper functions - Remove deleteSelected() helper methods to make key presses explicit in tests 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * [refactor] make key presses explicit in Vue node tests - addresses @DrJKL review comment - Remove commented line in test setup - Replace helper method calls with direct keyboard.press() for better test clarity - Use direct locator access instead of wrapper functions for node counts 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * [enhance] add input filtering and improve shouldForwardToCanvas logic - addresses @DrJKL review comments - Add filtering for input, textarea, and contentEditable elements to prevent forwarding when typing - Allow shift key while blocking other modifiers (ctrl, alt, meta) - Include existing property_value span check for consistency 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * [refactor] remove mutable global state from keybinding unit tests - addresses @DrJKL review comment - Remove global mockCommandExecute and mockProcessKey variables - Access vi.mocked() directly in test assertions for better isolation - Keep keybindingService as local variable since it's properly scoped 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * [fix] remove duplicate input filtering that broke delete key functionality The shouldForwardToCanvas function was duplicating input field checks already handled by keyCombo.isReservedByTextInput, causing delete keys to be blocked. - Remove duplicate input filtering from shouldForwardToCanvas - Keep contentEditable enhancement in existing isReservedByTextInput check - Maintain shift key support as requested in review Fixes regression where delete key tests were failing after review changes. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * [fix] restore working test structure while implementing review improvements Root cause: Changed test approach from helper methods to direct keyboard calls, which introduced timing/focus issues that broke delete key functionality. Solution: - Restore working test structure using helper methods (deleteSelected, getNodeCount) - Keep type safety improvement: replace type cast with proper type predicate - Keep code cleanup: remove commented line in test setup - Maintain working keybinding service with contentEditable enhancement This preserves the original working behavior while addressing all review feedback. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * [auto-fix] Apply ESLint and Prettier fixes --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: GitHub Action <action@github.com>
ComfyUI Frontend Testing Guide
This guide provides an overview of testing approaches used in the ComfyUI Frontend codebase. These guides are meant to document any particularities or nuances of writing tests in this codebase, rather than being a comprehensive guide to testing in general. By reading these guides first, you may save yourself some time when encountering issues.
Testing Documentation
Documentation for unit tests is organized into three guides:
- Component Testing - How to test Vue components
- Unit Testing - How to test utility functions, composables, and other non-component code
- Store Testing - How to test Pinia stores specifically
Testing Structure
The ComfyUI Frontend project uses a mixed approach to unit test organization:
- Component Tests: Located directly alongside their components with a
.spec.tsextension - Unit Tests: Located in the
tests-ui/tests/directory - Store Tests: Located in the
tests-ui/tests/store/directory - Browser Tests: These are located in the
browser_tests/directory. There is a dedicated README in thebrowser_tests/directory, so it will not be covered here.
Test Frameworks and Libraries
Our tests use the following frameworks and libraries:
- Vitest - Test runner and assertion library
- @vue/test-utils - Vue component testing utilities
- Pinia - For store testing
Getting Started
To run the tests locally:
# Run unit tests
pnpm test:unit
# Run unit tests in watch mode
pnpm test:unit:dev
# Run component tests with browser-native environment
pnpm test:component
Refer to the specific guides for more detailed information on each testing type.