Skip to content

Commit afc1eaf

Browse files
authored
AAP-37878: move Chatbot test to vitest-browser-react (#1470)
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.
1 parent 69a10e1 commit afc1eaf

File tree

6 files changed

+2404
-1284
lines changed

6 files changed

+2404
-1284
lines changed

.github/workflows/code_coverage.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,14 @@ jobs:
119119
run: npm install
120120
working-directory: ./ansible_ai_connect_chatbot
121121

122+
- name: Install Chromium dependencies (chatbot)
123+
run: npx playwright install-deps chromium
124+
working-directory: ./ansible_ai_connect_chatbot
125+
126+
- name: Install Chromium (chatbot)
127+
run: npx playwright install chromium
128+
working-directory: ./ansible_ai_connect_chatbot
129+
122130
- name: Running Unit Tests with code coverage (TypeScript) (chatbot)
123131
run: npm run coverage
124132
working-directory: ./ansible_ai_connect_chatbot

0 commit comments

Comments
 (0)