about summary refs log tree commit diff
path: root/tests/rustdoc-gui
diff options
context:
space:
mode:
authorLeón Orell Valerian Liehr <me@fmease.dev>2025-02-25 13:07:34 +0100
committerGitHub <noreply@github.com>2025-02-25 13:07:34 +0100
commit8462d56fc1b2fe283322b484f6f0d3a30c3eb248 (patch)
tree77c3c91496b0cb7f38f27532af2a909130b48436 /tests/rustdoc-gui
parent1d0e1c37543f0148a9e06c311badf891e51495bb (diff)
parent592028a2fc5f2f9af5aa7d802111b81393736ea0 (diff)
downloadrust-8462d56fc1b2fe283322b484f6f0d3a30c3eb248.tar.gz
rust-8462d56fc1b2fe283322b484f6f0d3a30c3eb248.zip
Rollup merge of #137539 - GuillaumeGomez:copy-content-tests, r=notriddle
 Add rustdoc-gui regression test for #137082

Fixes https://github.com/rust-lang/rust/issues/137082.

Added new commands in `browser-ui-test` allowing us to add a regression test for #137082 and also another to copy code examples content.

r? `@notriddle`
Diffstat (limited to 'tests/rustdoc-gui')
-rw-r--r--tests/rustdoc-gui/code-example-buttons.goml2
-rw-r--r--tests/rustdoc-gui/copy-path.goml9
2 files changed, 9 insertions, 2 deletions
diff --git a/tests/rustdoc-gui/code-example-buttons.goml b/tests/rustdoc-gui/code-example-buttons.goml
index c62683b45da..b96f6ddcc37 100644
--- a/tests/rustdoc-gui/code-example-buttons.goml
+++ b/tests/rustdoc-gui/code-example-buttons.goml
@@ -26,6 +26,8 @@ click: ".example-wrap .copy-button"
 move-cursor-to: ".search-input"
 assert-count: (".example-wrap:not(:hover) .button-holder.keep-visible", 0)
 assert-css: (".example-wrap .copy-button", { "visibility": "hidden" })
+// Since we clicked on the copy button, the clipboard content should have been updated.
+assert-clipboard: 'println!("nothing fancy");\nprintln!("but with two lines!");'
 
 define-function: (
     "check-buttons",
diff --git a/tests/rustdoc-gui/copy-path.goml b/tests/rustdoc-gui/copy-path.goml
index dc05b96f7ae..e8766688f8d 100644
--- a/tests/rustdoc-gui/copy-path.goml
+++ b/tests/rustdoc-gui/copy-path.goml
@@ -1,12 +1,17 @@
 // Checks that the "copy path" button is not triggering JS error and its display
-// isn't broken.
-go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"
+// isn't broken and the copied path is as expected.
+go-to: "file://" + |DOC_PATH| + "/test_docs/foreign_impl_order/trait.Foo.html"
+
+// We ensure that the clipboard is empty.
+assert-clipboard: ""
 
 // First we store the size of the button before we click on it.
 store-size: ("#copy-path", {"width": width, "height": height})
 click: "#copy-path"
 // We wait for the new text to appear.
 wait-for: "#copy-path.clicked"
+// We check that the clipboard value is the expected one.
+assert-clipboard: "test_docs::foreign_impl_order::Foo"
 // We check that the size didn't change.
 assert-size: ("#copy-path.clicked", {"width": |width|, "height": |height|})
 // We wait for the button to turn back to its original state.