Skip to content

Commit ad12a2a

Browse files
committed
Auto merge of rust-lang#127082 - GuillaumeGomez:help-gui-test, r=notriddle
Add back `help-page.goml` rustdoc GUI test Since rust-lang#127010 was merged, let's see if we can revert rust-lang#126445... r? `@notriddle`
2 parents b8d7dd8 + c8bbeef commit ad12a2a

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

tests/rustdoc-gui/help-page.goml

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// This test ensures that opening the help page in its own tab works.
2+
go-to: "file://" + |DOC_PATH| + "/help.html"
3+
set-window-size: (1000, 1000) // Try desktop size first.
4+
wait-for: "#help"
5+
assert-css: ("#help", {"display": "block"})
6+
assert-css: ("#help dd", {"font-size": "16px"})
7+
click: "#help-button > a"
8+
assert-css: ("#help", {"display": "block"})
9+
compare-elements-property: (".sub", "#help", ["offsetWidth"])
10+
compare-elements-position: (".sub", "#help", ["x"])
11+
set-window-size: (500, 1000) // Try mobile next.
12+
assert-css: ("#help", {"display": "block"})
13+
compare-elements-property: (".sub", "#help", ["offsetWidth"])
14+
compare-elements-position: (".sub", "#help", ["x"])
15+
16+
// Checking the color of the elements of the help menu.
17+
show-text: true
18+
define-function: (
19+
"check-colors",
20+
[theme, color, background, box_shadow],
21+
block {
22+
// FIXME: no clue why we can't call the `switch-theme` function here...
23+
set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
24+
reload:
25+
assert-css: ("#help kbd", {
26+
"color": |color|,
27+
"background-color": |background|,
28+
"box-shadow": |box_shadow| + " 0px -1px 0px 0px inset",
29+
}, ALL)
30+
},
31+
)
32+
33+
call-function: ("check-colors", {
34+
"theme": "ayu",
35+
"color": "#c5c5c5",
36+
"background": "#314559",
37+
"box_shadow": "#5c6773",
38+
})
39+
call-function: ("check-colors", {
40+
"theme": "dark",
41+
"color": "#000",
42+
"background": "#fafbfc",
43+
"box_shadow": "#c6cbd1",
44+
})
45+
call-function: ("check-colors", {
46+
"theme": "light",
47+
"color": "#000",
48+
"background": "#fafbfc",
49+
"box_shadow": "#c6cbd1",
50+
})
51+
52+
// This test ensures that opening the help popover without switching pages works.
53+
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
54+
set-window-size: (1000, 1000) // Only supported on desktop.
55+
assert-false: "#help"
56+
click: "#help-button > a"
57+
assert-css: ("#help", {"display": "block"})
58+
assert-css: ("#help dd", {"font-size": "16px"})
59+
click: "#help-button > a"
60+
assert-css: ("#help", {"display": "none"})
61+
compare-elements-property-false: (".sub", "#help", ["offsetWidth"])
62+
compare-elements-position-false: (".sub", "#help", ["x"])
63+
64+
// This test ensures that the "the rustdoc book" anchor link within the help popover works.
65+
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
66+
set-window-size: (1000, 1000) // Popover only appears when the screen width is >700px.
67+
assert-false: "#help"
68+
click: "#help-button > a"
69+
click: "//*[@id='help']//a[text()='the rustdoc book']"
70+
wait-for-document-property: ({"URL": "https://doc.rust-lang.org/"}, STARTS_WITH)

0 commit comments

Comments
 (0)