1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-03-21 14:46:37 +02:00

6 Commits

Author SHA1 Message Date
michael-kerscher
4ec257942e
Tests for playground are using a mock response (#2611)
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)
2025-02-06 12:33:33 +01:00
michael-kerscher
153bd63cc0
tests: rename to generic-page.test.ts as only *.test.js is tested (#2625)
the filename without .test. was introduced in #2621
2025-02-04 08:19:53 -05:00
michael-kerscher
2cf9a35b23
Check if menu bar buttons are display and functionality works (#2621)
Test the main page for existence of
- theme button visible
  - clicking shows the list of themes
- search button visible
  - and tests successful search for "Welcome"
- language button visible
  - clicking shows the list of languages

this is testing functionality missing in dev environments in
https://github.com/google/comprehensive-rust/issues/2588 and is relevant
for https://github.com/google/comprehensive-rust/issues/2620
2025-02-04 10:36:34 +01:00
Martin Geisler
1c709efac0
Remove flaky JS test (#2551)
This should stop the test failures, but of course it won’t fix the
underlying problem.

Reverts part of #2513. Related to #2549.
2025-01-15 09:28:57 +01:00
michael-kerscher
34920c76e6
tests: hello world playground run with success and failure tests (#2513)
Implement two tests for the rust playground:
- successful run of the hello world example with the hello world message
in stdout and a hidden stderr
- on purpose compilation error is shown in stderr and "No output" in
stdout
2025-01-14 10:44:23 +01:00
michael-kerscher
48b2b5c312
Add a test framework to test the JS part of the course (#2471)
This is a first draft for a test framework for testing the JS part of
the book that is discussed in #2462

It 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.

Currently only a small test for the speaker-notes implementation demos
the functionality.

The [Static Server
Service](https://webdriver.io/docs/static-server-service/) is used to
serve the book in a way that the test runner can access it.

A CI integration can look like https://webdriver.io/docs/githubactions/
and is implemented with a headless setup. In CI it uses the language
variable to set environment variable that configures where the built
book should be mounted from

---------

Co-authored-by: Martin Geisler <martin@geisler.net>
2024-12-04 09:06:58 +00:00