Skip to content

Commit b1d1e66

Browse files
Add back help-page.goml rustdoc GUI test
1 parent 38d0f87 commit b1d1e66

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

tests/rustdoc-gui/help-page.goml

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

0 commit comments

Comments
 (0)