]> git.proxmox.com Git - rustc.git/blob - tests/rustdoc-gui/help-page.goml
New upstream version 1.70.0+dfsg1
[rustc.git] / tests / rustdoc-gui / help-page.goml
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 // Setting the theme.
23 set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
24 // We reload the page so the local storage settings are being used.
25 reload:
26 assert-css: ("#help kbd", {
27 "color": |color|,
28 "background-color": |background|,
29 "box-shadow": |box_shadow| + " 0px -1px 0px 0px inset",
30 }, ALL)
31 },
32 )
33
34 call-function: ("check-colors", {
35 "theme": "ayu",
36 "color": "rgb(197, 197, 197)",
37 "background": "rgb(49, 69, 89)",
38 "box_shadow": "rgb(92, 103, 115)",
39 })
40 call-function: ("check-colors", {
41 "theme": "dark",
42 "color": "rgb(0, 0, 0)",
43 "background": "rgb(250, 251, 252)",
44 "box_shadow": "rgb(198, 203, 209)",
45 })
46 call-function: ("check-colors", {
47 "theme": "light",
48 "color": "rgb(0, 0, 0)",
49 "background": "rgb(250, 251, 252)",
50 "box_shadow": "rgb(198, 203, 209)",
51 })
52
53 // This test ensures that opening the help popover without switching pages works.
54 go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
55 set-window-size: (1000, 1000) // Only supported on desktop.
56 assert-false: "#help"
57 click: "#help-button > a"
58 assert-css: ("#help", {"display": "block"})
59 assert-css: ("#help dd", {"font-size": "16px"})
60 click: "#help-button > a"
61 assert-css: ("#help", {"display": "none"})
62 compare-elements-property-false: (".sub", "#help", ["offsetWidth"])
63 compare-elements-position-false: (".sub", "#help", ("x"))
64
65 // This test ensures that the "the rustdoc book" anchor link within the help popover works.
66 go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
67 set-window-size: (1000, 1000) // Popover only appears when the screen width is >700px.
68 assert-false: "#help"
69 click: "#help-button > a"
70 click: ".popover a[href='https://doc.rust-lang.org/rustdoc/']"
71 wait-for-document-property: {"URL": "https://doc.rust-lang.org/rustdoc/"}