Skip to content

Commit 829a047

Browse files
Add GUI test for crate filter URL parameter
1 parent 17fe306 commit 829a047

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/test/rustdoc-gui/search-filter.goml

+30
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,38 @@ wait-for: "#crate-search"
1111
click: "#crate-search"
1212
// We select "lib2" option then press enter to change the filter.
1313
press-key: "ArrowDown"
14+
press-key: "ArrowDown"
1415
press-key: "Enter"
1516
// Waiting for the search results to appear...
1617
wait-for: "#titles"
1718
// We check that there is no more "test_docs" appearing.
1819
assert-false: "#results .externcrate"
20+
// We also check that "lib2" is the filter crate.
21+
assert-property: ("#crate-search", {"value": "lib2"})
22+
23+
// Now we check that leaving the search results and putting them back keeps the
24+
// crate filtering.
25+
press-key: "Escape"
26+
wait-for: 100
27+
assert-css: ("#main-content", {"display": "block"})
28+
focus: ".search-input"
29+
wait-for: 100
30+
assert-css: ("#main-content", {"display": "none"})
31+
// We check that there is no more "test_docs" appearing.
32+
assert-false: "#results .externcrate"
33+
assert-property: ("#crate-search", {"value": "lib2"})
34+
35+
// Selecting back "All crates"
36+
click: "#crate-search"
37+
press-key: "ArrowUp"
38+
press-key: "ArrowUp"
39+
press-key: "Enter"
40+
// Waiting for the search results to appear...
41+
wait-for: "#titles"
42+
assert-property: ("#crate-search", {"value": "All crates"})
43+
44+
// Checking that the URL parameter is taken into account for crate filtering.
45+
goto: file://|DOC_PATH|/test_docs/index.html?search=test&filter-crate=lib2
46+
wait-for: "#crate-search"
47+
assert-property: ("#crate-search", {"value": "lib2"})
48+
assert-false: "#results .externcrate"

0 commit comments

Comments
 (0)