You've already forked comprehensive-rust
mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-07-04 05:40:29 +02:00
Currently, to run the tests that are located in the `tests` directory (the js tests), one has to navigate to the directory and run `npm test` or `npm start`. We now have a way of automating such task execution using the binary in the `xtask` directory. This pr makes use of this by introducing a new command `cargo xtask web-tests` that can be run from anywhere in the repo to run the tests in the `tests` directory. --------- Co-authored-by: Eric Githinji <egithinji@google.com>
24 lines
1.1 KiB
Markdown
24 lines
1.1 KiB
Markdown
# Testing Comprehensive Rust
|
|
|
|
The course material contains JS code that can break and needs to be checked for
|
|
functionality. Examples are `theme/speaker-notes.js` or `theme/book.js`.
|
|
|
|
Comprehensive Rust is using [webdriverIO](https://webdriver.io/) and the
|
|
[webdriverIO Expect API](https://webdriver.io/docs/api/expect-webdriverio/) in
|
|
combination with [Mocha](https://mochajs.org/). WebdriverIO is taking care of
|
|
accessing the webpage with a real browser and can access the state of the page
|
|
so behavior can be asserted.
|
|
|
|
The [Static Server Service](https://webdriver.io/docs/static-server-service/) is
|
|
used mainly in the [CI](../github/workflows/build.yml) to serve the book on port
|
|
`localhost:8080` such that the test runner can access it. This mode is used when
|
|
`npm start` or `npm test` is executed.
|
|
|
|
> **Tip:** Use `cargo xtask web-tests` to run the tests in this directory from
|
|
> anywhere in the repository.
|
|
|
|
For local testing and quick iterations it is possible to use `mdbook serve`
|
|
which creates a small HTTP server on port 3000 by default. There is a special
|
|
config that is invoked with `npm run test-mdbook` that uses
|
|
`http://localhost:3000`
|