]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc-gui/search-filter.goml
Auto merge of #94973 - GuillaumeGomez:more-gui-tests, r=notriddle
[rust.git] / src / test / rustdoc-gui / search-filter.goml
1 // Checks that the crate search filtering is handled correctly and changes the results.
2 goto: file://|DOC_PATH|/test_docs/index.html
3 show-text: true
4 write: (".search-input", "test")
5 // Waiting for the search results to appear...
6 wait-for: "#titles"
7 assert-text: ("#results .externcrate", "test_docs")
8
9 wait-for: "#crate-search"
10 // We now want to change the crate filter.
11 click: "#crate-search"
12 // We select "lib2" option then press enter to change the filter.
13 press-key: "ArrowDown"
14 press-key: "ArrowDown"
15 press-key: "Enter"
16 // Waiting for the search results to appear...
17 wait-for: "#titles"
18 assert-document-property: ({"URL": "&filter-crate="}, CONTAINS)
19 // We check that there is no more "test_docs" appearing.
20 assert-false: "#results .externcrate"
21 // We also check that "lib2" is the filter crate.
22 assert-property: ("#crate-search", {"value": "lib2"})
23
24 // Now we check that leaving the search results and putting them back keeps the
25 // crate filtering.
26 press-key: "Escape"
27 wait-for: 100
28 assert-css: ("#main-content", {"display": "block"})
29 focus: ".search-input"
30 wait-for: 100
31 assert-css: ("#main-content", {"display": "none"})
32 // We check that there is no more "test_docs" appearing.
33 assert-false: "#results .externcrate"
34 assert-property: ("#crate-search", {"value": "lib2"})
35
36 // Selecting back "All crates"
37 click: "#crate-search"
38 press-key: "ArrowUp"
39 press-key: "ArrowUp"
40 press-key: "Enter"
41 // Waiting for the search results to appear...
42 wait-for: "#titles"
43 assert-property: ("#crate-search", {"value": "All crates"})
44
45 // Checking that the URL parameter is taken into account for crate filtering.
46 goto: file://|DOC_PATH|/test_docs/index.html?search=test&filter-crate=lib2
47 wait-for: "#crate-search"
48 assert-property: ("#crate-search", {"value": "lib2"})
49 assert-false: "#results .externcrate"