Skip to content

Commit f52d974

Browse files
Reduce flakyness in help.goml
1 parent 7c54d95 commit f52d974

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/librustdoc/html/static/js/settings.js

+3
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,9 @@
218218
if (isSettingsPage) {
219219
document.getElementById(MAIN_ID).appendChild(el);
220220
} else {
221+
// Don't make the popover visible until after the event handlers are set up.
222+
// Otherwise, we get flakey integration tests.
223+
el.style.display = "none";
221224
el.setAttribute("tabindex", "-1");
222225
getSettingsButton().appendChild(el);
223226
}

tests/rustdoc-gui/help-page.goml

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// This test ensures that opening the help page in its own tab works.
2+
include: "utils.goml"
23
go-to: "file://" + |DOC_PATH| + "/help.html"
34
set-window-size: (1000, 1000) // Try desktop size first.
45
wait-for: "#help"
@@ -19,9 +20,7 @@ define-function: (
1920
"check-colors",
2021
[theme, color, background, box_shadow],
2122
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:
23+
call-function: ("switch-theme", {"theme": |theme|})
2524
assert-css: ("#help kbd", {
2625
"color": |color|,
2726
"background-color": |background|,

tests/rustdoc-gui/utils.goml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ define-function: (
77
// Open the settings menu.
88
click: "#settings-menu"
99
// Wait for the popover to appear...
10-
wait-for: "#settings"
10+
wait-for-css: ("#settings", {"display": "block"})
1111
// Change the setting.
1212
click: "#theme-"+ |theme|
1313
// Close the popover.
1414
click: "#settings-menu"
1515
// Ensure that the local storage was correctly updated.
16-
assert-local-storage: {"rustdoc-theme": |theme|}
16+
wait-for-local-storage: {"rustdoc-theme": |theme|}
1717
},
1818
)

0 commit comments

Comments
 (0)