The official playground quite often provides a timeout error as in https://github.com/google/comprehensive-rust/issues/2549 This is mocking/overriding the response from the playground for success and failure messages to avoid the server provided timeouts. As far as I see most responses from the playground are delivered below 10 seconds (but varies a lot...) There still might be timeouts and I know of the following knobs that can be tuned - wdio waits for 10 seconds until it aborts the current attemp (e.g. to wait for the text to be as expected)347de61d13/tests/wdio.conf.ts (L98)
- another timeout is the 15 second timeout for fetching the result from the playground - this is not overriden by the mock (currently, pending https://github.com/webdriverio/webdriverio/issues/14090 which would allow for an immediate mock response without waiting for the remote endpoint)347de61d13/theme/book.js (L31)
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