Skip to content

Commit

Permalink
Enhance testing suite with Jest and Puppeteer integration
Browse files Browse the repository at this point in the history
- Added Babel configuration for Jest to transpile JavaScript and React code:
  - Created a new `babel.config.js` file with presets for `@babel/preset-env` and `@babel/preset-react`.

- Developed comprehensive unit tests for key chat components:
  - **Chat Component**: Validates rendering of essential UI elements such as the virtual agent text, buttons, and text input.
  - **ChatBar Component**: Tests functionality for sending messages and verifies interaction with the `updateMessagesStateEvent` function.
  - **ChatMessages Component**: Ensures proper display of messages within the chat.
  - **ChatRecommendationBar Component**: Checks for presence of recommendation buttons and verifies interaction for setting text area values.

- Integrated Puppeteer for end-to-end testing of the AI chat functionality:
  - Added a new test file that uses Puppeteer to simulate user interactions with the chat interface and validate AI responses.

- Updated `package.json`:
  - Added necessary dependencies for Babel and Jest, including `@babel/core`, `babel-jest`, and `jest-environment-jsdom`.
  - Corrected project description and added relevant scripts.

- Enhanced `README.md`:
  - Provided detailed instructions for setting up and running tests, including installation of dependencies and configuration.
  - Included guidelines for writing new tests and troubleshooting common issues.

These updates improve test coverage and ensure reliable functionality for the chat components and AI responses.

tech-girls workspace chats aren't used to train our models. ChatGPT can make mistakes.
  • Loading branch information
mollybeach committed Jul 30, 2024
1 parent 3b04e28 commit edc3b26
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ If you encounter any issues while running tests, try the following:
If you encounter issues, consider the following steps:
1. Clear Jest Cache
1. **Clear Jest Cache**
Jest caches test results to improve performance. If you encounter issues, try clearing the Jest cache by running:
```bash
npm run test -- --clearCache
```
2. Check Configuration Files
2. **Check Configuration Files**
Ensure there are no multiple Jest configuration files that might conflict. Jest configuration should be in either jest.config.js or package.json under the jest key, but not both.
Expand Down

0 comments on commit edc3b26

Please sign in to comment.