Skip to content

Commit

Permalink
Rollup merge of #110016 - GuillaumeGomez:gui-collapsed-mobile, r=notr…
Browse files Browse the repository at this point in the history
…iddle

Run collapsed GUI test in mobile mode as well

Extending test from #109818 to be run on mobile as well.

Part of #66181.

r? `@notriddle`
  • Loading branch information
matthiaskrgr committed Apr 6, 2023
2 parents e708189 + 529ceee commit 273b221
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions tests/rustdoc-gui/go-to-collapsed-elem.goml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,32 @@ property: ("#implementations-list .implementors-toggle", {"open": "false"})
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.
define-function: ("collapsed-from-search", (), block {
// 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"})
})

call-function: ("collapsed-from-search", {})

// Now running the same check but with mobile.
size: (600, 600)
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
// Then we collapse the section again...
// 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"})
// 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']"
// First we expand the mobile menu.
click: ".sidebar-menu-toggle"
// Then we click on the link to the method to ensure it'll expand the implementors block.
click: "//*[@class='sidebar shown']//a[@href='#method.must_use']"
assert-property: ("#implementations-list .implementors-toggle", {"open": "true"})

call-function: ("collapsed-from-search", {})

0 comments on commit 273b221

Please sign in to comment.