Auto merge of #94973 - GuillaumeGomez:more-gui-tests, r=notriddle
Add GUI test to check URLs The first commit merges both file doing kinda the same thing. Didn't make much sense to keep them separated. The second commit add checks to ensure the URL has the expected value depending if the search is displayed or not. r? `@notriddle`
This commit is contained in:
commit
52b34550ac
@ -6,23 +6,28 @@ write: (".search-input", "test")
|
||||
wait-for: "#search h1" // The search element is empty before the first search
|
||||
assert-attribute: ("#search", {"class": "content"})
|
||||
assert-attribute: ("#main-content", {"class": "content hidden"})
|
||||
assert-document-property: ({"URL": "index.html?search=test"}, ENDS_WITH)
|
||||
press-key: "Escape"
|
||||
assert-attribute: ("#search", {"class": "content hidden"})
|
||||
assert-attribute: ("#main-content", {"class": "content"})
|
||||
assert-document-property: ({"URL": "index.html"}, [ENDS_WITH])
|
||||
|
||||
// Check that focusing the search input brings back the search results
|
||||
focus: ".search-input"
|
||||
assert-attribute: ("#search", {"class": "content"})
|
||||
assert-attribute: ("#main-content", {"class": "content hidden"})
|
||||
assert-document-property: ({"URL": "index.html?search=test"}, ENDS_WITH)
|
||||
|
||||
// Now let's check that when the help popup is displayed and we press Escape, it doesn't
|
||||
// hide the search results too.
|
||||
click: "#help-button"
|
||||
assert-document-property: ({"URL": "index.html?search=test"}, [ENDS_WITH])
|
||||
assert-attribute: ("#help", {"class": ""})
|
||||
press-key: "Escape"
|
||||
assert-attribute: ("#help", {"class": "hidden"})
|
||||
assert-attribute: ("#search", {"class": "content"})
|
||||
assert-attribute: ("#main-content", {"class": "content hidden"})
|
||||
assert-document-property: ({"URL": "index.html?search=test"}, [ENDS_WITH])
|
||||
|
||||
// Check that Escape hides the search results when a search result is focused.
|
||||
focus: ".search-input"
|
||||
|
@ -15,6 +15,7 @@ press-key: "ArrowDown"
|
||||
press-key: "Enter"
|
||||
// Waiting for the search results to appear...
|
||||
wait-for: "#titles"
|
||||
assert-document-property: ({"URL": "&filter-crate="}, CONTAINS)
|
||||
// We check that there is no more "test_docs" appearing.
|
||||
assert-false: "#results .externcrate"
|
||||
// We also check that "lib2" is the filter crate.
|
||||
|
@ -74,3 +74,23 @@ assert-css: (
|
||||
"//*[@class='result-name']//*[text()='(keyword)']",
|
||||
{"color": "rgb(0, 0, 0)"},
|
||||
)
|
||||
|
||||
// Check the alias more specifically in the dark theme.
|
||||
goto: file://|DOC_PATH|/test_docs/index.html
|
||||
// We set the theme so we're sure that the correct values will be used, whatever the computer
|
||||
// this test is running on.
|
||||
local-storage: {
|
||||
"rustdoc-theme": "dark",
|
||||
"rustdoc-preferred-dark-theme": "dark",
|
||||
"rustdoc-use-system-theme": "false",
|
||||
}
|
||||
// If the text isn't displayed, the browser doesn't compute color style correctly...
|
||||
show-text: true
|
||||
// We reload the page so the local storage settings are being used.
|
||||
reload:
|
||||
write: (".search-input", "thisisanalias")
|
||||
// Waiting for the search results to appear...
|
||||
wait-for: "#titles"
|
||||
// Checking that the colors for the alias element are the ones expected.
|
||||
assert-css: (".result-name > .alias", {"color": "rgb(255, 255, 255)"})
|
||||
assert-css: (".result-name > .alias > .grey", {"color": "rgb(204, 204, 204)"})
|
||||
|
@ -1,19 +0,0 @@
|
||||
// Checks that the result colors are as expected.
|
||||
goto: file://|DOC_PATH|/test_docs/index.html
|
||||
// We set the theme so we're sure that the correct values will be used, whatever the computer
|
||||
// this test is running on.
|
||||
local-storage: {
|
||||
"rustdoc-theme": "dark",
|
||||
"rustdoc-preferred-dark-theme": "dark",
|
||||
"rustdoc-use-system-theme": "false",
|
||||
}
|
||||
// If the text isn't displayed, the browser doesn't compute color style correctly...
|
||||
show-text: true
|
||||
// We reload the page so the local storage settings are being used.
|
||||
reload:
|
||||
write: (".search-input", "thisisanalias")
|
||||
// Waiting for the search results to appear...
|
||||
wait-for: "#titles"
|
||||
// Checking that the colors for the alias element are the ones expected.
|
||||
assert-css: (".result-name > .alias", {"color": "rgb(255, 255, 255)"})
|
||||
assert-css: (".result-name > .alias > .grey", {"color": "rgb(204, 204, 204)"})
|
Loading…
Reference in New Issue
Block a user