mirror of
https://github.com/rust-lang/mdBook.git
synced 2025-12-27 07:54:20 -05:00
This adds the ability to use multiple books for the GUI tests. This is helpful since some tests need special configuration, and sharing the same book can make it difficult or impossible to test different configurations. It also makes it difficult to make changes to the test_book since it can affect other tests. This works by placing the books in the tests/gui/books directory. The test runner will automatically build all the books. The gui tests can then just access the DOC_PATH with the name of the book. Books are now saved in a temp directory to make it easier to use the DOC_PATH variable, instead of being tests/gui/books/book_name/book which is a little awkward. Following commits will restructure the existing book. This is just a mechanical move.
36 lines
1.1 KiB
Plaintext
36 lines
1.1 KiB
Plaintext
// Basic theme switcher test.
|
|
|
|
debug: true
|
|
|
|
go-to: |DOC_PATH| + "test_book/index.html"
|
|
|
|
// TODO: Dark mode is automatic, how to check that here?
|
|
assert-css: ("#mdbook-theme-list", {"display": "none"})
|
|
click: "#mdbook-theme-toggle"
|
|
assert-css: ("#mdbook-theme-list", {"display": "block"})
|
|
click: "#mdbook-theme-rust"
|
|
assert-attribute: ("html", {"class": "js rust"})
|
|
// Clicking a theme doesn't dismiss the popup.
|
|
assert-css: ("#mdbook-theme-list", {"display": "block"})
|
|
assert-local-storage: {"mdbook-theme": "rust"}
|
|
|
|
// Dismiss via toggle.
|
|
click: "#mdbook-theme-toggle"
|
|
assert-css: ("#mdbook-theme-list", {"display": "none"})
|
|
|
|
// Check for dismissal for click outside.
|
|
click: "#mdbook-theme-toggle"
|
|
assert-css: ("#mdbook-theme-list", {"display": "block"})
|
|
click: "main"
|
|
assert-css: ("#mdbook-theme-list", {"display": "none"})
|
|
|
|
// Check for escape.
|
|
click: "#mdbook-theme-toggle"
|
|
assert-css: ("#mdbook-theme-list", {"display": "block"})
|
|
press-key: 'Escape'
|
|
assert-css: ("#mdbook-theme-list", {"display": "none"})
|
|
|
|
// Check for navigation retains theme.
|
|
go-to: "./rust/rust_codeblock.html"
|
|
assert-attribute: ("html", {"class": "rust js"})
|