-
Notifications
You must be signed in to change notification settings - Fork 1
test: add Vitest + Playwright setup and initial suite #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Add Vitest unit testing with separate renderer/main process configs - Add Playwright E2E testing optimized for Electron apps - Include test utilities, fixtures, and example tests for components/hooks - Fix missing OpenTelemetry dependencies - Update ESLint config for test files - Add comprehensive test scripts and documentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codex Review: Here are some suggestions.
Reply with @codex fix comments to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
…add mock:pusher script
…entions) to reduce flake; rely on smoke test for CI
This commit introduces a comprehensive testing framework to the project to improve code quality and prevent regressions. - Adds `Vitest` for unit and component testing, configured with `JSDOM`. - Integrates `@testing-library/react` for robust component testing. - Includes `Playwright` to support end-to-end testing. - Adds initial test suites for various UI components (Dialogs, Settings) and the telemetry module to establish a baseline for test coverage.
…mprovements - Add Vitest testing infrastructure with renderer and main process support - Implement focused test suites for ChatProvider, WebSocket services, and utilities - Enhance WebSocket reliability with defensive programming (null-safe cleanup, connection guards) - Add telemetry tracing modules with comprehensive test coverage - Update test setup with mock configurations and better assertions - Remove unused electron imports from preload bridge for security - Add WS_STATES normalization and enhanced readyState validation - Implement circuit breaker improvements and reconnection safeguards Testing coverage includes: - ChatProvider store logic and optimistic messaging - WebSocket connection management and error recovery - Utility functions and custom hooks - Telemetry instrumentation and metrics
…main telemetry + otel:get-config; harden constants and retry-utils tests; adjust 7TV websocket expectations; add guards + connection-success dispatch in shared sockets; improve ConnectionManager robustness
…yState constants for jsdom; partial renderer subset passes; remaining NotificationsSection tests failing due to nested act; plan targeted test refactor
…egration - Properly mock CommonJS error-monitoring via vi.mock and inject using setErrorMonitor - Update API preset test to use retryable HTTP status (response.status=500) - Align final failure console assertion with actual "[Retry] Final failure..." message - Add defensive try/catch around recordError/recordRecovery and guard for missing methods - Remove unused import to resolve lints
- Create comprehensive test suite for chatroomErrorHandler function - Test all valid error code mappings from CHAT_ERROR_CODES - Cover error code precedence (response.data.status.message over error.code) - Test malformed error objects and edge cases - Include tests for different error response structures - Validate handling of null, undefined, and invalid inputs - Test case sensitivity and type coercion behavior - Cover performance and consistency scenarios - Follow existing renderer test patterns with Vitest and jsdom - All 45 tests pass successfully 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…; test infra polyfills
main
Implement ipcMain.handle('replyLogs:clear') to clear a single thread or all threads in a chatroom
Implement ipcMain.handle('provider:refresh') to broadcast provider refresh to all windows
Harden logout handler to guard settingsDialog.close() when dialog is not present
Remove unused initTelemetry variable (lint cleanup)
Keep platform-specific alwaysOnTop behavior in store:set
Files: src/main/index.js
tests (main)
Add tray menu tests: show/hide toggle on tray click, and Quit menu asserts app.quit()
Add OTEL env mapping/resource attributes test (service.name and semver service.version)
Add platform-specific tests for alwaysOnTop on darwin/win32/linux via store:set
Files: src/main/tests/index.test.js, src/main/tests/ipc-handlers.test.js
test setup
Polyfill CloseEvent and ErrorEvent (EventTarget compatible) for Node test env
Strengthen renderer test harness:
Allow .jsx resolution under Node
Pre-mock zustand/react/shallow
Provide className query helpers on screen
Make Clipboard API spies robust across tests
Add defensive mocks for preload APIs and kick service calls
Files: vitest.setup.main.js, vitest.setup.renderer.js
7tv websocket
Stabilize tests by fixing cosmetics backgroundImage fallbacks and lint cleanup
Files: utils/services/seventv/sharedStvWebSocket.js
Note: retained original subscription flow; no behavior change beyond lint/compat fixes
renderer (minor)
Minor updates in EmoteDialogs/hooks to align with test setup and click-outside usage
Files: src/renderer/src/components/Chat/Input/EmoteDialogs.jsx, src/renderer/src/utils/hooks.js
Additionally added (new/untracked tests detected)
New tests under:
src/main/tests/env-config-mapping.test.js
src/main/tests/telemetry-ipc-handlers.test.js
src/main/utils/tests/
src/renderer/src/components/Chat/Input/InfoBar.test.jsx
src/renderer/src/components/utils/
src/renderer/src/providers/ChatProvider.comprehensive.test.jsx
src/renderer/src/telemetry/tests/
src/renderer/src/utils/tests/appleEmojis.test.js
src/telemetry/tests/
New file: src/renderer/src/utils/useClickOutside.js (moved/added for tests)
… in main, harden Kick WS, enhance Settings
- Test infra:
- Unify Vitest config and environments with robust setup files
([vitest.config.js](cci:7://file:///home/five/code/KickTalk/vitest.config.js:0:0-0:0), [vite.config.main.js](cci:7://file:///home/five/code/KickTalk/vite.config.main.js:0:0-0:0),
[vitest.setup.renderer.js](cci:7://file:///home/five/code/KickTalk/vitest.setup.renderer.js:0:0-0:0), [vitest.setup.main.js](cci:7://file:///home/five/code/KickTalk/vitest.setup.main.js:0:0-0:0))
- Add stable mocks/polyfills for Electron, WebSocket, Lexical React subpaths,
matchMedia/observers/clipboard, and node polyfills
- Add [tests/mocks/lexical-react.js](cci:7://file:///home/five/code/KickTalk/tests/mocks/lexical-react.js:0:0-0:0) for deep-import stability
- Telemetry (main process):
- Map MAIN_VITE_* -> OTEL_*; inject service.name/service.version in
`OTEL_RESOURCE_ATTRIBUTES`
- Add startup/probe spans and IPC handlers for config/trace relay/query
- Tests: [src/main/__tests__/env-config-mapping.test.js](cci:7://file:///home/five/code/KickTalk/src/main/__tests__/env-config-mapping.test.js:0:0-0:0),
[src/main/__tests__/telemetry-ipc-handlers.test.js](cci:7://file:///home/five/code/KickTalk/src/main/__tests__/telemetry-ipc-handlers.test.js:0:0-0:0)
- Kick WebSocket:
- Harden connection lifecycle, queueing, heartbeat, reconnection/backoff,
circuit breaker, and health reporting
- Updates in [utils/services/kick/websocket.js](cci:7://file:///home/five/code/KickTalk/utils/services/kick/websocket.js:0:0-0:0) and
[utils/services/kick/sharedKickPusher.js](cci:7://file:///home/five/code/KickTalk/utils/services/kick/sharedKickPusher.js:0:0-0:0)
- Comprehensive tests in [utils/services/kick/websocket.test.js](cci:7://file:///home/five/code/KickTalk/utils/services/kick/websocket.test.js:0:0-0:0)
- Settings UI:
- Add “Chat History Length” with clamping and defaults
- Integrate notifications sound picker via `window.app.notificationSounds`
- Tests in [src/renderer/src/components/Dialogs/Settings/Sections/General.test.jsx](cci:7://file:///home/five/code/KickTalk/src/renderer/src/components/Dialogs/Settings/Sections/General.test.jsx:0:0-0:0)
and [src/renderer/src/components/Dialogs/Settings.test.jsx](cci:7://file:///home/five/code/KickTalk/src/renderer/src/components/Dialogs/Settings.test.jsx:0:0-0:0)
- Constants/Badges:
- Refine URL/clip regexes and subscriber badge fallback in [utils/constants.js](cci:7://file:///home/five/code/KickTalk/utils/constants.js:0:0-0:0)
- Tests: [utils/constants.test.js](cci:7://file:///home/five/code/KickTalk/utils/constants.test.js:0:0-0:0), [utils/kickTalkBadges.test.js](cci:7://file:///home/five/code/KickTalk/utils/kickTalkBadges.test.js:0:0-0:0)
- Renderer components:
- EmoteDialogs: safe avatar URLs, lazy loading, filters; tests in
[EmoteDialogs.test.jsx](cci:7://file:///home/five/code/KickTalk/src/renderer/src/components/Chat/Input/EmoteDialogs.test.jsx:0:0-0:0)
- Chat: provider/mocks stabilization and interaction coverage
- Additional:
- Expand unit coverage across utilities (e.g., `fetchQueue`) and reduce flakiness
…rune duplicates Merged enhanced cases into existing tests: ColorPicker.test.jsx, Tooltip.test.jsx, Dropdown.test.jsx (added ARIA assertions) MessageParser.test.jsx already includes comprehensive scenarios Removed experimental/flaky suites: .enhanced.test. (Tooltip/ColorPicker/Accessibility/Performance + services) .comprehensive.test. (telemetry, providers, hooks, MessageParser, Chat Input) .integration.test. (SharedComponents, chatErrors, websocket-integration) appleEmojis.performance.test.js diff.txt artifact Kept deterministic coverage: appleEmojis.test.js, chatErrors.test.js, useClickOutside.test.js Rationale: reduce flakiness and duplication, align with electron‑vite patterns, speed up CI
Split Vitest into renderer/main projects in vitest.config.js Trim reporters/threads to reduce memory and avoid OOM locally/CI vitest.setup.main.js: remove forced NODE_ENV, keep VITEST only vitest.setup.renderer.js: make clipboard spy robust; avoid user‑event + fake timers deadlock by using fireEvent for clicks when advanceTimers is used ErrorBoundary.test.jsx: open dialog with real timers; use fake timers only for 2s reset; add clipboard fallbacks; stabilize rapid copy attempts Why: Prevents heap OOMs by scoping jsdom to renderer only Fixes timeouts from user‑event with fake timers Aligns with TESTING.md multi‑project setup and env behavior
…ation tests - Fix kickEmoteRegex to support trailing colon format ([emote:123:name:]) - Fix kickEmoteInputRegex to handle colon emotes followed by text (:emote:suffix) - Replace flawed unit tests with integration tests using mock emote database - Add comprehensive case sensitivity testing for emote validation - Fix chat error message case and immutability test expectations Resolves all 11 failing constants tests by implementing realistic emote validation that mirrors actual application behavior: regex finds candidates, database lookup validates exact case matches.
|
@codex review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codex Review: Here are some suggestions.
Reply with @codex fix comments to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
… P1 issues Constants improvements: - Fix kickEmoteRegex to support trailing colon format ([emote:123:name:]) - Replace flawed kickEmoteInputRegex unit tests with realistic integration tests - Add mock emote database with case-sensitive validation testing - Fix chat error message case and immutability test expectations P1 Codex issue fixes: - Remove React Router dependency from SettingsMenu (revert to prop-based state) - Fix circuit breaker logic to properly short-circuit when OPEN state - Update SettingsMenu tests to work without Router context All constants tests now pass (107/107) and settings dialog opens without crashing. Circuit breaker now correctly protects failing services during OPEN periods. Testing improvements: - Add performance note to TESTING.md about using quiet test commands - Add guidance against creating secondary test file variants (.enhanced.test.*, etc)
* Fix cross-platform icon compatibility - Add cross-platform icon handling for Linux/macOS support - Convert Windows .ico to .png for non-Windows platforms - Update tray and thumbar icons to use platform-appropriate format Fixes application crashes on Linux due to unsupported .ico format 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Add configurable auto-update settings - Add auto-update toggle in General settings (enabled by default) - Check settings before performing automatic update checks on startup - Skip auto-updater when disabled in settings - Add IPC handler for runtime setting changes - Maintain existing manual update functionality Users can now disable automatic update checking while keeping the ability to manually check for updates through the UI. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Improve auto-update settings: dismiss notifications when disabled - Add immediate dismissal of update notifications when auto-update is disabled in settings - No longer need to restart app to hide existing update notifications - Add onDismiss method to update API in preload script - Listen for autoUpdate setting changes in main process - Update Updater component to handle dismiss events Now when users disable auto-update in settings, any active update notifications disappear immediately instead of persisting until restart. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Implement optimistic message sending - Add immediate visual feedback when users send messages - Messages appear grey/dim while waiting for server confirmation - Messages turn full color when confirmed by server - Failed messages show red tint with warning indicator - Prevent duplicate messages when confirmation arrives - Add message state management (optimistic/confirmed/failed) Users now see their messages immediately instead of waiting for server response, making chat feel much more responsive while maintaining accuracy. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Fix optimistic message styling to affect entire message content - Apply opacity to entire message container instead of individual elements - Use global opacity so all content (text, emotes, links) appears dimmed - Simplify failed message styling with red filter effect - Ensure complete visual feedback for optimistic/failed states Now the entire message content appears grey when optimistic, not just the username. * Fix optimistic message styling by applying classes at correct level - Move optimistic/failed classes from chatMessageContainer to chatMessageItem - chatMessageItem is the actual wrapper that controls message visual styling - Now entire message content (text, emotes, etc.) will appear grey when optimistic - Remove redundant classes from RegularMessage component This fixes the issue where only the username was being styled instead of the complete message content. * Improve optimistic messaging: adjust opacity and add reply support - Reduce optimistic opacity from 0.6 to 0.75 for better readability - Add optimistic messaging support for reply messages - Create createOptimisticReply helper function - Update sendReply to use optimistic messaging pattern - Enhance confirmation logic to handle both messages and replies - Reply messages now appear grey when optimistic, full color when confirmed Both regular messages and replies now have consistent optimistic behavior with improved visual feedback. * Enhance optimistic messaging with comprehensive improvements ## Major Enhancements ### 🚀 Performance Optimizations - **Pre-cache user info** on chatroom connection for instant message display - **Eliminate 1-second delay** before optimistic messages appear - **Smart user color preservation** from existing messages ### 🎨 Visual & UX Improvements - **Replace opacity dimming** with subtle border and background indicators - **Add pulsing animation** for pending messages - **Theme-compatible username colors** using CSS variables - **Enhanced failed message styling** with clear retry indicators ### 🔧 Reliability Features - **30-second timeout handling** for orphaned optimistic messages - **Click-to-retry functionality** for failed messages with visual feedback - **Smart message ordering** by timestamp for edge cases - **Comprehensive error recovery** with proper state management ### 🐛 Bug Fixes - **Fix black username issue** by preserving identity colors and proper fallbacks - **Fix visual styling scope** to avoid CSS inheritance conflicts - **Improve failed message visibility** with red tinting instead of black overlay ## Technical Details - Enhanced `createOptimisticMessage()` and `createOptimisticReply()` with color preservation - Added `retryFailedMessage()`, `cacheCurrentUser()`, and timeout management - Improved CSS with loading animations and theme-compatible variables - Added proper click handlers and visual feedback for failed messages Users now experience instant, reliable messaging with clear visual feedback and robust error recovery. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Final optimistic messaging improvements - Use proper Phosphor arrow-clockwise-fill icon for retry actions - Add copy button alongside retry for failed messages - Remove redundant "An error occurred" system messages - Remove hover transform that caused horizontal scrollbars - Add proper console error logging for debugging Failed messages now show retry + copy buttons with clear visual feedback. Users can choose to auto-retry or copy content for manual handling. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Add missing arrow-clockwise-fill icon and cleanup - Add Phosphor arrow-clockwise-fill.svg icon file for retry functionality - Remove unused retry handler from Message component - Clean up message container click handlers Icon was referenced in code but not committed to repository. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Add compact chatroom list feature - Add toggle in General settings for compact chatroom layout - Implement compact mode with icon-only tabs (40px width) - Add notification bell icon for mentions tab in compact mode - Update navbar styling with :has() selector for clean implementation - Increase chatroom limit from 5 to 25 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: ftk789 <57598907+ftk789@users.noreply.github.com>
This PR introduces a comprehensive testing setup and an initial test suite.
Summary
Notes
Follow-ups