This enables a test for the width and height of slides (excluding some special cases completely). The mechanism has an exemption mechanism to temporarily exempt slides from the rules. Even exempted slides are checked for the rule violation and once the slides are compliant they must be removed from the exemption list to avoid future regression (the check fails in the CI if compliant slides are exempted!) This also provides a good opportunity to always have an up-to-date list of overlong slides in [slide-exemptions.list.ts](tests/src/slides/slide-exemptions.list.ts) that can be worked on. The slide list is always autogenerated in the CI environment. If you want to enable this for your local dev environment it has to be created manually. This avoids a time consuming local test if it is not necessary. On the CLI it can be locally used with `npm run test -- --spec=src/slide-size.test.ts` (after creating the list with `./src/slides/create-slide.list.sh ../book/html/`). The CI environment specifies the env var `TEST_BOOK_DIR` that is used to specifiy the html directory so it can create the list of slides on-the-fly, check against hardcoded exemptions and evaluate. This is a new solution for #1464 within the new test framework. This is related to #2234 and makes the mdbook-slide-evaluator from #2258 obsolete and should be removed as this is a not so powerful nor flexible framework.
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 and the webdriverIO Expect API 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 is
used mainly in the CI 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.
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