about summary refs log tree commit diff
path: root/tests/rustdoc-gui
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-04-09 05:07:38 +0000
committerbors <bors@rust-lang.org>2024-04-09 05:07:38 +0000
commit86b603cd792b3f6172ba4f676d7b586c1af7630a (patch)
tree570bd620ca9c25b27f3992649864340f5d525d79 /tests/rustdoc-gui
parentbd12986fd6659a3091cff7694b8225374f4a26fe (diff)
parent9ea1063a12866d8e1d8247b1d0f677fa89e7bdbf (diff)
downloadrust-86b603cd792b3f6172ba4f676d7b586c1af7630a.tar.gz
rust-86b603cd792b3f6172ba4f676d7b586c1af7630a.zip
Auto merge of #123663 - matthiaskrgr:rollup-1qnj9j3, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #122768 (Use the more informative generic type inference failure error on method calls on raw pointers)
 - #123620 (sanitizers: Create the rustc_sanitizers crate)
 - #123624 ([rustdoc] [GUI tests] Make theme switching closer to reality)
 - #123636 (Update books)
 - #123647 (rustdoc: slightly clean up the synthesis of blanket impls)
 - #123648 (Avoid ICEing without the pattern_types feature gate)
 - #123649 (KCFI: Use legal charset in shim encoding)
 - #123652 (Fix UI tests with dist-vendored dependencies)
 - #123655 (Remove unimplemented!() from BinOp::ty() function)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'tests/rustdoc-gui')
-rw-r--r--tests/rustdoc-gui/docblock-code-block-line-number.goml16
-rw-r--r--tests/rustdoc-gui/scrape-examples-toggle.goml3
-rw-r--r--tests/rustdoc-gui/search-result-color.goml15
-rw-r--r--tests/rustdoc-gui/settings.goml7
-rw-r--r--tests/rustdoc-gui/utils.goml13
5 files changed, 34 insertions, 20 deletions
diff --git a/tests/rustdoc-gui/docblock-code-block-line-number.goml b/tests/rustdoc-gui/docblock-code-block-line-number.goml
index fc80932caba..348ce0c992f 100644
--- a/tests/rustdoc-gui/docblock-code-block-line-number.goml
+++ b/tests/rustdoc-gui/docblock-code-block-line-number.goml
@@ -2,23 +2,25 @@
 include: "utils.goml"
 go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"
 
-// Otherwise, we can't check text color
-show-text: true
-
 // We check that without this setting, there is no line number displayed.
 assert-false: "pre.example-line-numbers"
 
+// We set the setting to show the line numbers on code examples.
+set-local-storage: {"rustdoc-line-numbers": "true"}
+reload:
+// We wait for the line numbers to be added into the DOM by the JS...
+wait-for: "pre.example-line-numbers"
+
+// Otherwise, we can't check text color
+show-text: true
+
 // Let's now check some CSS properties...
 define-function: (
     "check-colors",
     [theme, color],
     block {
-        // We now set the setting to show the line numbers on code examples.
-        set-local-storage: {"rustdoc-line-numbers": "true"}
         // Page will be reloaded in "switch-theme".
         call-function: ("switch-theme", {"theme": |theme|})
-        // We wait for the line numbers to be added into the DOM by the JS...
-        wait-for: "pre.example-line-numbers"
         // If the test didn't fail, it means that it was found!
         assert-css: (
             "pre.example-line-numbers",
diff --git a/tests/rustdoc-gui/scrape-examples-toggle.goml b/tests/rustdoc-gui/scrape-examples-toggle.goml
index a9d37048188..441895a7c0e 100644
--- a/tests/rustdoc-gui/scrape-examples-toggle.goml
+++ b/tests/rustdoc-gui/scrape-examples-toggle.goml
@@ -9,6 +9,7 @@ define-function: (
     [theme, toggle_line_color, toggle_line_hover_color],
     block {
         call-function: ("switch-theme", {"theme": |theme|})
+        reload:
 
         // Clicking "More examples..." will open additional examples
         assert-attribute-false: (".more-examples-toggle", {"open": ""})
@@ -21,6 +22,8 @@ define-function: (
             ".toggle-line:hover .toggle-line-inner",
             {"background-color": |toggle_line_hover_color|},
         )
+        // We put the toggle in the original state.
+        click: ".more-examples-toggle"
         // Moving cursor away from the toggle line to prevent disrupting next test.
         move-cursor-to: ".search-input"
     },
diff --git a/tests/rustdoc-gui/search-result-color.goml b/tests/rustdoc-gui/search-result-color.goml
index fd0b86af3ea..9825f92b453 100644
--- a/tests/rustdoc-gui/search-result-color.goml
+++ b/tests/rustdoc-gui/search-result-color.goml
@@ -210,24 +210,21 @@ call-function: ("check-search-color", {
 
 // Check the alias.
 go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
-// If the text isn't displayed, the browser doesn't compute color style correctly...
-show-text: true
+
+write-into: (".search-input", "thisisanalias")
+// To be SURE that the search will be run.
+press-key: 'Enter'
+// Waiting for the search results to appear...
+wait-for: "#search-tabs"
 
 define-function: (
     "check-alias",
     [theme, alias, grey],
     block {
         call-function: ("switch-theme", {"theme": |theme|})
-        write-into: (".search-input", "thisisanalias")
-        // To be SURE that the search will be run.
-        press-key: 'Enter'
-        // Waiting for the search results to appear...
-        wait-for: "#search-tabs"
         // Checking that the colors for the alias element are the ones expected.
         assert-css: (".result-name .path .alias", {"color": |alias|})
         assert-css: (".result-name .path .alias > .grey", {"color": |grey|})
-        // Leave the search results to prevent reloading with an already filled search input.
-        press-key: "Escape"
     },
 )
 
diff --git a/tests/rustdoc-gui/settings.goml b/tests/rustdoc-gui/settings.goml
index 56d0f8624e8..0011e44ca59 100644
--- a/tests/rustdoc-gui/settings.goml
+++ b/tests/rustdoc-gui/settings.goml
@@ -36,7 +36,12 @@ wait-for: "#alternative-display #search"
 assert: "#main-content.hidden"
 
 // Now let's check the content of the settings menu.
-call-function: ("switch-theme", {"theme": "dark"})
+// If we are on the settings page, the menu doesn't work the same so we set
+// the theme manually.
+set-local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false"}
+// We reload the page so the local storage settings are being used.
+reload:
+
 click: "#settings-menu"
 wait-for: "#settings"
 
diff --git a/tests/rustdoc-gui/utils.goml b/tests/rustdoc-gui/utils.goml
index d9f8726ec53..844dc98a537 100644
--- a/tests/rustdoc-gui/utils.goml
+++ b/tests/rustdoc-gui/utils.goml
@@ -4,8 +4,15 @@ define-function: (
     [theme],
     block {
         // Set the theme.
-        set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
-        // We reload the page so the local storage settings are being used.
-        reload:
+        // Open the settings menu.
+        click: "#settings-menu"
+        // Wait for the popover to appear...
+        wait-for: "#settings"
+        // 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|}
     },
 )