Skip to content

Commit

Permalink
Reduce flakyness in help.goml
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Jun 28, 2024
1 parent 7c54d95 commit f52d974
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/librustdoc/html/static/js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@
if (isSettingsPage) {
document.getElementById(MAIN_ID).appendChild(el);
} else {
// Don't make the popover visible until after the event handlers are set up.
// Otherwise, we get flakey integration tests.
el.style.display = "none";
el.setAttribute("tabindex", "-1");
getSettingsButton().appendChild(el);
}
Expand Down
5 changes: 2 additions & 3 deletions tests/rustdoc-gui/help-page.goml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// This test ensures that opening the help page in its own tab works.
include: "utils.goml"
go-to: "file://" + |DOC_PATH| + "/help.html"
set-window-size: (1000, 1000) // Try desktop size first.
wait-for: "#help"
Expand All @@ -19,9 +20,7 @@ define-function: (
"check-colors",
[theme, color, background, box_shadow],
block {
// FIXME: no clue why we can't call the `switch-theme` function here...
set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
reload:
call-function: ("switch-theme", {"theme": |theme|})
assert-css: ("#help kbd", {
"color": |color|,
"background-color": |background|,
Expand Down
4 changes: 2 additions & 2 deletions tests/rustdoc-gui/utils.goml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ define-function: (
// Open the settings menu.
click: "#settings-menu"
// Wait for the popover to appear...
wait-for: "#settings"
wait-for-css: ("#settings", {"display": "block"})
// Change the setting.
click: "#theme-"+ |theme|
// Close the popover.
click: "#settings-menu"
// Ensure that the local storage was correctly updated.
assert-local-storage: {"rustdoc-theme": |theme|}
wait-for-local-storage: {"rustdoc-theme": |theme|}
},
)

0 comments on commit f52d974

Please sign in to comment.