From 85afbe466efcbfac61133652a8b70f9395701cdc Mon Sep 17 00:00:00 2001 From: Gabor Szabo Date: Thu, 20 Mar 2025 21:58:21 +0200 Subject: [PATCH 1/2] Add GUI test to check the left and right arrow keys --- tests/gui/move-between-pages.goml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tests/gui/move-between-pages.goml diff --git a/tests/gui/move-between-pages.goml b/tests/gui/move-between-pages.goml new file mode 100644 index 00000000..696521a5 --- /dev/null +++ b/tests/gui/move-between-pages.goml @@ -0,0 +1,29 @@ +// This tests basic search behavior. + +// We disable the requests checks because `searchindex.json` will always fail +// locally (due to CORS), but the searchindex.js will succeed. +fail-on-request-error: false + +go-to: |DOC_PATH| + "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") + +// Trying to move to the left beyond the prefix pages - nothing changes +press-key: 'ArrowLeft' +assert-text: ("title", "Prefix Chapter - mdBook test book") + +// Back to the main page +press-key: 'ArrowRight' +assert-text: ("title", "Introduction - mdBook test book") + +press-key: 'ArrowRight' +assert-text: ("title", "Markdown Individual tags - mdBook test book") + +press-key: 'ArrowRight' +assert-text: ("title", "Heading - mdBook test book") + From 1de8cf8ba6ff4219b0a461ccc99771386601970f Mon Sep 17 00:00:00 2001 From: Gabor Szabo Date: Thu, 20 Mar 2025 22:07:08 +0200 Subject: [PATCH 2/2] try the last pages as well --- tests/gui/move-between-pages.goml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/gui/move-between-pages.goml b/tests/gui/move-between-pages.goml index 696521a5..9177b364 100644 --- a/tests/gui/move-between-pages.goml +++ b/tests/gui/move-between-pages.goml @@ -1,4 +1,4 @@ -// This tests basic search behavior. +// This tests pressing the left and right arrows moving to previous and next page. // We disable the requests checks because `searchindex.json` will always fail // locally (due to CORS), but the searchindex.js will succeed. @@ -27,3 +27,14 @@ assert-text: ("title", "Markdown Individual tags - mdBook test book") press-key: 'ArrowRight' assert-text: ("title", "Heading - mdBook test book") +// Last numbered page +go-to: "../rust/rust_codeblock.html" +assert-text: ("title", "Rust Codeblocks - mdBook test book") + +// Go to the suffix chapter +press-key: 'ArrowRight' +assert-text: ("title", "Suffix Chapter - mdBook test book") + +// Try to go beyond the last page +press-key: 'ArrowRight' +assert-text: ("title", "Suffix Chapter - mdBook test book")