2022-01-21 13:41:47 -06:00
|
|
|
// Checks that the crate search filtering is handled correctly and changes the results.
|
2023-04-11 12:11:34 -05:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
|
2021-11-24 11:01:34 -06:00
|
|
|
show-text: true
|
2021-06-22 05:06:09 -05:00
|
|
|
write: (".search-input", "test")
|
2022-07-16 06:53:43 -05:00
|
|
|
// To be SURE that the search will be run.
|
|
|
|
press-key: 'Enter'
|
2021-06-22 05:06:09 -05:00
|
|
|
// Waiting for the search results to appear...
|
2022-12-22 16:52:34 -06:00
|
|
|
wait-for: "#search-tabs"
|
2021-06-22 05:06:09 -05:00
|
|
|
assert-text: ("#results .externcrate", "test_docs")
|
2021-11-24 11:01:34 -06:00
|
|
|
|
2022-01-01 22:48:34 -06:00
|
|
|
wait-for: "#crate-search"
|
2021-06-22 05:06:09 -05:00
|
|
|
// We now want to change the crate filter.
|
|
|
|
click: "#crate-search"
|
|
|
|
// We select "lib2" option then press enter to change the filter.
|
|
|
|
press-key: "ArrowDown"
|
2022-01-10 10:48:07 -06:00
|
|
|
press-key: "ArrowDown"
|
2022-11-05 12:14:31 -05:00
|
|
|
press-key: "ArrowDown"
|
2023-01-03 20:46:40 -06:00
|
|
|
press-key: "ArrowDown"
|
2023-04-12 08:17:33 -05:00
|
|
|
press-key: "ArrowDown"
|
2021-06-22 05:06:09 -05:00
|
|
|
press-key: "Enter"
|
|
|
|
// Waiting for the search results to appear...
|
2022-12-22 16:52:34 -06:00
|
|
|
wait-for: "#search-tabs"
|
2022-03-15 14:56:14 -05:00
|
|
|
assert-document-property: ({"URL": "&filter-crate="}, CONTAINS)
|
2021-06-22 05:06:09 -05:00
|
|
|
// We check that there is no more "test_docs" appearing.
|
|
|
|
assert-false: "#results .externcrate"
|
2022-01-10 10:48:07 -06:00
|
|
|
// We also check that "lib2" is the filter crate.
|
|
|
|
assert-property: ("#crate-search", {"value": "lib2"})
|
|
|
|
|
|
|
|
// Now we check that leaving the search results and putting them back keeps the
|
|
|
|
// crate filtering.
|
|
|
|
press-key: "Escape"
|
2022-03-21 09:50:05 -05:00
|
|
|
wait-for-css: ("#main-content", {"display": "block"})
|
2022-01-10 10:48:07 -06:00
|
|
|
focus: ".search-input"
|
2022-03-21 09:50:05 -05:00
|
|
|
wait-for-css: ("#main-content", {"display": "none"})
|
2022-01-10 10:48:07 -06:00
|
|
|
// We check that there is no more "test_docs" appearing.
|
|
|
|
assert-false: "#results .externcrate"
|
|
|
|
assert-property: ("#crate-search", {"value": "lib2"})
|
|
|
|
|
|
|
|
// Selecting back "All crates"
|
|
|
|
click: "#crate-search"
|
|
|
|
press-key: "ArrowUp"
|
|
|
|
press-key: "ArrowUp"
|
2022-11-05 12:14:31 -05:00
|
|
|
press-key: "ArrowUp"
|
2023-01-03 20:46:40 -06:00
|
|
|
press-key: "ArrowUp"
|
2023-04-12 08:17:33 -05:00
|
|
|
press-key: "ArrowUp"
|
2022-01-10 10:48:07 -06:00
|
|
|
press-key: "Enter"
|
|
|
|
// Waiting for the search results to appear...
|
2022-12-22 16:52:34 -06:00
|
|
|
wait-for: "#search-tabs"
|
2022-07-03 13:10:19 -05:00
|
|
|
assert-property: ("#crate-search", {"value": "all crates"})
|
2022-01-10 10:48:07 -06:00
|
|
|
|
|
|
|
// Checking that the URL parameter is taken into account for crate filtering.
|
2023-04-11 12:11:34 -05:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=test&filter-crate=lib2"
|
2022-01-10 10:48:07 -06:00
|
|
|
wait-for: "#crate-search"
|
|
|
|
assert-property: ("#crate-search", {"value": "lib2"})
|
|
|
|
assert-false: "#results .externcrate"
|
2022-05-17 06:28:22 -05:00
|
|
|
|
2022-07-03 13:10:19 -05:00
|
|
|
// Checking that the text for the "title" is correct (the "all crates" comes from the "<select>").
|
|
|
|
assert-text: (".search-results-title", "Results in all crates", STARTS_WITH)
|
2022-05-17 07:45:23 -05:00
|
|
|
|
|
|
|
// Checking the display of the crate filter.
|
|
|
|
// We start with the light theme.
|
2023-04-11 12:11:34 -05:00
|
|
|
set-local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
|
2022-05-17 07:45:23 -05:00
|
|
|
reload:
|
|
|
|
|
2023-04-11 12:11:34 -05:00
|
|
|
set-timeout: 2000
|
2022-05-17 07:45:23 -05:00
|
|
|
wait-for: "#crate-search"
|
|
|
|
assert-css: ("#crate-search", {
|
|
|
|
"border": "1px solid rgb(224, 224, 224)",
|
|
|
|
"color": "rgb(0, 0, 0)",
|
|
|
|
"background-color": "rgb(255, 255, 255)",
|
|
|
|
})
|
|
|
|
|
|
|
|
// We now check the dark theme.
|
|
|
|
click: "#settings-menu"
|
|
|
|
wait-for: "#settings"
|
|
|
|
click: "#theme-dark"
|
|
|
|
wait-for-css: ("#crate-search", {
|
2022-08-13 08:47:19 -05:00
|
|
|
"border": "1px solid rgb(224, 224, 224)",
|
2022-07-03 13:10:19 -05:00
|
|
|
"color": "rgb(221, 221, 221)",
|
|
|
|
"background-color": "rgb(53, 53, 53)",
|
2022-05-17 07:45:23 -05:00
|
|
|
})
|
|
|
|
|
|
|
|
// And finally we check the ayu theme.
|
|
|
|
click: "#theme-ayu"
|
|
|
|
wait-for-css: ("#crate-search", {
|
2022-07-03 13:10:19 -05:00
|
|
|
"border": "1px solid rgb(92, 103, 115)",
|
|
|
|
"color": "rgb(255, 255, 255)",
|
|
|
|
"background-color": "rgb(15, 20, 25)",
|
2022-05-17 07:45:23 -05:00
|
|
|
})
|