Skip to content

Commit 52b3455

Browse files
committed
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`
2 parents 83460d5 + 372271e commit 52b3455

File tree

4 files changed

+26
-19
lines changed

4 files changed

+26
-19
lines changed

src/test/rustdoc-gui/escape-key.goml

+5
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,28 @@ write: (".search-input", "test")
66
wait-for: "#search h1" // The search element is empty before the first search
77
assert-attribute: ("#search", {"class": "content"})
88
assert-attribute: ("#main-content", {"class": "content hidden"})
9+
assert-document-property: ({"URL": "index.html?search=test"}, ENDS_WITH)
910
press-key: "Escape"
1011
assert-attribute: ("#search", {"class": "content hidden"})
1112
assert-attribute: ("#main-content", {"class": "content"})
13+
assert-document-property: ({"URL": "index.html"}, [ENDS_WITH])
1214

1315
// Check that focusing the search input brings back the search results
1416
focus: ".search-input"
1517
assert-attribute: ("#search", {"class": "content"})
1618
assert-attribute: ("#main-content", {"class": "content hidden"})
19+
assert-document-property: ({"URL": "index.html?search=test"}, ENDS_WITH)
1720

1821
// Now let's check that when the help popup is displayed and we press Escape, it doesn't
1922
// hide the search results too.
2023
click: "#help-button"
24+
assert-document-property: ({"URL": "index.html?search=test"}, [ENDS_WITH])
2125
assert-attribute: ("#help", {"class": ""})
2226
press-key: "Escape"
2327
assert-attribute: ("#help", {"class": "hidden"})
2428
assert-attribute: ("#search", {"class": "content"})
2529
assert-attribute: ("#main-content", {"class": "content hidden"})
30+
assert-document-property: ({"URL": "index.html?search=test"}, [ENDS_WITH])
2631

2732
// Check that Escape hides the search results when a search result is focused.
2833
focus: ".search-input"

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

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ press-key: "ArrowDown"
1515
press-key: "Enter"
1616
// Waiting for the search results to appear...
1717
wait-for: "#titles"
18+
assert-document-property: ({"URL": "&filter-crate="}, CONTAINS)
1819
// We check that there is no more "test_docs" appearing.
1920
assert-false: "#results .externcrate"
2021
// We also check that "lib2" is the filter crate.

src/test/rustdoc-gui/search-result-color.goml

+20
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,23 @@ assert-css: (
7474
"//*[@class='result-name']//*[text()='(keyword)']",
7575
{"color": "rgb(0, 0, 0)"},
7676
)
77+
78+
// Check the alias more specifically in the dark theme.
79+
goto: file://|DOC_PATH|/test_docs/index.html
80+
// We set the theme so we're sure that the correct values will be used, whatever the computer
81+
// this test is running on.
82+
local-storage: {
83+
"rustdoc-theme": "dark",
84+
"rustdoc-preferred-dark-theme": "dark",
85+
"rustdoc-use-system-theme": "false",
86+
}
87+
// If the text isn't displayed, the browser doesn't compute color style correctly...
88+
show-text: true
89+
// We reload the page so the local storage settings are being used.
90+
reload:
91+
write: (".search-input", "thisisanalias")
92+
// Waiting for the search results to appear...
93+
wait-for: "#titles"
94+
// Checking that the colors for the alias element are the ones expected.
95+
assert-css: (".result-name > .alias", {"color": "rgb(255, 255, 255)"})
96+
assert-css: (".result-name > .alias > .grey", {"color": "rgb(204, 204, 204)"})

src/test/rustdoc-gui/search-result-colors.goml

-19
This file was deleted.

0 commit comments

Comments
 (0)