Skip to content

Commit

Permalink
Final cleanup of TEST documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaifroid committed Aug 10, 2023
1 parent 6d904ba commit 1253889
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ _You must test your code yourself before asking for review, like this_:
that their fix is working, but we discover they only applied the fix in one of these two modes. Don't be **that** contributor!
* Unit tests, which test for regressions with basic app functions, are run automatically with GitHub Actions on each PR and push to a PR. If one of these tests fails, you will want
to debug. First, see if you can also see the failure by running the tests with `npm test`, whcih should run the tests in all your installed browsers. To address any issues
identified, see [TESTS.md](./TESTS.md) so you can debug;
identified, see [TESTS](./TESTS.md) so you can debug;
* End-to-end (e2e) tests are also run on GitHub Actions when you push to your PR. These test typical user actions in a headless browser. Tests are currently enabled for latest
Firefox, Edge, Chrome in Linux and Windows, and in IE Mode on Windows (this is the equivalent to testing on Internet Explorer 11). You can run these tests yourself in a
non-headless browser with `npm run tests-e2e-firefox`, `npm run tests-e2e-iemode`, etc. For more information, see [TESTS.md](./TESTS.md).
Expand Down
9 changes: 4 additions & 5 deletions TESTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ functions that the rest of the app relies on. End-to-end tests are designed to t
Unit tests are implemented, for historic reaons, with QUnit. When run in an automated way, these are currently run by using the browser testing framework Test_Café.

You can manually run and debug Unit tests simply by opening `tests/index.html` in Firefox, Edge, or Chromium/Chrome through a (local) web server, such as Vite or http-server (see
[CONTRIBUTING](https://github.com/kiwix/kiwix-js/blob/main/CONTRIBUTING.md)). Use DevTools (F12) to debug and find out what is failing. Note that this only tests the unbundled
[CONTRIBUTING](./CONTRIBUTING.md)). Use DevTools (F12) to debug and find out what is failing. Note that this only tests the unbundled
(source) code, and so it only works in browsers that support ES6 modules. You *cannot* use these tests in IE11 or older Firefox/Chromium.

You can run the unit tests with npm on all your installed browsers with `npm test` in your terminal. Before running the tests, if you didn't already, you will need to fetch
development dependencies (see "[Build system and setup](https://github.com/kiwix/kiwix-js/blob/main/CONTRIBUTING.md#build-system-and-setup)"). If testing this way,
development dependencies (see "[Build system and setup](./CONTRIBUTING.md#build-system-and-setup)"). If testing this way,
make sure that `http-server` is not already running, because another copy is launched for these tests, and the ports may conflict. If running tests in parallel like this produces
unexpected results (some tests might be too slow and assert before they have completed correctly), then you can run individual tests in headless mode with
`npm run test-unit-firefox`, `npm run test-unit-edge`, etc. (see `package.json` for full list of scripts). Note that browsers need to be available in standard locations for this
Expand Down Expand Up @@ -46,8 +46,7 @@ following procedure:
The ZIM archive that is tested is also found in `tests`. In the case of `legacy-ray_charles.e2e.spec.js`, this is a legacy split ZIM archive that has XZ compression, so a useful test
of that type of ZIM. We are looking to expand the tests to run also on a modern small ZIM with ZSTD compression and dynamic content.

If you wish to develop tests for a new archive, be sure to create a new `e2e.spc.js` file that corresponds to that archive. It will be easiest to duplicate the existing legacy
ray_charles suite and change the name of your copy. To luanch your new tests, you will need to add them to each browser's runner as an import. Finally, once the test is working
locally, it can be added to the corresponding script in `package.json` (`test-e2e-edge`, `test-e2e-chrome`, etc.).
If you wish to develop tests for a new archive, be sure to create a new `e2e.spec.js` file that corresponds to that archive. It will be easiest to duplicate the existing legacy
ray_charles suite and change the name of your copy. To luanch your new tests, you will need to add them to each browser's runner as an import.

Please note that we are currently using **Selenium** WebDriver, *not* WebDriver.io, which is a different (but related) project with subtly different test syntax.

0 comments on commit 1253889

Please sign in to comment.