Skip to content

Commit

Permalink
AAP-37878: move Chatbot test to vitest-browser-react
Browse files Browse the repository at this point in the history
Right now, our tests are failing due to some problem with `happy-dom`, the fake webbrowser
used to run the tests by `react-testing-library`. `jsdom` is an alternative but we cannot
use it without adjusting our tests and facing similar issues or limitations.

By moving to `vitest-browser-react`, we are now able to run the tests against a real browser
like Chrome or Firefox. We still have the option to run the tests "headless" for a CI environment.

`vitest-browser-react` is directly based on `vitest-browser` and allow us to stay in a standard
`vite` ecosystem. It also reuses some elements from `react-testing-library`, which explains why
the PR is not that large.

Overall, this change reduces the differences between our tests and the production environment,
and allow use to limit our exposure to the limitations of these dummy browser implementations.
  • Loading branch information
goneri committed Dec 19, 2024
1 parent 69a10e1 commit 5f3f923
Show file tree
Hide file tree
Showing 6 changed files with 2,398 additions and 1,284 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/code_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ jobs:
run: npm install
working-directory: ./ansible_ai_connect_chatbot

- name: Install Chromium (chatbot)
run: npx playwright install-deps chromium
working-directory: ./ansible_ai_connect_chatbot

- name: Running Unit Tests with code coverage (TypeScript) (chatbot)
run: npm run coverage
working-directory: ./ansible_ai_connect_chatbot
Expand Down
Loading

0 comments on commit 5f3f923

Please sign in to comment.