Skip to content

Commit 44e5b3b

Browse files
Update GUI tests
1 parent e876275 commit 44e5b3b

File tree

3 files changed

+20
-34
lines changed

3 files changed

+20
-34
lines changed

src/test/rustdoc-gui/settings.goml

+6-17
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,25 @@ assert-false: "#settings"
55
// We now click on the settings button.
66
click: "#settings-menu"
77
wait-for: "#settings"
8-
assert: "#main-content.hidden"
98
assert-css: ("#settings", {"display": "block"})
109
// Let's close it by clicking on the same button.
1110
click: "#settings-menu"
12-
assert-false: "#alternative-display #settings"
13-
assert: "#not-displayed #settings"
14-
assert: "#main-content:not(.hidden)"
15-
16-
// Let's open and then close it again with the "close settings" button.
17-
click: "#settings-menu"
18-
wait-for: "#alternative-display #settings"
19-
assert: "#main-content.hidden"
20-
click: "#back"
21-
wait-for: "#not-displayed #settings"
22-
assert: "#main-content:not(.hidden)"
11+
wait-for-css: ("#settings", {"display": "none"})
2312

2413
// Let's check that pressing "ESCAPE" is closing it.
2514
click: "#settings-menu"
26-
wait-for: "#alternative-display #settings"
15+
wait-for-css: ("#settings", {"display": "block"})
2716
press-key: "Escape"
28-
wait-for: "#not-displayed #settings"
29-
assert: "#main-content:not(.hidden)"
17+
wait-for-css: ("#settings", {"display": "none"})
3018

3119
// Let's click on it when the search results are displayed.
3220
focus: ".search-input"
3321
write: "test"
3422
wait-for: "#alternative-display #search"
3523
click: "#settings-menu"
36-
wait-for: "#alternative-display #settings"
37-
assert: "#not-displayed #search"
24+
wait-for-css: ("#settings", {"display": "block"})
25+
// Ensure that the search is still displayed.
26+
wait-for: "#alternative-display #search"
3827
assert: "#main-content.hidden"
3928

4029
// Now let's check the content of the settings menu.

src/test/rustdoc-gui/shortcuts.goml

-12
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,3 @@ assert-css: ("#help", {"display": "flex"})
1212
assert-false: "#help.hidden"
1313
press-key: "Escape"
1414
assert-css: ("#help.hidden", {"display": "none"})
15-
// Check for the themes list.
16-
assert-css: ("#theme-choices", {"display": "none"})
17-
press-key: "t"
18-
assert-css: ("#theme-choices", {"display": "block"})
19-
press-key: "t"
20-
// We ensure that 't' hides back the menu.
21-
assert-css: ("#theme-choices", {"display": "none"})
22-
press-key: "t"
23-
assert-css: ("#theme-choices", {"display": "block"})
24-
press-key: "Escape"
25-
// We ensure that 'Escape' hides the menu too.
26-
assert-css: ("#theme-choices", {"display": "none"})

src/test/rustdoc-gui/theme-change.goml

+14-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
// Ensures that the theme change is working as expected.
22
goto: file://|DOC_PATH|/test_docs/index.html
3-
click: "#theme-picker"
4-
click: "#theme-choices > button:first-child"
5-
// should be the ayu theme so let's check the color
3+
local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": "dark"}
4+
reload:
5+
click: "#settings-menu"
6+
wait-for: "#theme-ayu"
7+
click: "#theme-ayu"
8+
// should be the ayu theme so let's check the color.
69
wait-for-css: ("body", { "background-color": "rgb(15, 20, 25)" })
7-
click: "#theme-choices > button:last-child"
8-
// should be the light theme so let's check the color
10+
assert-local-storage: { "rustdoc-theme": "ayu" }
11+
click: "#theme-light"
12+
// should be the light theme so let's check the color.
913
wait-for-css: ("body", { "background-color": "rgb(255, 255, 255)" })
14+
assert-local-storage: { "rustdoc-theme": "light" }
15+
click: "#theme-dark"
16+
// Should be the dark theme so let's check the color.
17+
wait-for-css: ("body", { "background-color": "rgb(53, 53, 53)" })
18+
assert-local-storage: { "rustdoc-theme": "dark" }
1019

1120
goto: file://|DOC_PATH|/settings.html
1221
wait-for: "#settings"

0 commit comments

Comments
 (0)