about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2023-03-31 22:32:51 +0200
committerGitHub <noreply@github.com>2023-03-31 22:32:51 +0200
commit32842e87b1bb88c783cbdc86bfb842626bb9ecd4 (patch)
tree4c432245b77c499cd5483689b3597c1ef1c35817
parentd732934fa8f7c2aa3c3c4b66fd26b969276a8505 (diff)
parentefad057eed692f2fc8c243707abebe02932fa223 (diff)
downloadrust-32842e87b1bb88c783cbdc86bfb842626bb9ecd4.tar.gz
rust-32842e87b1bb88c783cbdc86bfb842626bb9ecd4.zip
Rollup merge of #109818 - GuillaumeGomez:test-collapsed-item, r=notriddle
rustdoc: Add GUI test for jump to collapsed item

Part of https://github.com/rust-lang/rust/issues/66181.

I updated `browser-ui-test` version because I needed to add a new command `property`: https://github.com/GuillaumeGomez/browser-UI-test/pull/452.

r? `@notriddle`
-rw-r--r--src/ci/docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version2
-rw-r--r--tests/rustdoc-gui/go-to-collapsed-elem.goml21
2 files changed, 22 insertions, 1 deletions
diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version b/src/ci/docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version
index 6fd113fcfd8..66fb941ea37 100644
--- a/src/ci/docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version
+++ b/src/ci/docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version
@@ -1 +1 @@
-0.14.5
\ No newline at end of file
+0.14.6
\ No newline at end of file
diff --git a/tests/rustdoc-gui/go-to-collapsed-elem.goml b/tests/rustdoc-gui/go-to-collapsed-elem.goml
new file mode 100644
index 00000000000..279048e37c1
--- /dev/null
+++ b/tests/rustdoc-gui/go-to-collapsed-elem.goml
@@ -0,0 +1,21 @@
+// This test ensures that when clicking on a link which leads to an item inside a collapsed element,
+// the collapsed element will be expanded.
+goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
+// We check that the implementors block is expanded.
+assert-property: ("#implementations-list .implementors-toggle", {"open": "true"})
+// We now collapse the implementors block.
+property: ("#implementations-list .implementors-toggle", {"open": "false"})
+// And now we click on the link to the method to ensure it'll expand the implementors block.
+click: "//*[@class='sidebar']//a[@href='#method.must_use']"
+assert-property: ("#implementations-list .implementors-toggle", {"open": "true"})
+
+// Now we do the same through search result.
+// First we reload the page without the anchor in the URL.
+goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
+// Then we collapse the section again...
+property: ("#implementations-list .implementors-toggle", {"open": "false"})
+// Then we run the search.
+write: (".search-input", "foo::must_use")
+wait-for: "//*[@id='search']//a[@href='../test_docs/struct.Foo.html#method.must_use']"
+click: "//*[@id='search']//a[@href='../test_docs/struct.Foo.html#method.must_use']"
+assert-property: ("#implementations-list .implementors-toggle", {"open": "true"})