Skip to content

Rich unit tests#8

Merged
hh54188 merged 18 commits intomasterfrom
rich-unit-tests
Sep 15, 2025
Merged

Rich unit tests#8
hh54188 merged 18 commits intomasterfrom
rich-unit-tests

Conversation

@hh54188
Copy link
Owner

@hh54188 hh54188 commented Sep 15, 2025

No description provided.

hh54188 and others added 15 commits September 10, 2025 15:13
- Introduced state management for settingsModalVisible and helpModalVisible in uiStore.
- Added corresponding test cases to ensure proper functionality of modal visibility toggling.
- Enhanced UIStore with additional state properties for improved modal handling.
…onger in use. This cleanup helps streamline the codebase and eliminates outdated references.
- Added 'htmlFor' attributes to labels for better accessibility.
- Assigned unique IDs to input fields for improved user interaction and screen reader support.
- Enhanced input validation for API key and backend URL fields.
- Improved user feedback with clearer notifications during save processes.
- Streamlined loading state management for better responsiveness during backend operations.
- Added @vitest/coverage-v8 and its dependencies for improved test coverage reporting.
- Updated @jridgewell/trace-mapping to version 0.3.31 for enhanced functionality.
- Included various new development dependencies to support testing and coverage tools.
- Cleaned up and organized package-lock.json for better maintainability.
- Updated eslint.config.js to include specific rules and settings for test files, improving linting for test code.
- Refactored gemini-chat.e2e.test.js to enhance environment variable loading, supporting both local and CI environments.
- Added detailed logging for environment variable status to aid in debugging during E2E tests.
- Improved error handling for missing environment variables, ensuring clearer feedback for developers.
- Introduced clipboardy as a new dependency for clipboard management.
- Added specific E2E test scripts for image upload and chat functionalities to improve test coverage and organization.
- Updated package-lock.json to reflect the new dependency and its related modules.
- Deleted README.md, E2E_ENVIRONMENT_SETUP.md, and E2E_TESTS_README.md as they are no longer relevant to the current testing framework and setup.
- This cleanup helps streamline the documentation and eliminates confusion regarding E2E testing processes.
- Introduced a new E2E test script for drag-and-drop functionality to enhance test coverage.
- Updated existing test scripts for better organization and clarity in the testing process.
- Added sequential execution settings for E2E tests to improve reliability.
- Configured test timeout and hook timeout to accommodate longer-running tests.
- Disabled file parallelism to ensure tests run one at a time, enhancing stability.
- Deleted the e2e-tests.yml file as it is no longer needed for the current testing framework.
- Updated documentation to reference the GitHub Actions Setup Guide for CI/CD processes.
- Changed branch references in the E2E test workflow from 'main' and 'develop' to 'master'.
- Added a manual trigger for the E2E tests using 'workflow_dispatch'.
- Introduced additional UI store and component tests to improve test coverage.
- Enhanced error handling and logging in E2E test scripts to clarify environment variable loading and requirements.
- Deleted the e2e-tests.yml file as it is no longer needed for the current testing framework.
- Deleted the test-pipeline.yml file as it is no longer needed for the current CI/CD setup.
- This cleanup helps streamline the workflow configuration and eliminates redundancy in testing processes.
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @hh54188, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the testing suite for the Chrome extension by introducing new unit tests for key UI components and Zustand stores, as well as comprehensive end-to-end tests for critical features like image uploads and drag-and-drop. It also refines the testing infrastructure, updates dependencies, and provides detailed documentation to reflect these changes, ensuring a more robust and maintainable codebase.

Highlights

  • Expanded Test Coverage: Introduced new unit tests for the ForceConfigModal, HelpModal, and SettingsModal components, alongside expanded tests for the uiStore and chatStore Zustand stores, significantly increasing the application's test coverage.
  • New End-to-End (E2E) Tests: Added comprehensive E2E tests for critical user interactions, including image upload functionality and drag-and-drop operations, ensuring core features work as expected in a real browser environment.
  • Testing Infrastructure Enhancements: Updated eslint.config.js to include specific rules for test files and configured vitest.config.js to run E2E tests sequentially with increased timeouts, optimizing the testing pipeline.
  • Dependency Updates: Added several new development dependencies to package-lock.json and package.json, including @vitest/coverage-v8 and clipboardy, to support the new testing capabilities and tools.
  • Documentation Improvements: Created new detailed documentation for GitHub Actions setup (GITHUB_ACTIONS_SETUP.md) and a complete E2E testing guide (E2E_TESTING_COMPLETE_GUIDE.md), making it easier for developers to understand and contribute to the testing process.
  • Accessibility and Testability Improvements: Added id attributes to key UI elements in SettingsModal.jsx to improve accessibility and facilitate more robust automated testing.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request significantly improves the project's test coverage by adding a wealth of unit and end-to-end tests. The new E2E tests for image upload and drag-and-drop are particularly valuable and well-implemented. The configuration changes to Vitest to run E2E tests sequentially and the accessibility improvements in the SettingsModal are also great additions.

My review includes a few suggestions for improvement, mainly concerning a redundant ESLint configuration, the removal of a component's README file, and a minor correction in the new E2E testing documentation. Overall, this is an excellent contribution that greatly enhances the project's quality and maintainability.

Comment on lines +35 to +45
ecmaVersion: 2020,
globals: {
...globals.node,
...globals.browser,
chrome: 'readonly',
},
parserOptions: {
ecmaVersion: 'latest',
ecmaFeatures: { jsx: true },
sourceType: 'module',
},
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The ecmaVersion: 2020 on line 35 is redundant because parserOptions.ecmaVersion: 'latest' on line 42 is also specified. In ESLint's flat config, parserOptions are nested under languageOptions, and the more specific setting takes precedence. To avoid confusion and keep the configuration clean, you should remove the redundant ecmaVersion from the top level of languageOptions.

      globals: {
        ...globals.node,
        ...globals.browser,
        chrome: 'readonly',
      },
      parserOptions: {
        ecmaVersion: 'latest',
        ecmaFeatures: { jsx: true },
        sourceType: 'module',
      },

@@ -1,76 +0,0 @@
# ForceConfigModal Component
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This README file for the ForceConfigModal component has been removed. The documentation it contained was valuable for understanding the component's purpose, features, and props. While new tests have been added for this component, they don't fully replace descriptive documentation. Please consider restoring this file or moving its content to a more appropriate location in the project's documentation. Removing documentation can negatively impact maintainability.


### Backend Ports
- Chat test uses port `3001`
- Image upload test uses port `3002` (to avoid conflicts)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This line states that the image upload test uses port 3002. However, looking at the E2E test files (image-upload.e2e.test.js, gemini-chat.e2e.test.js, drag-drop.e2e.test.js), they all seem to be configured to use port 3001. Please correct this documentation to reflect the actual port used in the tests to avoid confusion.

Suggested change
- Image upload test uses port `3002` (to avoid conflicts)
- Image upload test uses port `3001`

- Added dotenv as a new dependency in package.json and package-lock.json for environment variable management.
- Enhanced test setup by clearing timers and global mock stores before each test to prevent cross-test contamination.
- Updated tests to use globalThis for better compatibility and consistency across different environments.
- Removed outdated settingsModal.test.jsx and forceConfigModal.test.jsx files to streamline the test suite.
…itive environment variables

- Removed the 'Run Unit Tests (All)' step to streamline the CI process.
- Eliminated sensitive environment variable references from the CI configuration to enhance security and reduce clutter.
- Removed test coverage generation and upload steps from the CI pipeline to streamline the process.
- Added setup for a virtual display (Xvfb) to support headless E2E testing in CI environments.
- Implemented automatic backend server management for E2E tests, ensuring it starts and stops as needed.
- Updated E2E test scripts to support headless mode based on environment variables, improving compatibility with CI.
- Enhanced documentation to reflect changes in E2E testing setup and browser mode configurations.
@hh54188 hh54188 merged commit 57de18a into master Sep 15, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant