mirror of
https://github.com/rust-lang/mdBook.git
synced 2025-12-27 10:16:09 -05:00
Add a general-purpose summary GUI book
This adds the all-summary GUI test book which can be used for general purpose tests that need a few pages to exercise all the different kinds of items.
This commit is contained in:
3
tests/gui/books/all-summary/README.md
Normal file
3
tests/gui/books/all-summary/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# All summary
|
||||
|
||||
This GUI test book tests all the different kinds of book items in the summary.
|
||||
2
tests/gui/books/all-summary/book.toml
Normal file
2
tests/gui/books/all-summary/book.toml
Normal file
@@ -0,0 +1,2 @@
|
||||
[book]
|
||||
title = "all-summary"
|
||||
20
tests/gui/books/all-summary/src/SUMMARY.md
Normal file
20
tests/gui/books/all-summary/src/SUMMARY.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# Summary
|
||||
|
||||
[Prefix 1](prefix-1.md)
|
||||
[Prefix 2](prefix-2.md)
|
||||
|
||||
- [Introduction](intro.md)
|
||||
- [Draft]()
|
||||
|
||||
# Part 1
|
||||
|
||||
- [P1 C1](part-1/chapter-1.md)
|
||||
|
||||
---
|
||||
|
||||
# Part 2
|
||||
|
||||
- [P2 C1](part-2/chapter-1.md)
|
||||
|
||||
[Suffix 1](suffix-1.md)
|
||||
[Suffix 2](suffix-2.md)
|
||||
1
tests/gui/books/all-summary/src/intro.md
Normal file
1
tests/gui/books/all-summary/src/intro.md
Normal file
@@ -0,0 +1 @@
|
||||
# Introduction
|
||||
1
tests/gui/books/all-summary/src/part-1/chapter-1.md
Normal file
1
tests/gui/books/all-summary/src/part-1/chapter-1.md
Normal file
@@ -0,0 +1 @@
|
||||
# P1 C1
|
||||
1
tests/gui/books/all-summary/src/part-2/chapter-1.md
Normal file
1
tests/gui/books/all-summary/src/part-2/chapter-1.md
Normal file
@@ -0,0 +1 @@
|
||||
# P2 C1
|
||||
1
tests/gui/books/all-summary/src/prefix-1.md
Normal file
1
tests/gui/books/all-summary/src/prefix-1.md
Normal file
@@ -0,0 +1 @@
|
||||
# Prefix 1
|
||||
1
tests/gui/books/all-summary/src/prefix-2.md
Normal file
1
tests/gui/books/all-summary/src/prefix-2.md
Normal file
@@ -0,0 +1 @@
|
||||
# Prefix 2
|
||||
1
tests/gui/books/all-summary/src/suffix-1.md
Normal file
1
tests/gui/books/all-summary/src/suffix-1.md
Normal file
@@ -0,0 +1 @@
|
||||
# Suffix 1
|
||||
1
tests/gui/books/all-summary/src/suffix-2.md
Normal file
1
tests/gui/books/all-summary/src/suffix-2.md
Normal file
@@ -0,0 +1 @@
|
||||
# Suffix 2
|
||||
@@ -1,36 +1,43 @@
|
||||
// This tests pressing the left and right arrows moving to previous and next page.
|
||||
|
||||
go-to: |DOC_PATH| + "test_book/index.html"
|
||||
go-to: |DOC_PATH| + "all-summary/index.html"
|
||||
|
||||
// default page is the first numbered page
|
||||
assert-text: ("title", "Introduction - mdBook test book")
|
||||
|
||||
// Moving left we get to the prefix page
|
||||
press-key: 'ArrowLeft'
|
||||
assert-text: ("title", "Prefix Chapter - mdBook test book")
|
||||
// default page is the first chapter
|
||||
assert-text: ("title", "Prefix 1 - all-summary")
|
||||
|
||||
// Trying to move to the left beyond the prefix pages - nothing changes
|
||||
press-key: 'ArrowLeft'
|
||||
assert-text: ("title", "Prefix Chapter - mdBook test book")
|
||||
assert-text: ("title", "Prefix 1 - all-summary")
|
||||
|
||||
// Back to the main page
|
||||
// Move left
|
||||
go-to: |DOC_PATH| + "all-summary/intro.html"
|
||||
assert-text: ("title", "Introduction - all-summary")
|
||||
|
||||
press-key: 'ArrowLeft'
|
||||
assert-text: ("title", "Prefix 2 - all-summary")
|
||||
|
||||
press-key: 'ArrowLeft'
|
||||
assert-text: ("title", "Prefix 1 - all-summary")
|
||||
|
||||
// Move right
|
||||
press-key: 'ArrowRight'
|
||||
assert-text: ("title", "Introduction - mdBook test book")
|
||||
assert-text: ("title", "Prefix 2 - all-summary")
|
||||
|
||||
press-key: 'ArrowRight'
|
||||
assert-text: ("title", "Markdown Individual tags - mdBook test book")
|
||||
assert-text: ("title", "Introduction - all-summary")
|
||||
|
||||
press-key: 'ArrowRight'
|
||||
assert-text: ("title", "Heading - mdBook test book")
|
||||
assert-text: ("title", "P1 C1 - all-summary")
|
||||
|
||||
// Last numbered page
|
||||
go-to: "../last.html"
|
||||
assert-text: ("title", "Last numbered chapter - mdBook test book")
|
||||
|
||||
// Go to the suffix chapter
|
||||
press-key: 'ArrowRight'
|
||||
assert-text: ("title", "Suffix Chapter - mdBook test book")
|
||||
assert-text: ("title", "P2 C1 - all-summary")
|
||||
|
||||
press-key: 'ArrowRight'
|
||||
assert-text: ("title", "Suffix 1 - all-summary")
|
||||
|
||||
press-key: 'ArrowRight'
|
||||
assert-text: ("title", "Suffix 2 - all-summary")
|
||||
|
||||
// Try to go beyond the last page
|
||||
press-key: 'ArrowRight'
|
||||
assert-text: ("title", "Suffix Chapter - mdBook test book")
|
||||
assert-text: ("title", "Suffix 2 - all-summary")
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
// This GUI test checks the active page sidebar highlight.
|
||||
|
||||
go-to: |DOC_PATH| + "test_book/index.html"
|
||||
go-to: |DOC_PATH| + "all-summary/index.html"
|
||||
|
||||
assert-text: ("mdbook-sidebar-scrollbox a.active", "Prefix Chapter")
|
||||
assert-text: ("mdbook-sidebar-scrollbox a.active", "Prefix 1")
|
||||
|
||||
go-to: |DOC_PATH| + "test_book/individual/index.html"
|
||||
go-to: |DOC_PATH| + "all-summary/part-1/chapter-1.html"
|
||||
|
||||
assert-text: ("mdbook-sidebar-scrollbox a.active", "3. Markdown Individual tags")
|
||||
assert-text: ("mdbook-sidebar-scrollbox a.active", "3. P1 C1")
|
||||
|
||||
go-to: |DOC_PATH| + "test_book/index.html?highlight=test"
|
||||
go-to: |DOC_PATH| + "all-summary/index.html?highlight=test"
|
||||
|
||||
assert-text: ("mdbook-sidebar-scrollbox a.active", "Prefix Chapter")
|
||||
assert-text: ("mdbook-sidebar-scrollbox a.active", "Prefix 1")
|
||||
|
||||
go-to: |DOC_PATH| + "test_book/individual/index.html?highlight=test"
|
||||
go-to: |DOC_PATH| + "all-summary/part-1/chapter-1.html?highlight=test"
|
||||
|
||||
assert-text: ("mdbook-sidebar-scrollbox a.active", "3. Markdown Individual tags")
|
||||
assert-text: ("mdbook-sidebar-scrollbox a.active", "3. P1 C1")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// This GUI test checks sidebar hide/show and also its behaviour on smaller
|
||||
// width.
|
||||
|
||||
go-to: |DOC_PATH| + "test_book/index.html"
|
||||
go-to: |DOC_PATH| + "all-summary/index.html"
|
||||
set-window-size: (1100, 600)
|
||||
// Need to reload for the new size to be taken account by the JS.
|
||||
reload:
|
||||
@@ -44,13 +44,13 @@ define-function: (
|
||||
)
|
||||
|
||||
// Since the sidebar is visible, we should be able to find this text.
|
||||
assert-find-text: ("3.9. Links and Horizontal Rule", {"case-sensitive": true})
|
||||
assert-find-text: ("3. P1 C1", {"case-sensitive": true})
|
||||
call-function: ("hide-sidebar", {})
|
||||
// Text should not be findeable anymore since the sidebar is collapsed.
|
||||
assert-find-text-false: ("3.9. Links and Horizontal Rule", {"case-sensitive": true})
|
||||
assert-find-text-false: ("3. P1 C1", {"case-sensitive": true})
|
||||
call-function: ("show-sidebar", {})
|
||||
// We should be able to find this text again.
|
||||
assert-find-text: ("3.9. Links and Horizontal Rule", {"case-sensitive": true})
|
||||
assert-find-text: ("3. P1 C1", {"case-sensitive": true})
|
||||
|
||||
// We now test on smaller width to ensure that the sidebar is collapsed by default.
|
||||
set-window-size: (900, 600)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
debug: true
|
||||
|
||||
go-to: |DOC_PATH| + "test_book/index.html"
|
||||
go-to: |DOC_PATH| + "all-summary/index.html"
|
||||
|
||||
// TODO: Dark mode is automatic, how to check that here?
|
||||
assert-css: ("#mdbook-theme-list", {"display": "none"})
|
||||
@@ -31,5 +31,5 @@ press-key: 'Escape'
|
||||
assert-css: ("#mdbook-theme-list", {"display": "none"})
|
||||
|
||||
// Check for navigation retains theme.
|
||||
go-to: "./rust/rust_codeblock.html"
|
||||
go-to: "./part-1/chapter-1.html"
|
||||
assert-attribute: ("html", {"class": "rust js"})
|
||||
|
||||
Reference in New Issue
Block a user