diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:20:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:20:39 +0000 |
commit | 1376c5a617be5c25655d0d7cb63e3beaa5a6e026 (patch) | |
tree | 3bb8d61aee02bc7a15eab3f36e3b921afc2075d0 /tests/rustdoc-gui | |
parent | Releasing progress-linux version 1.69.0+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.tar.xz rustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.zip |
Merging upstream version 1.70.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/rustdoc-gui')
110 files changed, 698 insertions, 350 deletions
diff --git a/tests/rustdoc-gui/anchor-navigable.goml b/tests/rustdoc-gui/anchor-navigable.goml index 9d5c55a1e..61d7c89d4 100644 --- a/tests/rustdoc-gui/anchor-navigable.goml +++ b/tests/rustdoc-gui/anchor-navigable.goml @@ -4,7 +4,7 @@ // anchor and the `impl Foo`. If there were a gap, this would cause an annoying // problem: you hover `impl Foo` to see the anchor, then when you move your // mouse to the left, the anchor disappears before you reach it. -goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" // We check that ".item-info" is bigger than its content. move-cursor-to: ".impl" assert-property: (".impl > a.anchor", {"offsetWidth": "8"}) diff --git a/tests/rustdoc-gui/anchors.goml b/tests/rustdoc-gui/anchors.goml index 85cb72274..0904aa90e 100644 --- a/tests/rustdoc-gui/anchors.goml +++ b/tests/rustdoc-gui/anchors.goml @@ -4,12 +4,12 @@ define-function: ( "check-colors", (theme, main_color, title_color, main_heading_color, main_heading_type_color, src_link_color, sidebar_link_color), block { - goto: "file://" + |DOC_PATH| + "/staged_api/struct.Foo.html" + go-to: "file://" + |DOC_PATH| + "/staged_api/struct.Foo.html" // This is needed to ensure that the text color is computed. show-text: true // Setting the theme. - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} // We reload the page so the local storage settings are being used. reload: @@ -48,9 +48,9 @@ define-function: ( {"color": |src_link_color|, "text-decoration": "none solid " + |src_link_color|}, ) - goto: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html" + go-to: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html" // Since we changed page, we need to set the theme again. - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} // We reload the page so the local storage settings are being used. reload: diff --git a/tests/rustdoc-gui/auto-hide-trait-implementations.goml b/tests/rustdoc-gui/auto-hide-trait-implementations.goml deleted file mode 100644 index 0a619c352..000000000 --- a/tests/rustdoc-gui/auto-hide-trait-implementations.goml +++ /dev/null @@ -1,13 +0,0 @@ -// Checks that the setting "auto hide trait implementations" is working as expected. -goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" - -// By default, the trait implementations are not collapsed. -assert-attribute: ("#trait-implementations-list > details", {"open": ""}, ALL) - -// We now set the setting to auto hide all trait implementations. -local-storage: {"rustdoc-auto-hide-trait-implementations": "true" } -// We reload to ensure the trait implementations are collapsed as expected. -reload: - -// We now check that all matching elements don't have the open attributes. -assert-attribute-false: ("#trait-implementations-list > details", {"open": ""}, ALL) diff --git a/tests/rustdoc-gui/basic-code.goml b/tests/rustdoc-gui/basic-code.goml index 971c2f948..e372f7119 100644 --- a/tests/rustdoc-gui/basic-code.goml +++ b/tests/rustdoc-gui/basic-code.goml @@ -1,6 +1,6 @@ // Small test to ensure the "src-line-numbers" element is only present once on // the page. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" click: ".srclink" wait-for: ".src-line-numbers" assert-count: (".src-line-numbers", 1) diff --git a/tests/rustdoc-gui/check-code-blocks-margin.goml b/tests/rustdoc-gui/check-code-blocks-margin.goml index c2cec0020..8c2cbc4d9 100644 --- a/tests/rustdoc-gui/check-code-blocks-margin.goml +++ b/tests/rustdoc-gui/check-code-blocks-margin.goml @@ -1,5 +1,5 @@ // This test ensures that the docblock elements have the appropriate left margin. -goto: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html" // The top docblock elements shouldn't have left margin... assert-css: ("#main-content .item-decl", {"margin-left": "0px"}) // ... but all the others should! diff --git a/tests/rustdoc-gui/check-stab-in-docblock.goml b/tests/rustdoc-gui/check-stab-in-docblock.goml index 266fa9997..2f6263621 100644 --- a/tests/rustdoc-gui/check-stab-in-docblock.goml +++ b/tests/rustdoc-gui/check-stab-in-docblock.goml @@ -1,9 +1,9 @@ // This test checks that using `.stab` attributes in `.docblock` elements doesn't // create scrollable paragraphs. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" // Needs the text to be display to check for scrollable content. show-text: true -size: (786, 600) +set-window-size: (786, 600) // Confirms that there 3 paragraphs. assert-count: (".top-doc .docblock p", 3) // Checking that there is no scrollable content. diff --git a/tests/rustdoc-gui/check_info_sign_position.goml b/tests/rustdoc-gui/check_info_sign_position.goml index f36e73fc5..c9a4ea94c 100644 --- a/tests/rustdoc-gui/check_info_sign_position.goml +++ b/tests/rustdoc-gui/check_info_sign_position.goml @@ -1,7 +1,7 @@ // This test checks the position of the information on the code blocks (like // `compile_fail` or `ignore`). -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" -goto: "./fn.check_list_code_block.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "./fn.check_list_code_block.html" // If the codeblock is the first element of the docblock, the information tooltip must have // have some top margin to avoid going over the toggle (the "[+]"). assert-css: (".docblock > .example-wrap.compile_fail .tooltip", { "margin-top": "16px" }) diff --git a/tests/rustdoc-gui/code-blocks-overflow.goml b/tests/rustdoc-gui/code-blocks-overflow.goml index fbf0e890b..a23136f4b 100644 --- a/tests/rustdoc-gui/code-blocks-overflow.goml +++ b/tests/rustdoc-gui/code-blocks-overflow.goml @@ -1,6 +1,6 @@ // This test ensures that codeblocks content don't overflow. -goto: "file://" + |DOC_PATH| + "/lib2/sub_mod/struct.Foo.html" -size: (1080, 600) +go-to: "file://" + |DOC_PATH| + "/lib2/sub_mod/struct.Foo.html" +set-window-size: (1080, 600) // There should be two codeblocks: a rust one and a non-rust one. assert-count: (".docblock > .example-wrap", 2) assert: ".docblock > .example-wrap > .language-txt" diff --git a/tests/rustdoc-gui/code-color.goml b/tests/rustdoc-gui/code-color.goml index cb550a457..833fa05db 100644 --- a/tests/rustdoc-gui/code-color.goml +++ b/tests/rustdoc-gui/code-color.goml @@ -2,7 +2,7 @@ // check that the rule isn't applied on other "<code>" elements. // // While we're at it, we also check it for the other themes. -goto: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html" // If the text isn't displayed, the browser doesn't compute color style correctly... show-text: true @@ -11,7 +11,7 @@ define-function: ( (theme, doc_code_color, doc_inline_code_color), block { // Set the theme. - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} // We reload the page so the local storage settings are being used. reload: assert-css: (".docblock pre > code", {"color": |doc_code_color|}, ALL) diff --git a/tests/rustdoc-gui/code-sidebar-toggle.goml b/tests/rustdoc-gui/code-sidebar-toggle.goml index df665bd46..28c3712f3 100644 --- a/tests/rustdoc-gui/code-sidebar-toggle.goml +++ b/tests/rustdoc-gui/code-sidebar-toggle.goml @@ -1,7 +1,7 @@ // This test checks that the source code pages sidebar toggle is working as expected. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" click: ".srclink" wait-for: "#src-sidebar-toggle" click: "#src-sidebar-toggle" -fail: true +expect-failure: true assert-css: ("#source-sidebar", { "left": "-300px" }) diff --git a/tests/rustdoc-gui/code-tags.goml b/tests/rustdoc-gui/code-tags.goml index ca337cbc3..3405d3295 100644 --- a/tests/rustdoc-gui/code-tags.goml +++ b/tests/rustdoc-gui/code-tags.goml @@ -3,22 +3,22 @@ // We need to disable this check because `implementors/test_docs/trait.AnotherOne.js` // doesn't exist. fail-on-request-error: false -goto: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html" -size: (1080, 600) +go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html" +set-window-size: (1080, 600) // There should be four doc codeblocks. // Check that their content is inside <pre><code> assert-count: (".example-wrap pre > code", 4) // Check that function signature is inside <pre><code> assert: "pre.rust.item-decl > code" -goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" assert: "pre.rust.item-decl > code" -goto: "file://" + |DOC_PATH| + "/test_docs/enum.AnEnum.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/enum.AnEnum.html" assert: "pre.rust.item-decl > code" -goto: "file://" + |DOC_PATH| + "/test_docs/trait.AnotherOne.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/trait.AnotherOne.html" assert: "pre.rust.item-decl > code" -goto: "file://" + |DOC_PATH| + "/test_docs/type.SomeType.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/type.SomeType.html" assert: "pre.rust.item-decl > code" diff --git a/tests/rustdoc-gui/codeblock-sub.goml b/tests/rustdoc-gui/codeblock-sub.goml index cbd314d27..03575cc6a 100644 --- a/tests/rustdoc-gui/codeblock-sub.goml +++ b/tests/rustdoc-gui/codeblock-sub.goml @@ -1,5 +1,5 @@ // Test that code blocks nested within <sub> do not have a line height of 0. -goto: "file://" + |DOC_PATH| + "/test_docs/codeblock_sub/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/codeblock_sub/index.html" store-property: (codeblock_sub_1, "#codeblock-sub-1", "offsetHeight") assert-property-false: ("#codeblock-sub-3", { "offsetHeight": |codeblock_sub_1| }) diff --git a/tests/rustdoc-gui/codeblock-tooltip.goml b/tests/rustdoc-gui/codeblock-tooltip.goml index 36b67073a..2ed0579d3 100644 --- a/tests/rustdoc-gui/codeblock-tooltip.goml +++ b/tests/rustdoc-gui/codeblock-tooltip.goml @@ -1,5 +1,5 @@ // Checking the colors of the codeblocks tooltips. -goto: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html" show-text: true define-function: ( @@ -7,7 +7,7 @@ define-function: ( (theme, background, color, border), block { // Setting the theme. - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: // compile_fail block diff --git a/tests/rustdoc-gui/cursor.goml b/tests/rustdoc-gui/cursor.goml index 59b139797..f318b05ce 100644 --- a/tests/rustdoc-gui/cursor.goml +++ b/tests/rustdoc-gui/cursor.goml @@ -1,5 +1,5 @@ // This test ensures that several clickable items actually have the pointer cursor. -goto: "file://" + |DOC_PATH| + "/lib2/struct.Foo.html" +go-to: "file://" + |DOC_PATH| + "/lib2/struct.Foo.html" // the `[+]/[-]` button assert-css: ("#toggle-all-docs", {"cursor": "pointer"}) @@ -16,9 +16,9 @@ wait-for: "#search-tabs" assert-css: ("#search-tabs > button", {"cursor": "pointer"}) // mobile sidebar toggle button -size: (500, 700) +set-window-size: (500, 700) assert-css: (".sidebar-menu-toggle", {"cursor": "pointer"}) // the sidebar toggle button on the source code pages -goto: "file://" + |DOC_PATH| + "/src/lib2/lib.rs.html" +go-to: "file://" + |DOC_PATH| + "/src/lib2/lib.rs.html" assert-css: ("#src-sidebar-toggle > button", {"cursor": "pointer"}) diff --git a/tests/rustdoc-gui/default-settings.goml b/tests/rustdoc-gui/default-settings.goml index ab27b001e..3466f3693 100644 --- a/tests/rustdoc-gui/default-settings.goml +++ b/tests/rustdoc-gui/default-settings.goml @@ -2,7 +2,7 @@ // // The "settings" crate uses "ayu" as default setting, which is what we will // check. -goto: "file://" + |DOC_PATH| + "/settings/index.html" +go-to: "file://" + |DOC_PATH| + "/settings/index.html" // Wait a bit to be sure the default theme is applied. // If the theme isn't applied, the command will time out. wait-for-css: ("body", {"background-color": "rgb(15, 20, 25)"}) diff --git a/tests/rustdoc-gui/docblock-big-code-mobile.goml b/tests/rustdoc-gui/docblock-big-code-mobile.goml index 3ce921c2c..6fc683476 100644 --- a/tests/rustdoc-gui/docblock-big-code-mobile.goml +++ b/tests/rustdoc-gui/docblock-big-code-mobile.goml @@ -1,7 +1,7 @@ // If we have a long `<code>`, we need to ensure that it'll be fully displayed on mobile, meaning // that it'll be on two lines. emulate: "iPhone 8" // it has the following size: (375, 667) -goto: "file://" + |DOC_PATH| + "/test_docs/long_code_block/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/long_code_block/index.html" // We now check that the block is on two lines: show-text: true // We need to enable text draw to be able to have the "real" size // Little explanations for this test: if the text wasn't displayed on two lines, it would take @@ -9,5 +9,5 @@ show-text: true // We need to enable text draw to be able to have the "real" siz assert-property: (".docblock p > code", {"offsetHeight": "44"}) // Same check, but where the long code block is also a link -goto: "file://" + |DOC_PATH| + "/test_docs/long_code_block_link/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/long_code_block_link/index.html" assert-property: (".docblock p > a > code", {"offsetHeight": "44"}) diff --git a/tests/rustdoc-gui/docblock-code-block-line-number.goml b/tests/rustdoc-gui/docblock-code-block-line-number.goml index 69bcf5339..4c36394a3 100644 --- a/tests/rustdoc-gui/docblock-code-block-line-number.goml +++ b/tests/rustdoc-gui/docblock-code-block-line-number.goml @@ -1,5 +1,5 @@ // Checks that the setting "line numbers" is working as expected. -goto: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html" // Otherwise, we can't check text color show-text: true @@ -13,7 +13,7 @@ define-function: ( (theme, color), block { // We now set the setting to show the line numbers on code examples. - local-storage: { + set-local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false", "rustdoc-line-numbers": "true" diff --git a/tests/rustdoc-gui/docblock-details.goml b/tests/rustdoc-gui/docblock-details.goml index 9ae571efb..58ff17619 100644 --- a/tests/rustdoc-gui/docblock-details.goml +++ b/tests/rustdoc-gui/docblock-details.goml @@ -1,7 +1,7 @@ // This ensures that the `<details>`/`<summary>` elements are displayed as expected. -goto: "file://" + |DOC_PATH| + "/test_docs/details/struct.Details.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/details/struct.Details.html" show-text: true -local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false"} +set-local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false"} reload: // We first check that the headers in the `.top-doc` doc block still have their diff --git a/tests/rustdoc-gui/docblock-table-overflow.goml b/tests/rustdoc-gui/docblock-table-overflow.goml index d8670089a..1ca919d1e 100644 --- a/tests/rustdoc-gui/docblock-table-overflow.goml +++ b/tests/rustdoc-gui/docblock-table-overflow.goml @@ -1,7 +1,7 @@ // This test ensures that the type declaration content overflow is handled inside the <pre> directly. -goto: "file://" + |DOC_PATH| + "/lib2/long_table/struct.Foo.html" +go-to: "file://" + |DOC_PATH| + "/lib2/long_table/struct.Foo.html" // We set a fixed size so there is no chance of "random" resize. -size: (1100, 800) +set-window-size: (1100, 800) // Logically, the ".docblock" and the "<p>" should have the same scroll width. compare-elements-property: (".top-doc .docblock", ".top-doc .docblock > p", ["scrollWidth"]) assert-property: (".top-doc .docblock", {"scrollWidth": "816"}) diff --git a/tests/rustdoc-gui/docblock-table.goml b/tests/rustdoc-gui/docblock-table.goml index 3dcb8abd4..011451ef4 100644 --- a/tests/rustdoc-gui/docblock-table.goml +++ b/tests/rustdoc-gui/docblock-table.goml @@ -1,5 +1,5 @@ // This test checks the appearance of the tables in the doc comments. -goto: "file://" + |DOC_PATH| + "/test_docs/doc_block_table/struct.DocBlockTable.html#method.func" +go-to: "file://" + |DOC_PATH| + "/test_docs/doc_block_table/struct.DocBlockTable.html#method.func" compare-elements-css: (".impl-items .docblock table th", ".top-doc .docblock table th", ["border"]) compare-elements-css: (".impl-items .docblock table td", ".top-doc .docblock table td", ["border"]) @@ -8,7 +8,7 @@ define-function: ( "check-colors", (theme, border_color, zebra_stripe_color), block { - local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": |theme|} + set-local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": |theme|} reload: assert-css: (".top-doc .docblock table tbody tr:nth-child(1)", { "background-color": "rgba(0, 0, 0, 0)", diff --git a/tests/rustdoc-gui/duplicate-macro-reexport.goml b/tests/rustdoc-gui/duplicate-macro-reexport.goml index 496203c12..7d01c88f3 100644 --- a/tests/rustdoc-gui/duplicate-macro-reexport.goml +++ b/tests/rustdoc-gui/duplicate-macro-reexport.goml @@ -1,5 +1,5 @@ // This test ensures that there is no macro duplicates in the sidebar. -goto: "file://" + |DOC_PATH| + "/test_docs/macro.a.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/macro.a.html" // Waiting for the elements in the sidebar to be rendered. wait-for: ".sidebar-elems .macro" // Check there is only one macro named "a" listed in the sidebar. diff --git a/tests/rustdoc-gui/enum-variants.goml b/tests/rustdoc-gui/enum-variants.goml index 8dfc49285..a1f60986a 100644 --- a/tests/rustdoc-gui/enum-variants.goml +++ b/tests/rustdoc-gui/enum-variants.goml @@ -1,5 +1,5 @@ // Verifies that there is non-zero margin on variants and their docblocks. -goto: "file://" + |DOC_PATH| + "/test_docs/enum.WhoLetTheDogOut.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/enum.WhoLetTheDogOut.html" assert-css: (".variants > .variant", {"margin": "0px 0px 12px"}) assert-css: (".variants > .docblock", {"margin": "0px 0px 32px 24px"}) diff --git a/tests/rustdoc-gui/escape-key.goml b/tests/rustdoc-gui/escape-key.goml index 5d80d2496..3ea20fd11 100644 --- a/tests/rustdoc-gui/escape-key.goml +++ b/tests/rustdoc-gui/escape-key.goml @@ -1,6 +1,6 @@ // This test ensures that the "Escape" shortcut is handled correctly based on the // current content displayed. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" // First, we check that the search results are hidden when the Escape key is pressed. write: (".search-input", "test") // To be SURE that the search will be run. diff --git a/tests/rustdoc-gui/extend-css.goml b/tests/rustdoc-gui/extend-css.goml new file mode 100644 index 000000000..fb34469df --- /dev/null +++ b/tests/rustdoc-gui/extend-css.goml @@ -0,0 +1,5 @@ +// Test to ensure that the `--extend-css` option is working as expected. +go-to: "file://" + |DOC_PATH| + "/extend_css/index.html" +show-text: true +// The text from the `.extend` element should be red. +assert-css: (".extend", {"color": "rgb(255, 0, 0)"}) diff --git a/tests/rustdoc-gui/font-weight.goml b/tests/rustdoc-gui/font-weight.goml index aad334d2b..6fad128da 100644 --- a/tests/rustdoc-gui/font-weight.goml +++ b/tests/rustdoc-gui/font-weight.goml @@ -1,5 +1,5 @@ // This test checks that the font weight is correctly applied. -goto: "file://" + |DOC_PATH| + "/lib2/struct.Foo.html" +go-to: "file://" + |DOC_PATH| + "/lib2/struct.Foo.html" assert-css: ("//*[@class='rust item-decl']//a[text()='Alias']", {"font-weight": "400"}) assert-css: ( "//*[@class='structfield small-section-header']//a[text()='Alias']", @@ -9,13 +9,13 @@ assert-css: ("#method\.a_method > .code-header", {"font-weight": "600"}) assert-css: ("#associatedtype\.X > .code-header", {"font-weight": "600"}) assert-css: ("#associatedconstant\.Y > .code-header", {"font-weight": "600"}) -goto: "file://" + |DOC_PATH| + "/test_docs/type.SomeType.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/type.SomeType.html" assert-css: (".top-doc .docblock p", {"font-weight": "400"}, ALL) -goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" assert-css: (".impl-items .method > .code-header", {"font-weight": "600"}, ALL) -goto: "file://" + |DOC_PATH| + "/lib2/trait.Trait.html" +go-to: "file://" + |DOC_PATH| + "/lib2/trait.Trait.html" // This is a complex selector, so here's how it works: // 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 000000000..80e979177 --- /dev/null +++ b/tests/rustdoc-gui/go-to-collapsed-elem.goml @@ -0,0 +1,40 @@ +// This test ensures that when clicking on a link which leads to an item inside a collapsed element, +// the collapsed element will be expanded. +go-to: "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. +set-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"}) + +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. + go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" + // Then we collapse the section again... + set-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. +set-window-size: (600, 600) +go-to: "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. +set-property: ("#implementations-list .implementors-toggle", {"open": "false"}) +// 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", {}) diff --git a/tests/rustdoc-gui/hash-item-expansion.goml b/tests/rustdoc-gui/hash-item-expansion.goml index 3cf94f624..a7a5c3cb4 100644 --- a/tests/rustdoc-gui/hash-item-expansion.goml +++ b/tests/rustdoc-gui/hash-item-expansion.goml @@ -1,5 +1,5 @@ // This test ensures that the element corresponding to the hash is displayed. -goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#method.borrow" +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#method.borrow" // In the blanket implementations list, "Borrow" is the second one, hence the ":nth(2)". assert-attribute: ("#blanket-implementations-list > details:nth-child(2)", {"open": ""}) // We first check that the impl block is open by default. diff --git a/tests/rustdoc-gui/headers-color.goml b/tests/rustdoc-gui/headers-color.goml index 92cf050a5..7d83833a8 100644 --- a/tests/rustdoc-gui/headers-color.goml +++ b/tests/rustdoc-gui/headers-color.goml @@ -4,10 +4,10 @@ define-function: ( "check-colors", (theme, color, code_header_color, focus_background_color, headings_color), block { - goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" + go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" // This is needed so that the text color is computed. show-text: true - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: assert-css: ( ".impl", @@ -19,20 +19,20 @@ define-function: ( {"color": |code_header_color|, "background-color": "rgba(0, 0, 0, 0)"}, ALL, ) - goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#impl-Foo" + go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#impl-Foo" assert-css: ( "#impl-Foo", {"color": |color|, "background-color": |focus_background_color|}, ) - goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#method.must_use" + go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#method.must_use" assert-css: ( "#method\.must_use", {"color": |color|, "background-color": |focus_background_color|}, ALL, ) - goto: "file://" + |DOC_PATH| + "/test_docs/index.html" + go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" assert-css: (".small-section-header a", {"color": |color|}, ALL) - goto: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html" + go-to: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html" // We select headings (h2, h3, h...). assert-css: (".docblock > :not(p) > a", {"color": |headings_color|}, ALL) }, diff --git a/tests/rustdoc-gui/headings.goml b/tests/rustdoc-gui/headings.goml index e4ba5f124..089e2203a 100644 --- a/tests/rustdoc-gui/headings.goml +++ b/tests/rustdoc-gui/headings.goml @@ -11,7 +11,7 @@ // 18px 1.125em // 16px 1rem // 14px 0.875rem -goto: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html" assert-css: (".main-heading h1", {"font-size": "24px"}) @@ -50,7 +50,7 @@ assert-css: ("h6#sub-heading-for-struct-impl-item-doc", {"font-size": "14px"}) assert-css: ("h6#sub-heading-for-struct-impl-item-doc", {"border-bottom-width": "0px"}) assert-css: ("h6#sub-sub-heading-for-struct-impl-item-doc", {"font-size": "14px"}) -goto: "file://" + |DOC_PATH| + "/test_docs/enum.HeavilyDocumentedEnum.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/enum.HeavilyDocumentedEnum.html" assert-css: (".main-heading h1", {"font-size": "24px"}) @@ -109,7 +109,7 @@ assert-css: ("h6#sub-sub-heading-for-enum-impl-item-doc", {"border-bottom-width" assert-text: ("//ul[@class='block mod']/preceding-sibling::h3", "Modules") assert-css: ("//ul[@class='block mod']/preceding-sibling::h3", {"border-bottom-width": "0px"}, ALL) -goto: "file://" + |DOC_PATH| + "/test_docs/union.HeavilyDocumentedUnion.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/union.HeavilyDocumentedUnion.html" assert-css: (".main-heading h1", {"font-size": "24px"}) @@ -141,7 +141,7 @@ assert-css: ("h5#title-for-union-impl-item-doc", {"border-bottom-width": "0px"}) assert-css: ("h6#sub-heading-for-union-impl-item-doc", {"font-size": "14px"}) assert-css: ("h6#sub-heading-for-union-impl-item-doc", {"border-bottom-width": "0px"}) -goto: "file://" + |DOC_PATH| + "/test_docs/macro.heavily_documented_macro.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/macro.heavily_documented_macro.html" assert-css: (".main-heading h1", {"font-size": "24px"}) @@ -152,13 +152,13 @@ assert-css: ("h3#top-doc-prose-sub-heading", {"border-bottom-width": "1px"}) // Needed to check colors show-text: true -goto: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html" define-function: ( "check-colors", (theme, heading_color, small_heading_color, heading_border_color), block { - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: assert-css: ( ".top-doc .docblock h2", @@ -222,13 +222,13 @@ define-function: ( "check-since-color", (theme), block { - local-storage: {"rustdoc-theme": |theme|} + set-local-storage: {"rustdoc-theme": |theme|} reload: assert-css: (".since", {"color": "rgb(128, 128, 128)"}, ALL) }, ) -goto: "file://" + |DOC_PATH| + "/staged_api/struct.Foo.html" +go-to: "file://" + |DOC_PATH| + "/staged_api/struct.Foo.html" call-function: ("check-since-color", ("ayu")) call-function: ("check-since-color", ("dark")) call-function: ("check-since-color", ("light")) diff --git a/tests/rustdoc-gui/help-page.goml b/tests/rustdoc-gui/help-page.goml index 6e2321a69..1a1c1b28f 100644 --- a/tests/rustdoc-gui/help-page.goml +++ b/tests/rustdoc-gui/help-page.goml @@ -1,6 +1,6 @@ // This test ensures that opening the help page in its own tab works. -goto: "file://" + |DOC_PATH| + "/help.html" -size: (1000, 1000) // Try desktop size first. +go-to: "file://" + |DOC_PATH| + "/help.html" +set-window-size: (1000, 1000) // Try desktop size first. wait-for: "#help" assert-css: ("#help", {"display": "block"}) assert-css: ("#help dd", {"font-size": "16px"}) @@ -8,7 +8,7 @@ click: "#help-button > a" assert-css: ("#help", {"display": "block"}) compare-elements-property: (".sub", "#help", ["offsetWidth"]) compare-elements-position: (".sub", "#help", ("x")) -size: (500, 1000) // Try mobile next. +set-window-size: (500, 1000) // Try mobile next. assert-css: ("#help", {"display": "block"}) compare-elements-property: (".sub", "#help", ["offsetWidth"]) compare-elements-position: (".sub", "#help", ("x")) @@ -20,7 +20,7 @@ define-function: ( (theme, color, background, box_shadow), block { // Setting the theme. - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} // We reload the page so the local storage settings are being used. reload: assert-css: ("#help kbd", { @@ -51,8 +51,8 @@ call-function: ("check-colors", { }) // This test ensures that opening the help popover without switching pages works. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" -size: (1000, 1000) // Only supported on desktop. +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" +set-window-size: (1000, 1000) // Only supported on desktop. assert-false: "#help" click: "#help-button > a" assert-css: ("#help", {"display": "block"}) @@ -63,8 +63,8 @@ compare-elements-property-false: (".sub", "#help", ["offsetWidth"]) compare-elements-position-false: (".sub", "#help", ("x")) // This test ensures that the "the rustdoc book" anchor link within the help popover works. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" -size: (1000, 1000) // Popover only appears when the screen width is >700px. +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" +set-window-size: (1000, 1000) // Popover only appears when the screen width is >700px. assert-false: "#help" click: "#help-button > a" click: ".popover a[href='https://doc.rust-lang.org/rustdoc/']" diff --git a/tests/rustdoc-gui/highlight-colors.goml b/tests/rustdoc-gui/highlight-colors.goml index b182150a5..4f5e1c110 100644 --- a/tests/rustdoc-gui/highlight-colors.goml +++ b/tests/rustdoc-gui/highlight-colors.goml @@ -1,5 +1,5 @@ // This test checks the highlight colors in the source code pages. -goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" +go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" show-text: true define-function: ( @@ -22,7 +22,7 @@ define-function: ( doc_comment, ), block { - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: assert-css: ("pre.rust .kw", {"color": |kw|}, ALL) assert-css: ("pre.rust .kw-2", {"color": |kw2|}, ALL) diff --git a/tests/rustdoc-gui/huge-collection-of-constants.goml b/tests/rustdoc-gui/huge-collection-of-constants.goml index 636382a91..387aca6f6 100644 --- a/tests/rustdoc-gui/huge-collection-of-constants.goml +++ b/tests/rustdoc-gui/huge-collection-of-constants.goml @@ -1,6 +1,6 @@ // Make sure that the last two entries are more than 12 pixels apart and not stacked on each other. -goto: "file://" + |DOC_PATH| + "/test_docs/huge_amount_of_consts/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/huge_amount_of_consts/index.html" compare-elements-position-near-false: ( "//ul[@class='item-table']/li[last()-1]", diff --git a/tests/rustdoc-gui/huge-logo.goml b/tests/rustdoc-gui/huge-logo.goml index 01f06771c..6d3eb6606 100644 --- a/tests/rustdoc-gui/huge-logo.goml +++ b/tests/rustdoc-gui/huge-logo.goml @@ -1,21 +1,23 @@ // huge_logo crate has a custom 712x860 logo // test to ensure the maximum size in the layout works correctly -goto: "file://" + |DOC_PATH| + "/huge_logo/index.html" +go-to: "file://" + |DOC_PATH| + "/huge_logo/index.html" -size: (1280, 1024) +set-window-size: (1280, 1024) // offsetWidth = width of sidebar assert-property: (".sidebar .logo-container", {"offsetWidth": "200", "offsetHeight": 100}) assert-property: (".sidebar .logo-container img", {"offsetWidth": "100", "offsetHeight": 100}) -size: (400, 600) +set-window-size: (400, 600) // offset = size + margin assert-property: (".mobile-topbar .logo-container", {"offsetWidth": "55", "offsetHeight": 45}) assert-property: (".mobile-topbar .logo-container img", {"offsetWidth": "35", "offsetHeight": 35}) -goto: "file://" + |DOC_PATH| + "/src/huge_logo/lib.rs.html" +go-to: "file://" + |DOC_PATH| + "/src/huge_logo/lib.rs.html" -size: (1280, 1024) +set-window-size: (1280, 1024) assert-property: (".sub-logo-container", {"offsetWidth": "60", "offsetHeight": 60}) -size: (400, 600) -assert-property: (".sub-logo-container", {"offsetWidth": "35", "offsetHeight": 35}) +set-window-size: (400, 600) +// 43 because 35px + 8px of margin +assert-css: (".sub-logo-container > img", {"margin-bottom": "8px"}) +assert-property: (".sub-logo-container", {"offsetWidth": "35", "offsetHeight": 43}) diff --git a/tests/rustdoc-gui/impl-default-expansion.goml b/tests/rustdoc-gui/impl-default-expansion.goml index c3f9240cc..45bd7beb6 100644 --- a/tests/rustdoc-gui/impl-default-expansion.goml +++ b/tests/rustdoc-gui/impl-default-expansion.goml @@ -1,3 +1,3 @@ // This test ensures that the impl blocks are open by default. -goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" assert-attribute: ("#implementations-list details.implementors-toggle", {"open": ""}) diff --git a/tests/rustdoc-gui/impl-doc.goml b/tests/rustdoc-gui/impl-doc.goml index 6caffb9c3..4ec46de40 100644 --- a/tests/rustdoc-gui/impl-doc.goml +++ b/tests/rustdoc-gui/impl-doc.goml @@ -1,5 +1,5 @@ // A docblock on an impl must have a margin to separate it from the contents. -goto: "file://" + |DOC_PATH| + "/test_docs/struct.TypeWithImplDoc.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.TypeWithImplDoc.html" // The text is about 24px tall, so if there's a margin, then their position will be >24px apart compare-elements-position-near-false: ( diff --git a/tests/rustdoc-gui/implementors.goml b/tests/rustdoc-gui/implementors.goml index 997c0ed8f..b39b95c1a 100644 --- a/tests/rustdoc-gui/implementors.goml +++ b/tests/rustdoc-gui/implementors.goml @@ -1,6 +1,6 @@ // The goal of this test is to check that the external trait implementors, generated with JS, // have the same display than the "local" ones. -goto: "file://" + |DOC_PATH| + "/implementors/trait.Whatever.html" +go-to: "file://" + |DOC_PATH| + "/implementors/trait.Whatever.html" assert: "#implementors-list" // There are supposed to be two implementors listed. assert-count: ("#implementors-list .impl", 2) @@ -15,7 +15,7 @@ assert-attribute: ("#implementors-list .impl:nth-child(2)", {"id": "impl-Whateve assert-attribute: ("#implementors-list .impl:nth-child(2) > a.anchor", {"href": "#impl-Whatever-1"}) assert: "#implementors-list .impl:nth-child(2) > .code-header" -goto: "file://" + |DOC_PATH| + "/test_docs/struct.HasEmptyTraits.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.HasEmptyTraits.html" compare-elements-position-near-false: ( "#impl-EmptyTrait1-for-HasEmptyTraits", "#impl-EmptyTrait2-for-HasEmptyTraits", @@ -29,13 +29,13 @@ compare-elements-position-near: ( // Now check that re-exports work correctly. // There should be exactly one impl shown on both of these pages. -goto: "file://" + |DOC_PATH| + "/lib2/trait.TraitToReexport.html" +go-to: "file://" + |DOC_PATH| + "/lib2/trait.TraitToReexport.html" assert-count: ("#implementors-list .impl", 1) -goto: "file://" + |DOC_PATH| + "/implementors/trait.TraitToReexport.html" +go-to: "file://" + |DOC_PATH| + "/implementors/trait.TraitToReexport.html" assert-count: ("#implementors-list .impl", 1) // Now check that the link is properly rewritten for a crate called `http`. // An older version of rustdoc had a buggy check for absolute links. -goto: "file://" + |DOC_PATH| + "/http/trait.HttpTrait.html" +go-to: "file://" + |DOC_PATH| + "/http/trait.HttpTrait.html" assert-count: ("#implementors-list .impl", 1) assert-attribute: ("#implementors-list .impl a.trait", {"href": "../http/trait.HttpTrait.html"}) diff --git a/tests/rustdoc-gui/item-decl-colors.goml b/tests/rustdoc-gui/item-decl-colors.goml index c58e3eb7c..5732dd8ee 100644 --- a/tests/rustdoc-gui/item-decl-colors.goml +++ b/tests/rustdoc-gui/item-decl-colors.goml @@ -18,9 +18,9 @@ define-function: ( assoc_type_color, ), block { - goto: "file://" + |DOC_PATH| + "/test_docs/struct.WithGenerics.html" + go-to: "file://" + |DOC_PATH| + "/test_docs/struct.WithGenerics.html" show-text: true - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: assert-css: (".item-decl .code-attribute", {"color": |attr_color|}, ALL) assert-css: (".item-decl .trait", {"color": |trait_color|}, ALL) @@ -29,7 +29,7 @@ define-function: ( assert-css: (".item-decl .enum", {"color": |enum_color|}, ALL) assert-css: (".item-decl .primitive", {"color": |primitive_color|}, ALL) - goto: "file://" + |DOC_PATH| + "/test_docs/trait.TraitWithoutGenerics.html" + go-to: "file://" + |DOC_PATH| + "/test_docs/trait.TraitWithoutGenerics.html" assert-css: (".item-decl .constant", {"color": |constant_color|}, ALL) assert-css: (".item-decl .fn", {"color": |fn_color|}, ALL) assert-css: (".item-decl .associatedtype", {"color": |assoc_type_color|}, ALL) diff --git a/tests/rustdoc-gui/item-info-alignment.goml b/tests/rustdoc-gui/item-info-alignment.goml index 94b52f005..6fc365d1f 100644 --- a/tests/rustdoc-gui/item-info-alignment.goml +++ b/tests/rustdoc-gui/item-info-alignment.goml @@ -1,10 +1,10 @@ // This test ensures that the "item-info" looks about the same // whether or not it's inside a toggle. -goto: "file://" + |DOC_PATH| + "/lib2/struct.ItemInfoAlignmentTest.html" +go-to: "file://" + |DOC_PATH| + "/lib2/struct.ItemInfoAlignmentTest.html" // First, we try it in "desktop" mode. -size: (1200, 870) +set-window-size: (1200, 870) compare-elements-position: (".impl-items > .item-info", "summary > .item-info", ("x")) // Next, we try it in "mobile" mode (max-width: 700px). -size: (650, 650) +set-window-size: (650, 650) compare-elements-position: (".impl-items > .item-info", "summary > .item-info", ("x")) diff --git a/tests/rustdoc-gui/item-info-overflow.goml b/tests/rustdoc-gui/item-info-overflow.goml index 8ea14621c..23c53c037 100644 --- a/tests/rustdoc-gui/item-info-overflow.goml +++ b/tests/rustdoc-gui/item-info-overflow.goml @@ -1,7 +1,7 @@ // This test ensures that the "item-info" elements don't overflow. -goto: "file://" + |DOC_PATH| + "/lib2/struct.LongItemInfo.html" +go-to: "file://" + |DOC_PATH| + "/lib2/struct.LongItemInfo.html" // We set a fixed size so there is no chance of "random" resize. -size: (1200, 870) +set-window-size: (1200, 870) // Logically, the "item-decl" and the "item-info" should have the same scroll width. compare-elements-property: (".item-decl", ".item-info", ["scrollWidth"]) assert-property: (".item-info", {"scrollWidth": "940"}) @@ -13,7 +13,7 @@ assert-text: ( ) // Checking the "item-info" on an impl block as well: -goto: "file://" + |DOC_PATH| + "/lib2/struct.LongItemInfo2.html" +go-to: "file://" + |DOC_PATH| + "/lib2/struct.LongItemInfo2.html" compare-elements-property: ( "#impl-SimpleTrait-for-LongItemInfo2 .item-info", "#impl-SimpleTrait-for-LongItemInfo2 + .docblock", diff --git a/tests/rustdoc-gui/item-info.goml b/tests/rustdoc-gui/item-info.goml index 6780dfca6..60fd7c4e1 100644 --- a/tests/rustdoc-gui/item-info.goml +++ b/tests/rustdoc-gui/item-info.goml @@ -1,15 +1,15 @@ // This test ensures a few things for item info elements. -goto: "file://" + |DOC_PATH| + "/lib2/struct.Foo.html" +go-to: "file://" + |DOC_PATH| + "/lib2/struct.Foo.html" // Ensuring that the item information don't take 100% of the width if unnecessary. // We set a fixed size so there is no chance of "random" resize. -size: (1100, 800) +set-window-size: (1100, 800) // We check that ".item-info" is bigger than its content. assert-css: (".item-info", {"width": "840px"}) assert-css: (".item-info .stab", {"width": "289px"}) assert-position: (".item-info .stab", {"x": 245}) // Now we ensure that they're not rendered on the same line. -goto: "file://" + |DOC_PATH| + "/lib2/trait.Trait.html" +go-to: "file://" + |DOC_PATH| + "/lib2/trait.Trait.html" // We first ensure that there are two item info on the trait. assert-count: ("#main-content > .item-info .stab", 2) // They should not have the same `y` position! diff --git a/tests/rustdoc-gui/item-summary-table.goml b/tests/rustdoc-gui/item-summary-table.goml index 7a219bd54..893060303 100644 --- a/tests/rustdoc-gui/item-summary-table.goml +++ b/tests/rustdoc-gui/item-summary-table.goml @@ -1,5 +1,5 @@ // This test ensures that <table> elements aren't display in items summary. -goto: "file://" + |DOC_PATH| + "/lib2/summary_table/index.html" +go-to: "file://" + |DOC_PATH| + "/lib2/summary_table/index.html" // We check that we picked the right item first. assert-text: (".item-table .item-name", "Foo") // Then we check that its summary is empty. diff --git a/tests/rustdoc-gui/javascript-disabled.goml b/tests/rustdoc-gui/javascript-disabled.goml index edf179d0d..a0872d553 100644 --- a/tests/rustdoc-gui/javascript-disabled.goml +++ b/tests/rustdoc-gui/javascript-disabled.goml @@ -2,5 +2,5 @@ // can't be used without JS. javascript: false -goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" assert-css: (".sub", {"display": "none"}) diff --git a/tests/rustdoc-gui/jump-to-def-background.goml b/tests/rustdoc-gui/jump-to-def-background.goml index 8ee3ccf4a..3a7d48284 100644 --- a/tests/rustdoc-gui/jump-to-def-background.goml +++ b/tests/rustdoc-gui/jump-to-def-background.goml @@ -1,12 +1,12 @@ // We check the background color on the jump to definition links in the source code page. -goto: "file://" + |DOC_PATH| + "/src/link_to_definition/lib.rs.html" +go-to: "file://" + |DOC_PATH| + "/src/link_to_definition/lib.rs.html" define-function: ( "check-background-color", (theme, background_color), block { // Set the theme. - local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false" } + set-local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false" } // We reload the page so the local storage settings are being used. reload: assert-css: ( diff --git a/tests/rustdoc-gui/label-next-to-symbol.goml b/tests/rustdoc-gui/label-next-to-symbol.goml index 412e475dc..6c6380256 100644 --- a/tests/rustdoc-gui/label-next-to-symbol.goml +++ b/tests/rustdoc-gui/label-next-to-symbol.goml @@ -1,9 +1,9 @@ // These tests verify that labels like "UNIX" and "Deprecated" stay on the same line as their symbol. // It also verifies the staggered layout on mobile. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" // Desktop view -size: (1080, 600) +set-window-size: (1080, 600) assert: (".stab.deprecated") assert: (".stab.portability") @@ -39,7 +39,7 @@ compare-elements-position: ( // Mobile view -size: (600, 600) +set-window-size: (600, 600) // staggered layout with 2em spacing assert-css: (".desc.docblock-short", { "padding-left": "32px" }) compare-elements-position-near: ( diff --git a/tests/rustdoc-gui/links-color.goml b/tests/rustdoc-gui/links-color.goml index 14f7d9935..2ee4bce10 100644 --- a/tests/rustdoc-gui/links-color.goml +++ b/tests/rustdoc-gui/links-color.goml @@ -1,5 +1,5 @@ // This test checks links colors. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" // This is needed so that the text color is computed. show-text: true @@ -9,7 +9,7 @@ define-function: ( (theme, mod, macro, struct, enum, trait, fn, type, union, keyword, sidebar, sidebar_current, sidebar_current_background), block { - local-storage: { + set-local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false", } diff --git a/tests/rustdoc-gui/list_code_block.goml b/tests/rustdoc-gui/list_code_block.goml index 4c477d70c..25ddea319 100644 --- a/tests/rustdoc-gui/list_code_block.goml +++ b/tests/rustdoc-gui/list_code_block.goml @@ -1,4 +1,4 @@ // This test checks that code blocks in list are supported. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" -goto: "./fn.check_list_code_block.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "./fn.check_list_code_block.html" assert: ("pre.rust.item-decl") diff --git a/tests/rustdoc-gui/method-margins.goml b/tests/rustdoc-gui/method-margins.goml index 720268a9e..ac3caeb23 100644 --- a/tests/rustdoc-gui/method-margins.goml +++ b/tests/rustdoc-gui/method-margins.goml @@ -1,5 +1,5 @@ // This test ensures that the margins on methods are coherent inside an impl block. -goto: "file://" + |DOC_PATH| + "/test_docs/trait_members/struct.HasTrait.html#impl-TraitMembers-for-HasTrait" +go-to: "file://" + |DOC_PATH| + "/test_docs/trait_members/struct.HasTrait.html#impl-TraitMembers-for-HasTrait" assert-count: ("#trait-implementations-list > .toggle", 1) diff --git a/tests/rustdoc-gui/mobile.goml b/tests/rustdoc-gui/mobile.goml index 8c8516ebf..e576385cd 100644 --- a/tests/rustdoc-gui/mobile.goml +++ b/tests/rustdoc-gui/mobile.goml @@ -1,8 +1,8 @@ // Test various properties of the mobile UI -goto: "file://" + |DOC_PATH| + "/staged_api/struct.Foo.html" -size: (400, 600) +go-to: "file://" + |DOC_PATH| + "/staged_api/struct.Foo.html" +set-window-size: (400, 600) -font-size: 18 +set-font-size: 18 wait-for: 100 // wait a bit for the resize and the font-size change to be fully taken into account. // The out-of-band info (source, stable version, collapse) should be below the @@ -18,14 +18,14 @@ assert-property: (".mobile-topbar h2", {"offsetHeight": 33}) // is therefore not part of the DOM. assert-css: (".content .out-of-band .since::before", { "content": "\"Since \"" }) -size: (1000, 1000) +set-window-size: (1000, 1000) wait-for: 100 // wait a bit for the resize to be fully taken into account. assert-css-false: (".content .out-of-band .since::before", { "content": "\"Since \"" }) // On the settings page, the theme buttons should not line-wrap. Instead, they should // all be placed as a group on a line below the setting name "Theme." -goto: "file://" + |DOC_PATH| + "/settings.html" -size: (400, 600) +go-to: "file://" + |DOC_PATH| + "/settings.html" +set-window-size: (400, 600) // Ignored for now https://github.com/rust-lang/rust/issues/93784. // compare-elements-position-near-false: ( // "#preferred-light-theme .setting-radio-name", diff --git a/tests/rustdoc-gui/module-items-font.goml b/tests/rustdoc-gui/module-items-font.goml index 23823f8b6..54c8131c3 100644 --- a/tests/rustdoc-gui/module-items-font.goml +++ b/tests/rustdoc-gui/module-items-font.goml @@ -1,5 +1,5 @@ // This test checks that the correct font is used on module items (in index.html pages). -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" assert-css: ( ".item-table .item-name > a", {"font-family": '"Fira Sans", Arial, NanumBarunGothic, sans-serif'}, diff --git a/tests/rustdoc-gui/no-docblock.goml b/tests/rustdoc-gui/no-docblock.goml index 17a955064..1b4638ef0 100644 --- a/tests/rustdoc-gui/no-docblock.goml +++ b/tests/rustdoc-gui/no-docblock.goml @@ -4,10 +4,10 @@ // doesn't exist. fail-on-request-error: false -goto: "file://" + |DOC_PATH| + "/test_docs/trait.TraitWithNoDocblocks.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/trait.TraitWithNoDocblocks.html" // Check that the two methods are more than 24px apart. compare-elements-position-near-false: ("//*[@id='tymethod.first_fn']", "//*[@id='tymethod.second_fn']", {"y": 24}) -goto: "file://" + |DOC_PATH| + "/test_docs/struct.TypeWithNoDocblocks.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.TypeWithNoDocblocks.html" // Check that the two methods are more than 24px apart. compare-elements-position-near-false: ("//*[@id='method.first_fn']", "//*[@id='method.second_fn']", {"y": 24}) diff --git a/tests/rustdoc-gui/notable-trait.goml b/tests/rustdoc-gui/notable-trait.goml index 207289151..f65da5774 100644 --- a/tests/rustdoc-gui/notable-trait.goml +++ b/tests/rustdoc-gui/notable-trait.goml @@ -1,8 +1,8 @@ // This test checks the position of the `i` for the notable traits. -goto: "file://" + |DOC_PATH| + "/test_docs/struct.NotableStructWithLongName.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.NotableStructWithLongName.html" show-text: true // We start with a wide screen. -size: (1100, 600) +set-window-size: (1100, 600) // Checking they have the same y position. compare-elements-position: ( "//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']", @@ -44,7 +44,7 @@ move-cursor-to: "//h1" assert-count: ("//*[@class='tooltip popover']", 0) // Now only the `i` should be on the next line. -size: (1055, 600) +set-window-size: (1055, 600) compare-elements-position-false: ( "//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']", "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']", @@ -52,7 +52,7 @@ compare-elements-position-false: ( ) // Now both the `i` and the struct name should be on the next line. -size: (980, 600) +set-window-size: (980, 600) // Checking they have the same y position. compare-elements-position: ( "//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']", @@ -76,7 +76,7 @@ assert-position: ( ) // Checking on mobile now. -size: (650, 600) +set-window-size: (650, 600) // Checking they have the same y position. compare-elements-position: ( "//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']", @@ -124,12 +124,12 @@ define-function: ( "check-colors", (theme, header_color, content_color, type_color, trait_color), block { - goto: "file://" + |DOC_PATH| + "/test_docs/struct.NotableStructWithLongName.html" + go-to: "file://" + |DOC_PATH| + "/test_docs/struct.NotableStructWithLongName.html" // This is needed to ensure that the text color is computed. show-text: true // Setting the theme. - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} // We reload the page so the local storage settings are being used. reload: @@ -253,7 +253,7 @@ press-key: "Escape" assert-window-property-false: {"scrollY": |scroll|} // Opening the mobile sidebar should close the popover. -size: (650, 600) +set-window-size: (650, 600) click: "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']" assert-count: ("//*[@class='tooltip popover']", 1) click: ".sidebar-menu-toggle" @@ -266,7 +266,7 @@ assert-count: ("//*[@class='tooltip popover']", 1) assert-false: "//*[@class='sidebar shown']" // Also check the focus handling for the help button. -size: (1100, 600) +set-window-size: (1100, 600) reload: assert-count: ("//*[@class='tooltip popover']", 0) click: "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']" diff --git a/tests/rustdoc-gui/overflow-tooltip-information.goml b/tests/rustdoc-gui/overflow-tooltip-information.goml index 09ad6cdd7..ab7ffc24c 100644 --- a/tests/rustdoc-gui/overflow-tooltip-information.goml +++ b/tests/rustdoc-gui/overflow-tooltip-information.goml @@ -1,7 +1,7 @@ // The goal of this test is to ensure that the tooltip `.information` class doesn't // have overflow and max-width CSS rules set because they create a bug in firefox on // mac. For more information: https://github.com/rust-lang/rust/issues/89185 -goto: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html" assert-css: (".docblock > .example-wrap .tooltip", { "overflow-x": "visible", "max-width": "none" diff --git a/tests/rustdoc-gui/pocket-menu.goml b/tests/rustdoc-gui/pocket-menu.goml index c3649dc7b..4bdf31ecb 100644 --- a/tests/rustdoc-gui/pocket-menu.goml +++ b/tests/rustdoc-gui/pocket-menu.goml @@ -1,5 +1,5 @@ // This test ensures that the "pocket menus" are working as expected. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" // First we check that the help menu doesn't exist yet. assert-false: "#help-button .popover" // Then we display the help menu. @@ -32,7 +32,7 @@ assert-css: ("#settings-menu .popover", {"display": "none"}) // We check the borders color now: // Ayu theme -local-storage: { +set-local-storage: { "rustdoc-theme": "ayu", "rustdoc-use-system-theme": "false", } @@ -47,7 +47,7 @@ compare-elements-css: ("#help-button .popover", "#help-button .top", ["border-co compare-elements-css: ("#help-button .popover", "#help-button .bottom", ["border-color"]) // Dark theme -local-storage: { +set-local-storage: { "rustdoc-theme": "dark", "rustdoc-use-system-theme": "false", } @@ -62,7 +62,7 @@ compare-elements-css: ("#help-button .popover", "#help-button .top", ["border-co compare-elements-css: ("#help-button .popover", "#help-button .bottom", ["border-color"]) // Light theme -local-storage: { +set-local-storage: { "rustdoc-theme": "light", "rustdoc-use-system-theme": "false", } @@ -77,7 +77,7 @@ compare-elements-css: ("#help-button .popover", "#help-button .top", ["border-co compare-elements-css: ("#help-button .popover", "#help-button .bottom", ["border-color"]) // Opening the mobile sidebar should close the settings popover. -size: (650, 600) +set-window-size: (650, 600) click: "#settings-menu a" assert-css: ("#settings-menu .popover", {"display": "block"}) click: ".sidebar-menu-toggle" diff --git a/tests/rustdoc-gui/run-on-hover.goml b/tests/rustdoc-gui/run-on-hover.goml index 8dcb62c10..b5fc49eac 100644 --- a/tests/rustdoc-gui/run-on-hover.goml +++ b/tests/rustdoc-gui/run-on-hover.goml @@ -2,14 +2,14 @@ // Playground. That button is hidden until the user hovers over the code block. // This test checks that it is hidden, and that it shows on hover. It also // checks for its color. -goto: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html" show-text: true define-function: ( "check-run-button", (theme, color, background, hover_color, hover_background), block { - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: assert-css: (".test-arrow", {"visibility": "hidden"}) move-cursor-to: ".example-wrap" diff --git a/tests/rustdoc-gui/rust-logo.goml b/tests/rustdoc-gui/rust-logo.goml index 2d15e8b96..640ed152b 100644 --- a/tests/rustdoc-gui/rust-logo.goml +++ b/tests/rustdoc-gui/rust-logo.goml @@ -1,26 +1,26 @@ // This test ensures that the correct style is applied to the rust logo in the sidebar. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" define-function: ( "check-logo", (theme, filter), block { // Going to the doc page. - goto: "file://" + |DOC_PATH| + "/test_docs/index.html" + go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" // Changing theme. - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: assert-css: (".rust-logo", {"filter": |filter|}) // Going to the source code page. - goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" + go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" // Changing theme (since it's local files, the local storage works by folder). - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: assert-css: (".rust-logo", {"filter": |filter|}) // Now we check that the non-rust logos don't have a CSS filter set. - goto: "file://" + |DOC_PATH| + "/huge_logo/index.html" + go-to: "file://" + |DOC_PATH| + "/huge_logo/index.html" // Changing theme on the new page (again...). - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: // Check there is no rust logo assert-false: ".rust-logo" diff --git a/tests/rustdoc-gui/scrape-examples-button-focus.goml b/tests/rustdoc-gui/scrape-examples-button-focus.goml index 1b5c3a0d2..77061ea2a 100644 --- a/tests/rustdoc-gui/scrape-examples-button-focus.goml +++ b/tests/rustdoc-gui/scrape-examples-button-focus.goml @@ -1,6 +1,6 @@ // This test ensures that the scraped examples buttons are working as expecting // when 'Enter' key is pressed when they're focused. -goto: "file://" + |DOC_PATH| + "/scrape_examples/fn.test.html" +go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test.html" // The next/prev buttons vertically scroll the code viewport between examples store-property: (initialScrollTop, ".scraped-example-list > .scraped-example pre", "scrollTop") @@ -8,24 +8,24 @@ focus: ".scraped-example-list > .scraped-example .next" press-key: "Enter" assert-property-false: (".scraped-example-list > .scraped-example pre", { "scrollTop": |initialScrollTop| -}) +}, NEAR) focus: ".scraped-example-list > .scraped-example .prev" press-key: "Enter" assert-property: (".scraped-example-list > .scraped-example pre", { "scrollTop": |initialScrollTop| -}) +}, NEAR) // The expand button increases the scrollHeight of the minimized code viewport store-property: (smallOffsetHeight, ".scraped-example-list > .scraped-example pre", "offsetHeight") assert-property-false: (".scraped-example-list > .scraped-example pre", { "scrollHeight": |smallOffsetHeight| -}) +}, NEAR) focus: ".scraped-example-list > .scraped-example .expand" press-key: "Enter" assert-property-false: (".scraped-example-list > .scraped-example pre", { "offsetHeight": |smallOffsetHeight| -}) +}, NEAR) store-property: (fullOffsetHeight, ".scraped-example-list > .scraped-example pre", "offsetHeight") assert-property: (".scraped-example-list > .scraped-example pre", { "scrollHeight": |fullOffsetHeight| -}) +}, NEAR) diff --git a/tests/rustdoc-gui/scrape-examples-color.goml b/tests/rustdoc-gui/scrape-examples-color.goml index 67c58826e..8ddb06fcc 100644 --- a/tests/rustdoc-gui/scrape-examples-color.goml +++ b/tests/rustdoc-gui/scrape-examples-color.goml @@ -1,5 +1,5 @@ // Check that scrape example code blocks have the expected colors. -goto: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html" +go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html" show-text: true define-function: ( @@ -7,7 +7,7 @@ define-function: ( (theme, highlight, highlight_focus, help_border, help_color, help_hover_border, help_hover_color), block { - local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false", } + set-local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false", } reload: wait-for: ".more-examples-toggle" assert-css: (".scraped-example .example-wrap .rust span.highlight:not(.focus)", { @@ -60,13 +60,13 @@ call-function: ("check-colors", { }) // Now testing the top and bottom background in case there is only one scraped examples. -goto: "file://" + |DOC_PATH| + "/scrape_examples/fn.test.html" +go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test.html" define-function: ( "check-background", (theme, background_color_start, background_color_end), block { - local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false", } + set-local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false", } reload: assert-css: (".scraped-example:not(.expanded) .code-wrapper::before", { "background-image": "linear-gradient(" + |background_color_start| + ", " + diff --git a/tests/rustdoc-gui/scrape-examples-fonts.goml b/tests/rustdoc-gui/scrape-examples-fonts.goml index 142f337cb..4c325bace 100644 --- a/tests/rustdoc-gui/scrape-examples-fonts.goml +++ b/tests/rustdoc-gui/scrape-examples-fonts.goml @@ -1,5 +1,5 @@ // This test ensures that the correct font is used in scraped examples. -goto: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html" +go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html" store-value: (font, '"Fira Sans", Arial, NanumBarunGothic, sans-serif') diff --git a/tests/rustdoc-gui/scrape-examples-layout.goml b/tests/rustdoc-gui/scrape-examples-layout.goml index dad727c77..160056d6d 100644 --- a/tests/rustdoc-gui/scrape-examples-layout.goml +++ b/tests/rustdoc-gui/scrape-examples-layout.goml @@ -1,5 +1,5 @@ // Check that the line number column has the correct layout. -goto: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html" +go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html" // Check that it's not zero. assert-property-false: ( @@ -44,6 +44,6 @@ assert-position: (".scraped-example .code-wrapper", {"y": 253}) assert-position: (".scraped-example .code-wrapper .prev", {"y": 253 + |offset_y|}) // Then with mobile -size: (600, 600) +set-window-size: (600, 600) assert-position: (".scraped-example .code-wrapper", {"y": 308}) assert-position: (".scraped-example .code-wrapper .prev", {"y": 308 + |offset_y|}) diff --git a/tests/rustdoc-gui/scrape-examples-toggle.goml b/tests/rustdoc-gui/scrape-examples-toggle.goml index 2d5df6a5d..9cec6d2bb 100644 --- a/tests/rustdoc-gui/scrape-examples-toggle.goml +++ b/tests/rustdoc-gui/scrape-examples-toggle.goml @@ -1,5 +1,5 @@ // This tests checks that the "scraped examples" toggle is working as expected. -goto: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html" +go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html" // Checking the color of the toggle line. show-text: true @@ -7,7 +7,7 @@ define-function: ( "check-color", (theme, toggle_line_color, toggle_line_hover_color), block { - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: // Clicking "More examples..." will open additional examples diff --git a/tests/rustdoc-gui/search-error.goml b/tests/rustdoc-gui/search-error.goml index 2a10a647b..d21905e90 100644 --- a/tests/rustdoc-gui/search-error.goml +++ b/tests/rustdoc-gui/search-error.goml @@ -1,5 +1,5 @@ // Checks that the crate search filtering is handled correctly and changes the results. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html?search=sa'%3Bda'%3Bds" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=sa'%3Bda'%3Bds" show-text: true define-function: ( @@ -7,7 +7,7 @@ define-function: ( (theme, error_background), block { // Setting the theme. - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} // We reload the page so the local storage settings are being used. reload: diff --git a/tests/rustdoc-gui/search-filter.goml b/tests/rustdoc-gui/search-filter.goml index 5bc6e87d6..d739471a6 100644 --- a/tests/rustdoc-gui/search-filter.goml +++ b/tests/rustdoc-gui/search-filter.goml @@ -1,5 +1,5 @@ // Checks that the crate search filtering is handled correctly and changes the results. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" show-text: true write: (".search-input", "test") // To be SURE that the search will be run. @@ -16,6 +16,7 @@ press-key: "ArrowDown" press-key: "ArrowDown" press-key: "ArrowDown" press-key: "ArrowDown" +press-key: "ArrowDown" press-key: "Enter" // Waiting for the search results to appear... wait-for: "#search-tabs" @@ -41,13 +42,14 @@ press-key: "ArrowUp" press-key: "ArrowUp" press-key: "ArrowUp" press-key: "ArrowUp" +press-key: "ArrowUp" press-key: "Enter" // Waiting for the search results to appear... wait-for: "#search-tabs" assert-property: ("#crate-search", {"value": "all crates"}) // Checking that the URL parameter is taken into account for crate filtering. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html?search=test&filter-crate=lib2" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=test&filter-crate=lib2" wait-for: "#crate-search" assert-property: ("#crate-search", {"value": "lib2"}) assert-false: "#results .externcrate" @@ -57,10 +59,10 @@ assert-text: (".search-results-title", "Results in all crates", STARTS_WITH) // Checking the display of the crate filter. // We start with the light theme. -local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"} +set-local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"} reload: -timeout: 2000 +set-timeout: 2000 wait-for: "#crate-search" assert-css: ("#crate-search", { "border": "1px solid rgb(224, 224, 224)", diff --git a/tests/rustdoc-gui/search-form-elements.goml b/tests/rustdoc-gui/search-form-elements.goml index 542db348c..83c698090 100644 --- a/tests/rustdoc-gui/search-form-elements.goml +++ b/tests/rustdoc-gui/search-form-elements.goml @@ -1,9 +1,9 @@ // This test ensures that the elements in ".search-form" have the expected display. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" show-text: true // Ayu theme -local-storage: { +set-local-storage: { "rustdoc-theme": "ayu", "rustdoc-use-system-theme": "false", } @@ -89,7 +89,7 @@ assert-css: ( ) // Dark theme -local-storage: { +set-local-storage: { "rustdoc-theme": "dark", "rustdoc-use-system-theme": "false", } @@ -176,7 +176,7 @@ assert-css: ( ) // Light theme -local-storage: { +set-local-storage: { "rustdoc-theme": "light", "rustdoc-use-system-theme": "false", } diff --git a/tests/rustdoc-gui/search-input-mobile.goml b/tests/rustdoc-gui/search-input-mobile.goml index ce0cef77c..adcb3658a 100644 --- a/tests/rustdoc-gui/search-input-mobile.goml +++ b/tests/rustdoc-gui/search-input-mobile.goml @@ -1,11 +1,11 @@ // Test to ensure that you can click on the search input, whatever the width. // The PR which fixed it is: https://github.com/rust-lang/rust/pull/81592 -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" -size: (463, 700) +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" +set-window-size: (463, 700) // We first check that the search input isn't already focused. assert-false: ("input.search-input:focus") click: "input.search-input" reload: -size: (750, 700) +set-window-size: (750, 700) click: "input.search-input" assert: ("input.search-input:focus") diff --git a/tests/rustdoc-gui/search-keyboard.goml b/tests/rustdoc-gui/search-keyboard.goml index ed975664c..f1d802461 100644 --- a/tests/rustdoc-gui/search-keyboard.goml +++ b/tests/rustdoc-gui/search-keyboard.goml @@ -1,6 +1,6 @@ // Checks that the search tab results work correctly with function signature syntax // First, try a search-by-name -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" write: (".search-input", "Foo") // To be SURE that the search will be run. press-key: 'Enter' diff --git a/tests/rustdoc-gui/search-no-result.goml b/tests/rustdoc-gui/search-no-result.goml index b76a44fa9..46d1856b4 100644 --- a/tests/rustdoc-gui/search-no-result.goml +++ b/tests/rustdoc-gui/search-no-result.goml @@ -1,5 +1,5 @@ // The goal of this test is to check the color of the "no result" links. -goto: "file://" + |DOC_PATH| + "/lib2/index.html?search=sdkfskjfsdks" +go-to: "file://" + |DOC_PATH| + "/lib2/index.html?search=sdkfskjfsdks" show-text: true define-function: ( @@ -7,7 +7,7 @@ define-function: ( (theme, link, link_hover), block { // Changing theme. - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: wait-for: "#results" assert: ".search-failed.active" diff --git a/tests/rustdoc-gui/search-reexport.goml b/tests/rustdoc-gui/search-reexport.goml index dd19f03bd..fd817b589 100644 --- a/tests/rustdoc-gui/search-reexport.goml +++ b/tests/rustdoc-gui/search-reexport.goml @@ -1,7 +1,7 @@ // Checks that the reexports are present in the search index, can have // doc aliases and are highligted when their ID is the hash of the page. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" -local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false"} +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" +set-local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false"} reload: // First we check that the reexport has the correct ID and no background color. assert-text: ("//*[@id='reexport.TheStdReexport']", "pub use ::std as TheStdReexport;") diff --git a/tests/rustdoc-gui/search-result-color.goml b/tests/rustdoc-gui/search-result-color.goml index d6d54ec4b..da46a90df 100644 --- a/tests/rustdoc-gui/search-result-color.goml +++ b/tests/rustdoc-gui/search-result-color.goml @@ -31,13 +31,13 @@ define-function: ( }, ) -goto: "file://" + |DOC_PATH| + "/test_docs/index.html?search=coo" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=coo" // This is needed so that the text color is computed. show-text: true // Ayu theme -local-storage: { +set-local-storage: { "rustdoc-theme": "ayu", "rustdoc-use-system-theme": "false", } @@ -154,7 +154,7 @@ assert-css: ( ) // Dark theme -local-storage: { +set-local-storage: { "rustdoc-theme": "dark", "rustdoc-use-system-theme": "false", } @@ -259,7 +259,7 @@ assert-css: ( ) // Light theme -local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"} +set-local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"} reload: // Waiting for the search results to appear... @@ -361,7 +361,7 @@ assert-css: ( ) // Check the alias. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +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 @@ -369,7 +369,7 @@ define-function: ( "check-alias", (theme, alias, grey), block { - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: write: (".search-input", "thisisanalias") // To be SURE that the search will be run. diff --git a/tests/rustdoc-gui/search-result-description.goml b/tests/rustdoc-gui/search-result-description.goml index 9fa210804..745ef31e6 100644 --- a/tests/rustdoc-gui/search-result-description.goml +++ b/tests/rustdoc-gui/search-result-description.goml @@ -1,5 +1,5 @@ // This test is to ensure that the codeblocks are correctly rendered in the search results. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html?search=some_more_function" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=some_more_function" // Waiting for the search results to appear... wait-for: "#search-tabs" assert-text: (".search-results .desc code", "format!") diff --git a/tests/rustdoc-gui/search-result-display.goml b/tests/rustdoc-gui/search-result-display.goml index 20a88c36e..93c71f23f 100644 --- a/tests/rustdoc-gui/search-result-display.goml +++ b/tests/rustdoc-gui/search-result-display.goml @@ -1,6 +1,6 @@ // Checks that the search results have the expected width. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" -size: (900, 1000) +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" +set-window-size: (900, 1000) write: (".search-input", "test") // To be SURE that the search will be run. press-key: 'Enter' @@ -8,7 +8,7 @@ wait-for: "#crate-search" // The width is returned by "getComputedStyle" which returns the exact number instead of the // CSS rule which is "50%"... assert-css: (".search-results div.desc", {"width": "310px"}) -size: (600, 100) +set-window-size: (600, 100) // As counter-intuitive as it may seem, in this width, the width is "100%", which is why // when computed it's larger. assert-css: (".search-results div.desc", {"width": "566px"}) @@ -18,7 +18,7 @@ assert-css: (".search-results .result-name > span", {"display": "inline"}) // Check that the crate filter `<select>` is correctly handled when it goes to next line. // To do so we need to update the length of one of its `<option>`. -size: (900, 900) +set-window-size: (900, 900) // First we check the current width, height and position. assert-css: ("#crate-search", {"width": "223px"}) @@ -26,7 +26,7 @@ assert-css: (".search-results-title", {"height": "50px", "width": "640px"}) assert-css: ("#search", {"width": "640px"}) // Then we update the text of one of the `<option>`. -text: ( +set-text: ( "#crate-search option", "sdjfaksdjfaksjdbfkadsbfkjsadbfkdsbkfbsadkjfbkdsabfkadsfkjdsafa", ) @@ -43,7 +43,7 @@ define-function: ( "check-filter", (theme, border, filter, hover_border, hover_filter), block { - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: wait-for: "#crate-search" assert-css: ("#crate-search", {"border": "1px solid " + |border|}) diff --git a/tests/rustdoc-gui/search-result-go-to-first.goml b/tests/rustdoc-gui/search-result-go-to-first.goml index f444baa6c..a0bc2bb16 100644 --- a/tests/rustdoc-gui/search-result-go-to-first.goml +++ b/tests/rustdoc-gui/search-result-go-to-first.goml @@ -2,11 +2,11 @@ // First, we check that the first page doesn't have the string we're looking for to ensure // that the feature is changing page as expected. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" assert-text-false: (".main-heading h1", "Struct test_docs::Foo") // We now check that we land on the search result page if "go_to_first" isn't set. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html?search=struct%3AFoo" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=struct%3AFoo" // Waiting for the search results to appear... wait-for: "#search-tabs" assert-text-false: (".main-heading h1", "Struct test_docs::Foo") @@ -14,6 +14,6 @@ assert-text-false: (".main-heading h1", "Struct test_docs::Foo") assert-css: ("#main-content", {"display": "none"}) // Now we can check that the feature is working as expected! -goto: "file://" + |DOC_PATH| + "/test_docs/index.html?search=struct%3AFoo&go_to_first=true" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=struct%3AFoo&go_to_first=true" // Waiting for the page to load... wait-for-text: (".main-heading h1", "Struct test_docs::Foo") diff --git a/tests/rustdoc-gui/search-result-keyword.goml b/tests/rustdoc-gui/search-result-keyword.goml index 8c3577d9f..5d56e9d9c 100644 --- a/tests/rustdoc-gui/search-result-keyword.goml +++ b/tests/rustdoc-gui/search-result-keyword.goml @@ -1,5 +1,5 @@ // Checks that the "keyword" results have the expected text alongside them. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" write: (".search-input", "CookieMonster") // To be SURE that the search will be run. press-key: 'Enter' diff --git a/tests/rustdoc-gui/search-tab-change-title-fn-sig.goml b/tests/rustdoc-gui/search-tab-change-title-fn-sig.goml index 1433dc4d7..b3f9ae928 100644 --- a/tests/rustdoc-gui/search-tab-change-title-fn-sig.goml +++ b/tests/rustdoc-gui/search-tab-change-title-fn-sig.goml @@ -1,6 +1,6 @@ // Checks that the search tab results work correctly with function signature syntax // First, try a search-by-name -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" write: (".search-input", "Foo") // To be SURE that the search will be run. press-key: 'Enter' @@ -22,7 +22,7 @@ press-key: "ArrowLeft" wait-for-attribute: ("#search-tabs > button:nth-of-type(3)", {"class": "selected"}) // Now try search-by-return -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" write: (".search-input", "-> String") // To be SURE that the search will be run. press-key: 'Enter' @@ -44,7 +44,7 @@ press-key: "ArrowLeft" wait-for-attribute: ("#search-tabs > button:nth-of-type(1)", {"class": "selected"}) // Try with a search-by-return with no results -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" write: (".search-input", "-> Something") // To be SURE that the search will be run. press-key: 'Enter' @@ -54,7 +54,7 @@ assert-attribute: ("#search-tabs > button:nth-of-type(1)", {"class": "selected"} assert-text: ("#search-tabs > button:nth-of-type(1)", "In Function Return Types", STARTS_WITH) // Try with a search-by-parameter -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" write: (".search-input", "usize pattern") // To be SURE that the search will be run. press-key: 'Enter' @@ -64,7 +64,7 @@ assert-attribute: ("#search-tabs > button:nth-of-type(1)", {"class": "selected"} assert-text: ("#search-tabs > button:nth-of-type(1)", "In Function Parameters", STARTS_WITH) // Try with a search-by-parameter-and-return -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" write: (".search-input", "pattern -> str") // To be SURE that the search will be run. press-key: 'Enter' diff --git a/tests/rustdoc-gui/search-tab.goml b/tests/rustdoc-gui/search-tab.goml index 36958f700..2223598f0 100644 --- a/tests/rustdoc-gui/search-tab.goml +++ b/tests/rustdoc-gui/search-tab.goml @@ -1,5 +1,5 @@ // Checking the colors of the search tab headers. -goto: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html?search=something" +go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html?search=something" show-text: true define-function: ( @@ -9,7 +9,7 @@ define-function: ( border_top_hover), block { // Setting the theme. - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: // These two commands are used to be sure the search will be run. diff --git a/tests/rustdoc-gui/setting-auto-hide-content-large-items.goml b/tests/rustdoc-gui/setting-auto-hide-content-large-items.goml new file mode 100644 index 000000000..6cd725043 --- /dev/null +++ b/tests/rustdoc-gui/setting-auto-hide-content-large-items.goml @@ -0,0 +1,51 @@ +// This test ensures that the "Auto-hide item contents for large items" setting is working as +// expected. + +// We need to disable this check because `implementors/test_docs/trait.Iterator.js` doesn't exist. +fail-on-request-error: false + +define-function: ( + "check-setting", + (storage_value, setting_attribute_value, toggle_attribute_value), + block { + assert-local-storage: {"rustdoc-auto-hide-large-items": |storage_value|} + click: "#settings-menu" + wait-for: "#settings" + assert-property: ("#auto-hide-large-items", {"checked": |setting_attribute_value|}) + assert-attribute: (".item-decl .type-contents-toggle", {"open": |toggle_attribute_value|}) + } +) + +go-to: "file://" + |DOC_PATH| + "/lib2/scroll_traits/trait.Iterator.html" + +// We check that the setting is enabled by default and is working. +call-function: ("check-setting", { + "storage_value": null, + "setting_attribute_value": "true", + "toggle_attribute_value": null, +}) + +// Now we change its value. +click: "#auto-hide-large-items" +assert-local-storage: {"rustdoc-auto-hide-large-items": "false"} + +// We check that the changes were applied as expected. +reload: + +call-function: ("check-setting", { + "storage_value": "false", + "setting_attribute_value": "false", + "toggle_attribute_value": "", +}) + +// And now we re-enable the setting. +click: "#auto-hide-large-items" +assert-local-storage: {"rustdoc-auto-hide-large-items": "true"} + +// And we check everything is back the way it was before. +reload: +call-function: ("check-setting", { + "storage_value": "true", + "setting_attribute_value": "true", + "toggle_attribute_value": null, +}) diff --git a/tests/rustdoc-gui/setting-auto-hide-item-methods-docs.goml b/tests/rustdoc-gui/setting-auto-hide-item-methods-docs.goml new file mode 100644 index 000000000..5210ad8f7 --- /dev/null +++ b/tests/rustdoc-gui/setting-auto-hide-item-methods-docs.goml @@ -0,0 +1,48 @@ +// This test ensures that the "Auto-hide item methods' documentation" setting is working as +// expected. + +define-function: ( + "check-setting", + (storage_value, setting_attribute_value, toggle_attribute_value), + block { + assert-local-storage: {"rustdoc-auto-hide-method-docs": |storage_value|} + click: "#settings-menu" + wait-for: "#settings" + assert-property: ("#auto-hide-method-docs", {"checked": |setting_attribute_value|}) + assert-attribute: (".toggle.method-toggle", {"open": |toggle_attribute_value|}) + } +) + +go-to: "file://" + |DOC_PATH| + "/lib2/struct.Foo.html" + +// We check that the setting is disabled by default. +call-function: ("check-setting", { + "storage_value": null, + "setting_attribute_value": "false", + "toggle_attribute_value": "", +}) + +// Now we change its value. +click: "#auto-hide-method-docs" +assert-local-storage: {"rustdoc-auto-hide-method-docs": "true"} + +// We check that the changes were applied as expected. +reload: + +call-function: ("check-setting", { + "storage_value": "true", + "setting_attribute_value": "true", + "toggle_attribute_value": null, +}) + +// And now we re-disable the setting. +click: "#auto-hide-method-docs" +assert-local-storage: {"rustdoc-auto-hide-method-docs": "false"} + +// And we check everything is back the way it was before. +reload: +call-function: ("check-setting", { + "storage_value": "false", + "setting_attribute_value": "false", + "toggle_attribute_value": "", +}) diff --git a/tests/rustdoc-gui/setting-auto-hide-trait-implementations.goml b/tests/rustdoc-gui/setting-auto-hide-trait-implementations.goml new file mode 100644 index 000000000..ecadd8fa8 --- /dev/null +++ b/tests/rustdoc-gui/setting-auto-hide-trait-implementations.goml @@ -0,0 +1,47 @@ +// Checks that the setting "auto hide trait implementations" is working as expected. + +define-function: ( + "check-setting", + (storage_value, setting_attribute_value, toggle_attribute_value), + block { + assert-local-storage: {"rustdoc-auto-hide-trait-implementations": |storage_value|} + click: "#settings-menu" + wait-for: "#settings" + assert-property: ("#auto-hide-trait-implementations", {"checked": |setting_attribute_value|}) + assert-attribute: ("#trait-implementations-list > details", {"open": |toggle_attribute_value|}, ALL) + } +) + +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" + +// By default, the trait implementations are not collapsed. +call-function: ("check-setting", { + "storage_value": null, + "setting_attribute_value": "false", + "toggle_attribute_value": "", +}) + +// Now we change its value. +click: "#auto-hide-trait-implementations" +assert-local-storage: {"rustdoc-auto-hide-trait-implementations": "true"} + +// We check that the changes were applied as expected. +reload: + +call-function: ("check-setting", { + "storage_value": "true", + "setting_attribute_value": "true", + "toggle_attribute_value": null, +}) + +// And now we re-disable the setting. +click: "#auto-hide-trait-implementations" +assert-local-storage: {"rustdoc-auto-hide-trait-implementations": "false"} + +// And we check everything is back the way it was before. +reload: +call-function: ("check-setting", { + "storage_value": "false", + "setting_attribute_value": "false", + "toggle_attribute_value": "", +}) diff --git a/tests/rustdoc-gui/setting-go-to-only-result.goml b/tests/rustdoc-gui/setting-go-to-only-result.goml new file mode 100644 index 000000000..c5720b4bf --- /dev/null +++ b/tests/rustdoc-gui/setting-go-to-only-result.goml @@ -0,0 +1,63 @@ +// Checks that the setting "Directly go to item in search if there is only one result " is working as expected. + +define-function: ( + "check-setting", + (storage_value, setting_attribute_value), + block { + assert-local-storage: {"rustdoc-go-to-only-result": |storage_value|} + click: "#settings-menu" + wait-for: "#settings" + assert-property: ("#go-to-only-result", {"checked": |setting_attribute_value|}) + } +) + +go-to: "file://" + |DOC_PATH| + "/lib2/index.html" + +call-function: ("check-setting", { + "storage_value": null, + "setting_attribute_value": "false", +}) + +// By default, the search doesn't automatically go to the page if there is only one result. +go-to: "file://" + |DOC_PATH| + "/lib2/index.html?search=HasALongTraitWithParams" +// It will timeout if the setting isn't working. +wait-for: "#search" +assert-document-property: ({"URL": "/lib2/index.html"}, CONTAINS) + +// Now we change its value. +click: "#settings-menu" +wait-for: "#settings" +click: "#go-to-only-result" +assert-local-storage: {"rustdoc-go-to-only-result": "true"} + +go-to: "file://" + |DOC_PATH| + "/lib2/index.html" +// We enter it into the search. +write: (".search-input", "HasALongTraitWithParams") +wait-for-document-property: {"title": "HasALongTraitWithParams in lib2 - Rust"} +assert-document-property: ({"URL": "/lib2/struct.HasALongTraitWithParams.html"}, ENDS_WITH) + +// We try again to see if it goes to the only result +go-to: "file://" + |DOC_PATH| + "/lib2/index.html?search=HasALongTraitWithParams" +wait-for-document-property: {"title": "HasALongTraitWithParams in lib2 - Rust"} +assert-document-property: ({"URL": "/lib2/struct.HasALongTraitWithParams.html"}, ENDS_WITH) + +// We check the settings +call-function: ("check-setting", { + "storage_value": "true", + "setting_attribute_value": "true", +}) + +// And now we re-disable the setting. +click: "#go-to-only-result" +assert-local-storage: {"rustdoc-go-to-only-result": "false"} + +go-to: "file://" + |DOC_PATH| + "/lib2/index.html?search=HasALongTraitWithParams" +// It will timeout if the setting isn't working. +wait-for: "#search" +assert-document-property: ({"URL": "/lib2/index.html"}, CONTAINS) + +// And we check everything is back the way it was before. +call-function: ("check-setting", { + "storage_value": "false", + "setting_attribute_value": "false", +}) diff --git a/tests/rustdoc-gui/settings.goml b/tests/rustdoc-gui/settings.goml index a84172885..733be9beb 100644 --- a/tests/rustdoc-gui/settings.goml +++ b/tests/rustdoc-gui/settings.goml @@ -1,6 +1,6 @@ // This test ensures that the settings menu display is working as expected and that // the settings page is also rendered as expected. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" show-text: true // needed when we check for colors below. // First, we check that the settings page doesn't exist. assert-false: "#settings" @@ -35,7 +35,7 @@ wait-for: "#alternative-display #search" assert: "#main-content.hidden" // Now let's check the content of the settings menu. -local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false"} +set-local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false"} reload: click: "#settings-menu" wait-for: "#settings" @@ -56,11 +56,12 @@ move-cursor-to: "#settings-menu > a" assert-css: ( "#theme-dark", { - "border-color": "rgb(221, 221, 221)", + "border-color": "rgb(153, 153, 153)", "box-shadow": "rgb(53, 53, 53) 0px 0px 0px 3px inset", + "border-width": "2px", }, ) -assert-css: ("#theme-light", {"border-color": "rgb(221, 221, 221)", "box-shadow": "none"}) +assert-css: ("#theme-light", {"border-color": "rgb(153, 153, 153)", "box-shadow": "none"}) // Let's start with the hover for radio buttons. move-cursor-to: "#theme-dark" assert-css: ( @@ -68,26 +69,36 @@ assert-css: ( { "border-color": "rgb(33, 150, 243)", "box-shadow": "rgb(53, 53, 53) 0px 0px 0px 3px inset", + "border-width": "2px", }, ) move-cursor-to: "#theme-light" -assert-css: ("#theme-light", {"border-color": "rgb(33, 150, 243)", "box-shadow": "none"}) +assert-css: ( + "#theme-light", + { + "border-color": "rgb(33, 150, 243)", + "box-shadow": "none", + "border-width": "2px", + } +) move-cursor-to: "#theme-ayu" // Let's now check with the focus for radio buttons. focus: "#theme-dark" assert-css: ( "#theme-dark", { - "border-color": "rgb(221, 221, 221)", + "border-color": "rgb(153, 153, 153)", "box-shadow": "rgb(53, 53, 53) 0px 0px 0px 3px inset, rgb(33, 150, 243) 0px 0px 2px 2px", + "border-width": "2px", }, ) focus: "#theme-light" assert-css: ( "#theme-light", { - "border-color": "rgb(221, 221, 221)", + "border-color": "rgb(153, 153, 153)", "box-shadow": "rgb(33, 150, 243) 0px 0px 1px 1px", + "border-width": "2px", }, ) // Now we check we both focus and hover for radio buttons. @@ -98,6 +109,7 @@ assert-css: ( { "border-color": "rgb(33, 150, 243)", "box-shadow": "rgb(53, 53, 53) 0px 0px 0px 3px inset, rgb(33, 150, 243) 0px 0px 2px 2px", + "border-width": "2px", }, ) move-cursor-to: "#theme-light" @@ -107,6 +119,7 @@ assert-css: ( { "border-color": "rgb(33, 150, 243)", "box-shadow": "rgb(33, 150, 243) 0px 0px 1px 1px", + "border-width": "2px", }, ) // Now we check the setting-radio-name is on a different line than the label. @@ -142,7 +155,18 @@ assert-css: ( "#auto-hide-large-items", { "background-color": "rgb(33, 150, 243)", - "border-color": "rgb(221, 221, 221)", + "border-color": "rgb(153, 153, 153)", + // 1px border when checked + "border-width": "1px", + }, +) +assert-css: ( + "#auto-hide-method-docs", + { + "background-color": "rgba(0, 0, 0, 0)", + "border-color": "rgb(153, 153, 153)", + // 2px border when unchecked + "border-width": "2px", }, ) // Let's start with the hover for toggles. @@ -152,6 +176,18 @@ assert-css: ( { "background-color": "rgb(33, 150, 243)", "border-color": "rgb(33, 150, 243)", + // 1px border when checked + "border-width": "1px", + }, +) +move-cursor-to: "#auto-hide-method-docs" +assert-css: ( + "#auto-hide-method-docs", + { + "background-color": "rgba(0, 0, 0, 0)", + "border-color": "rgb(33, 150, 243)", + // 2px border when unchecked + "border-width": "2px", }, ) move-cursor-to: "#settings-menu > a" @@ -161,8 +197,21 @@ assert-css: ( "#auto-hide-large-items", { "background-color": "rgb(33, 150, 243)", - "border-color": "rgb(221, 221, 221)", + "border-color": "rgb(153, 153, 153)", + "box-shadow": "rgb(33, 150, 243) 0px 0px 1px 1px", + // 1px border when checked + "border-width": "1px", + }, +) +focus: "#auto-hide-method-docs" +assert-css: ( + "#auto-hide-method-docs", + { + "background-color": "rgba(0, 0, 0, 0)", + "border-color": "rgb(153, 153, 153)", "box-shadow": "rgb(33, 150, 243) 0px 0px 1px 1px", + // 2px border when unchecked + "border-width": "2px", }, ) // Now we check we both focus and hover for toggles. @@ -174,6 +223,20 @@ assert-css: ( "background-color": "rgb(33, 150, 243)", "border-color": "rgb(33, 150, 243)", "box-shadow": "rgb(33, 150, 243) 0px 0px 1px 1px", + // 1px border when checked + "border-width": "1px", + }, +) +move-cursor-to: "#auto-hide-method-docs" +focus: "#auto-hide-method-docs" +assert-css: ( + "#auto-hide-method-docs", + { + "background-color": "rgba(0, 0, 0, 0)", + "border-color": "rgb(33, 150, 243)", + "box-shadow": "rgb(33, 150, 243) 0px 0px 1px 1px", + // 2px border when unchecked + "border-width": "2px", }, ) @@ -189,7 +252,7 @@ assert-text: ("#preferred-light-theme .setting-radio-name", "Preferred light the // We now check that clicking on the toggles' text is like clicking on the checkbox. // To test it, we use the "Disable keyboard shortcuts". -local-storage: {"rustdoc-disable-shortcuts": "false"} +set-local-storage: {"rustdoc-disable-shortcuts": "false"} click: ".setting-line:last-child .setting-check span" assert-local-storage: {"rustdoc-disable-shortcuts": "true"} @@ -227,7 +290,7 @@ wait-for-css: ("#settings-menu .popover", {"display": "none"}) wait-for-css: ("#help-button .popover", {"display": "block"}) // Now we go to the settings page to check that the CSS is loaded as expected. -goto: "file://" + |DOC_PATH| + "/settings.html" +go-to: "file://" + |DOC_PATH| + "/settings.html" wait-for: "#settings" assert-css: (".setting-line", {"position": "relative"}) @@ -247,7 +310,7 @@ javascript: true // Check for the display on small screen show-text: true reload: -size: (300, 1000) +set-window-size: (300, 1000) click: "#settings-menu" wait-for: "#settings" assert-css: (".setting-line", {"position": "relative"}) diff --git a/tests/rustdoc-gui/shortcuts.goml b/tests/rustdoc-gui/shortcuts.goml index 9068680d6..667df89ec 100644 --- a/tests/rustdoc-gui/shortcuts.goml +++ b/tests/rustdoc-gui/shortcuts.goml @@ -1,5 +1,5 @@ // Check that the various shortcuts are working. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" // We first check that the search input isn't already focused. assert-false: "input.search-input:focus" press-key: "s" diff --git a/tests/rustdoc-gui/sidebar-links-color.goml b/tests/rustdoc-gui/sidebar-links-color.goml index 1d5fdb7a4..cec1a7999 100644 --- a/tests/rustdoc-gui/sidebar-links-color.goml +++ b/tests/rustdoc-gui/sidebar-links-color.goml @@ -1,5 +1,5 @@ // This test checks links colors in sidebar before and after hover. -goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" // This is needed so that the text color is computed. show-text: true @@ -13,7 +13,7 @@ define-function: ( type_hover_background, keyword, keyword_hover, keyword_hover_background, ), block { - local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false" } + set-local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false" } reload: // Struct assert-css: ( diff --git a/tests/rustdoc-gui/sidebar-macro-reexport.goml b/tests/rustdoc-gui/sidebar-macro-reexport.goml index b5c1b6a43..0f7ef6c35 100644 --- a/tests/rustdoc-gui/sidebar-macro-reexport.goml +++ b/tests/rustdoc-gui/sidebar-macro-reexport.goml @@ -1,5 +1,5 @@ // This test ensures that the reexport of a macro doesn't make the original macro // displayed twice in the sidebar. -goto: "file://" + |DOC_PATH| + "/test_docs/macro.repro.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/macro.repro.html" wait-for: ".sidebar-elems .block.macro a" assert-count: ("//*[@class='sidebar-elems']//*[@class='block macro']//a[text()='repro']", 1) diff --git a/tests/rustdoc-gui/sidebar-mobile-scroll.goml b/tests/rustdoc-gui/sidebar-mobile-scroll.goml index 4442b263e..d58d1d487 100644 --- a/tests/rustdoc-gui/sidebar-mobile-scroll.goml +++ b/tests/rustdoc-gui/sidebar-mobile-scroll.goml @@ -1,31 +1,12 @@ -// This test ensures that the mobile sidebar preserves scroll position. -goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" -// Switching to "mobile view" by reducing the width to 600px. -size: (700, 600) -assert-css: (".sidebar", {"display": "block", "left": "-1000px"}) - -// Scroll down. -scroll-to: "//h2[@id='blanket-implementations']" -assert-window-property: {"pageYOffset": "622"} - -// Open the sidebar menu. -click: ".sidebar-menu-toggle" -wait-for-css: (".sidebar", {"left": "0px"}) - -// We are no longer "scrolled". It's important that the user can't -// scroll the body at all, but these test scripts are run only in Chrome, -// and we need to use a more complicated solution to this problem because -// of Mobile Safari... -assert-window-property: {"pageYOffset": "0"} - -// Close the sidebar menu. Make sure the scroll position gets restored. -click: ".sidebar-menu-toggle" -wait-for-css: (".sidebar", {"left": "-1000px"}) -assert-window-property: {"pageYOffset": "622"} - -// Now test that scrollability returns when the browser window is just resized. -click: ".sidebar-menu-toggle" -wait-for-css: (".sidebar", {"left": "0px"}) -assert-window-property: {"pageYOffset": "0"} -size: (900, 600) -assert-window-property: {"pageYOffset": "622"} +// This test ensures that the mobile disables scrolling the page. +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" +set-window-size: (1280, 800) // desktop +assert-css: (".sidebar", {"overscroll-behavior": "contain"}) +set-window-size: (700, 600) // mobile +assert-css: (".sidebar", {"overscroll-behavior": "contain"}) + +go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" +set-window-size: (1280, 800) // desktop +assert-css: (".sidebar", {"overscroll-behavior": "contain"}) +set-window-size: (700, 600) // mobile +assert-css: (".sidebar", {"overscroll-behavior": "contain"}) diff --git a/tests/rustdoc-gui/sidebar-mobile.goml b/tests/rustdoc-gui/sidebar-mobile.goml index cc6267c3d..3b022c7e9 100644 --- a/tests/rustdoc-gui/sidebar-mobile.goml +++ b/tests/rustdoc-gui/sidebar-mobile.goml @@ -1,9 +1,9 @@ // This test ensure that the sidebar isn't "hidden" on mobile but instead moved out of the viewport. // This is especially important for devices for "text-first" content (like for users with // sight issues). -goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" // Switching to "mobile view" by reducing the width to 600px. -size: (600, 600) +set-window-size: (600, 600) assert-css: (".sidebar", {"display": "block", "left": "-1000px"}) // Opening the sidebar menu. click: ".sidebar-menu-toggle" @@ -59,7 +59,7 @@ define-function: ( "check-colors", (theme, color, background), block { - local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": |theme|} + set-local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": |theme|} reload: // Open the sidebar menu. diff --git a/tests/rustdoc-gui/sidebar-source-code-display.goml b/tests/rustdoc-gui/sidebar-source-code-display.goml index f3eb8ff76..20bf0596f 100644 --- a/tests/rustdoc-gui/sidebar-source-code-display.goml +++ b/tests/rustdoc-gui/sidebar-source-code-display.goml @@ -1,6 +1,6 @@ // This test ensures that the elements in the sidebar are displayed correctly. javascript: false -goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" +go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" // Since the javascript is disabled, there shouldn't be a toggle. assert-false: "#src-sidebar-toggle" wait-for-css: (".sidebar", {"display": "none"}) @@ -22,7 +22,7 @@ wait-for-css: ("#src-sidebar-toggle", {"visibility": "visible"}) wait-for-css: (".sidebar", {"width": "300px"}) assert-local-storage: {"rustdoc-source-sidebar-show": "true"} click: ".sidebar a.selected" -goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" +go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" wait-for-css: (".sidebar", {"width": "300px"}) assert-local-storage: {"rustdoc-source-sidebar-show": "true"} @@ -36,7 +36,7 @@ define-function: ( background_toggle_hover, ), block { - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: wait-for-css: ("#src-sidebar-toggle", {"visibility": "visible"}) assert-css: ( @@ -148,7 +148,7 @@ call-function: ("check-colors", { }) // Now checking on mobile devices. -size: (500, 700) +set-window-size: (500, 700) reload: // Waiting for the sidebar to be displayed... wait-for-css: ("#src-sidebar-toggle", {"visibility": "visible"}) @@ -183,31 +183,21 @@ wait-for-css: (".sidebar", {"left": "-1000px"}) // The "scrollTop" property should be the same. assert-window-property: {"pageYOffset": "2542"} -// We now check that the scroll position is restored if the window is resized. -size: (500, 700) -click: "#src-sidebar-toggle" -wait-for-css: ("#source-sidebar", {"visibility": "visible"}) -assert-window-property: {"pageYOffset": "0"} -size: (900, 900) -assert-window-property: {"pageYOffset": "2542"} -size: (500, 700) -click: "#src-sidebar-toggle" -wait-for-css: ("#source-sidebar", {"visibility": "hidden"}) - // We now check that opening the sidebar and clicking a link will close it. // The behavior here on mobile is different than the behavior on desktop, // but common sense dictates that if you have a list of files that fills the entire screen, and // you click one of them, you probably want to actually see the file's contents, and not just // make it the current selection. +set-window-size: (500, 700) click: "#src-sidebar-toggle" wait-for-css: ("#source-sidebar", {"visibility": "visible"}) assert-local-storage: {"rustdoc-source-sidebar-show": "true"} click: ".sidebar a.selected" -goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" +go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" wait-for-css: ("#source-sidebar", {"visibility": "hidden"}) assert-local-storage: {"rustdoc-source-sidebar-show": "false"} // Resize back to desktop size, to check that the sidebar doesn't spontaneously open. -size: (1000, 1000) +set-window-size: (1000, 1000) wait-for-css: ("#source-sidebar", {"visibility": "hidden"}) assert-local-storage: {"rustdoc-source-sidebar-show": "false"} click: "#src-sidebar-toggle" diff --git a/tests/rustdoc-gui/sidebar-source-code.goml b/tests/rustdoc-gui/sidebar-source-code.goml index c8a29b58d..520b2c59b 100644 --- a/tests/rustdoc-gui/sidebar-source-code.goml +++ b/tests/rustdoc-gui/sidebar-source-code.goml @@ -1,6 +1,6 @@ // The goal of this test is to ensure that the sidebar is working as expected in the source // code pages. -goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" +go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" show-text: true // First, check the sidebar colors. @@ -8,7 +8,7 @@ define-function: ( "check-colors", (theme, color, background_color), block { - local-storage: { + set-local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false", } @@ -47,7 +47,7 @@ call-function: ( ) // Next, desktop mode layout. -size: (1100, 800) +set-window-size: (1100, 800) // We check that the sidebar isn't expanded and has the expected width. assert-css: ("nav.sidebar", {"width": "50px"}) // We now click on the button to expand the sidebar. @@ -62,7 +62,7 @@ wait-for: "html:not(.expanded)" assert: "nav.sidebar" // Checking that only the path to the current file is "open". -goto: "file://" + |DOC_PATH| + "/src/lib2/another_folder/sub_mod/mod.rs.html" +go-to: "file://" + |DOC_PATH| + "/src/lib2/another_folder/sub_mod/mod.rs.html" // First we expand the sidebar again. click: (10, 10) // We wait for the sidebar to be expanded. @@ -73,10 +73,10 @@ assert: "//*[@class='dir-entry' and @open]/*[text()='sub_mod']" // Only "another_folder" should be "open" in "lib2". assert: "//*[@class='dir-entry' and not(@open)]/*[text()='another_mod']" // All other trees should be collapsed. -assert-count: ("//*[@id='source-sidebar']/details[not(text()='lib2') and not(@open)]", 8) +assert-count: ("//*[@id='source-sidebar']/details[not(text()='lib2') and not(@open)]", 9) // We now switch to mobile mode. -size: (600, 600) +set-window-size: (600, 600) wait-for-css: (".source-sidebar-expanded nav.sidebar", {"left": "0px"}) // We collapse the sidebar. click: (10, 10) diff --git a/tests/rustdoc-gui/sidebar.goml b/tests/rustdoc-gui/sidebar.goml index a6d517090..3c1ed009a 100644 --- a/tests/rustdoc-gui/sidebar.goml +++ b/tests/rustdoc-gui/sidebar.goml @@ -1,5 +1,5 @@ // Checks multiple things on the sidebar display (width of its elements, colors, etc). -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" assert-property: (".sidebar", {"clientWidth": "200"}) show-text: true @@ -8,7 +8,7 @@ define-function: ( "check-colors", (theme, color, background_color), block { - local-storage: { + set-local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false", } @@ -46,7 +46,7 @@ call-function: ( } ) -local-storage: {"rustdoc-theme": "light"} +set-local-storage: {"rustdoc-theme": "light"} // We reload the page so the local storage settings are being used. reload: @@ -86,13 +86,13 @@ click: ".sidebar h2.location a" assert-property: ("html", {"scrollTop": "0"}) // We now go back to the crate page to click on the "lib2" crate link. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" assert-property: (".sidebar", {"clientWidth": "200"}) assert-css: (".sidebar-elems ul.crate > li:first-child > a", {"color": "rgb(53, 109, 164)"}) click: ".sidebar-elems ul.crate > li:first-child > a" // PAGE: lib2/index.html -goto: "file://" + |DOC_PATH| + "/lib2/index.html" +go-to: "file://" + |DOC_PATH| + "/lib2/index.html" assert-property: (".sidebar", {"clientWidth": "200"}) assert-text: (".sidebar > .location", "Crate lib2") // We check that we have the crates list and that the "current" on is now "lib2". @@ -115,13 +115,13 @@ assert-text: (".sidebar .sidebar-elems h2", "In lib2") // We check that we don't have the crate list. assert-false: ".sidebar-elems > .crate" -goto: "./module/index.html" +go-to: "./module/index.html" assert-property: (".sidebar", {"clientWidth": "200"}) assert-text: (".sidebar > .location", "Module module") // We check that we don't have the crate list. assert-false: ".sidebar-elems > .crate" -goto: "./sub_module/sub_sub_module/index.html" +go-to: "./sub_module/sub_sub_module/index.html" assert-property: (".sidebar", {"clientWidth": "200"}) assert-text: (".sidebar > .location", "Module sub_sub_module") // We check that we don't have the crate list. @@ -130,13 +130,13 @@ assert-text: (".sidebar-elems > section ul > li:nth-child(1)", "Functions") assert-text: ("#functions + .item-table .item-name > a", "foo") // Links to trait implementations in the sidebar should not wrap even if they are long. -goto: "file://" + |DOC_PATH| + "/lib2/struct.HasALongTraitWithParams.html" +go-to: "file://" + |DOC_PATH| + "/lib2/struct.HasALongTraitWithParams.html" assert-property: (".sidebar", {"clientWidth": "200"}) assert-property: (".sidebar-elems section .block li > a", {"offsetHeight": 29}) // Test that clicking on of the "In <module>" headings in the sidebar links to the // appropriate anchor in index.html. -goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" assert-property: (".sidebar", {"clientWidth": "200"}) click: "//ul[@class='block mod']/preceding-sibling::h3/a" // PAGE: index.html @@ -149,3 +149,17 @@ assert-property: (".sidebar", {"clientWidth": "200"}) click: "#toggle-all-docs" assert-text: ("#toggle-all-docs", "[−]") assert-property: (".sidebar", {"clientWidth": "200"}) + +// Checks that all.html and index.html have their sidebar link in the same place. +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" +store-property: (index_sidebar_width, ".sidebar .location a", "clientWidth") +store-property: (index_sidebar_height, ".sidebar .location a", "clientHeight") +store-property: (index_sidebar_x, ".sidebar .location a", "offsetTop") +store-property: (index_sidebar_y, ".sidebar .location a", "offsetLeft") +go-to: "file://" + |DOC_PATH| + "/test_docs/all.html" +assert-property: (".sidebar .location a", { + "clientWidth": |index_sidebar_width|, + "clientHeight": |index_sidebar_height|, + "offsetTop": |index_sidebar_x|, + "offsetLeft": |index_sidebar_y|, +}) diff --git a/tests/rustdoc-gui/source-anchor-scroll.goml b/tests/rustdoc-gui/source-anchor-scroll.goml index ddfe0c3d1..3d88d5619 100644 --- a/tests/rustdoc-gui/source-anchor-scroll.goml +++ b/tests/rustdoc-gui/source-anchor-scroll.goml @@ -1,9 +1,9 @@ // We check that when the anchor changes and is output of the displayed content, // the page is scrolled to it. -goto: "file://" + |DOC_PATH| + "/src/link_to_definition/lib.rs.html" +go-to: "file://" + |DOC_PATH| + "/src/link_to_definition/lib.rs.html" // We reduce the window size to make it easier to make an element "out of the page". -size: (600, 800) +set-window-size: (600, 800) // We check that the scroll is at the top first. assert-property: ("html", {"scrollTop": "0"}) diff --git a/tests/rustdoc-gui/source-code-page-code-scroll.goml b/tests/rustdoc-gui/source-code-page-code-scroll.goml new file mode 100644 index 000000000..35f338ea3 --- /dev/null +++ b/tests/rustdoc-gui/source-code-page-code-scroll.goml @@ -0,0 +1,8 @@ +// Checks that the scrollbar is visible on the page rather than the code block. +go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" +set-window-size: (800, 1000) +// "scrollWidth" should be superior than "clientWidth". +assert-property: ("body", {"scrollWidth": 1047, "clientWidth": 800}) + +// Both properties should be equal (ie, no scroll on the code block). +assert-property: (".example-wrap .rust", {"scrollWidth": 933, "clientWidth": 933}) diff --git a/tests/rustdoc-gui/source-code-page.goml b/tests/rustdoc-gui/source-code-page.goml index 7c35119e6..42f3200e9 100644 --- a/tests/rustdoc-gui/source-code-page.goml +++ b/tests/rustdoc-gui/source-code-page.goml @@ -1,5 +1,5 @@ // Checks that the interactions with the source code pages are working as expected. -goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" +go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" show-text: true // Check that we can click on the line number. click: ".src-line-numbers > a:nth-child(4)" // This is the anchor for line 4. @@ -12,7 +12,7 @@ reload: assert-attribute: ("//*[@id='4']", {"class": "line-highlighted"}) assert-css: ("//*[@id='4']", {"border-right-width": "0px"}) // We now check that the good anchors are highlighted -goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html#4-6" +go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html#4-6" assert-attribute-false: (".src-line-numbers > a:nth-child(3)", {"class": "line-highlighted"}) assert-attribute: (".src-line-numbers > a:nth-child(4)", {"class": "line-highlighted"}) assert-attribute: (".src-line-numbers > a:nth-child(5)", {"class": "line-highlighted"}) @@ -23,7 +23,7 @@ define-function: ( "check-colors", (theme, color, background_color, highlight_color, highlight_background_color), block { - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: assert-css: ( ".src-line-numbers > a:not(.line-highlighted)", @@ -87,7 +87,7 @@ assert-css: (".src-line-numbers", {"text-align": "right"}) // Now let's check that clicking on something else than the line number doesn't // do anything (and certainly not add a `#NaN` to the URL!). -goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" +go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" // We use this assert-position to know where we will click. assert-position: ("//*[@id='1']", {"x": 88, "y": 112}) // We click on the left of the "1" anchor but still in the "src-line-number" `<pre>`. @@ -102,7 +102,7 @@ assert: ".source-sidebar-expanded" // We check that the first entry of the sidebar is collapsed assert-property: ("#source-sidebar details:first-of-type", {"open": "false"}) -assert-text: ("#source-sidebar details:first-of-type > summary", "http") +assert-text: ("#source-sidebar details:first-of-type > summary", "extend_css") // We now click on it. click: "#source-sidebar details:first-of-type > summary" assert-property: ("#source-sidebar details:first-of-type", {"open": "true"}) @@ -175,7 +175,7 @@ assert-property: ("#main-content", {"offsetTop": 90}) // 28 = 90 - 34 - 28 // Now do the same check on moderately-sized, tablet mobile. -size: (700, 700) +set-window-size: (700, 700) assert-css: ("nav.sub", {"flex-direction": "row"}) assert-property: ("nav.sub form", {"offsetTop": 21, "offsetHeight": 34}) assert-property: ("#main-content", {"offsetTop": 76}) @@ -198,7 +198,7 @@ call-function: ("check-sidebar-dir-entry", { }) // Tiny, phone mobile gets a different display where the logo is stacked on top. -size: (450, 700) +set-window-size: (450, 700) assert-css: ("nav.sub", {"flex-direction": "column"}) // Check the sidebar directory entries have a marker and spacing (phone). @@ -216,3 +216,8 @@ call-function: ("check-sidebar-dir-entry", { "x": 0, "y": |source_sidebar_title_y| + |source_sidebar_title_height| + 6, }) + +// Now we check that the logo has a bottom margin so it's not stuck to the search input. +assert-css: (".sub-logo-container > img", {"margin-bottom": "8px"}) +store-property: (logo_height, ".sub-logo-container", "clientHeight") +assert-position: (".search-form", {"y": |logo_height| + 8}) diff --git a/tests/rustdoc-gui/src-font-size.goml b/tests/rustdoc-gui/src-font-size.goml index bab66dae7..790aeba52 100644 --- a/tests/rustdoc-gui/src-font-size.goml +++ b/tests/rustdoc-gui/src-font-size.goml @@ -1,7 +1,7 @@ // This test ensures that the "[src]" have the same font size as their headers // to avoid having some weird height difference in the background when the element // is selected. -goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" show-text: true // Check the impl headers. assert-css: (".impl .srclink", {"font-size": "16px", "font-weight": 400}, ALL) diff --git a/tests/rustdoc-gui/src/extend_css/Cargo.lock b/tests/rustdoc-gui/src/extend_css/Cargo.lock new file mode 100644 index 000000000..7101a6f0f --- /dev/null +++ b/tests/rustdoc-gui/src/extend_css/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "extend_css" +version = "0.1.0" diff --git a/tests/rustdoc-gui/src/extend_css/Cargo.toml b/tests/rustdoc-gui/src/extend_css/Cargo.toml new file mode 100644 index 000000000..91683fe89 --- /dev/null +++ b/tests/rustdoc-gui/src/extend_css/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "extend_css" +version = "0.1.0" +edition = "2018" + +[lib] +path = "lib.rs" diff --git a/tests/rustdoc-gui/src/extend_css/extra.css b/tests/rustdoc-gui/src/extend_css/extra.css new file mode 100644 index 000000000..ee7062d96 --- /dev/null +++ b/tests/rustdoc-gui/src/extend_css/extra.css @@ -0,0 +1,3 @@ +.extend { + color: red !important; +} diff --git a/tests/rustdoc-gui/src/extend_css/lib.rs b/tests/rustdoc-gui/src/extend_css/lib.rs new file mode 100644 index 000000000..3a3babf89 --- /dev/null +++ b/tests/rustdoc-gui/src/extend_css/lib.rs @@ -0,0 +1 @@ +//! <div class="extend">text in red</div> diff --git a/tests/rustdoc-gui/stab-badge.goml b/tests/rustdoc-gui/stab-badge.goml index 50ba1ba62..e23404188 100644 --- a/tests/rustdoc-gui/stab-badge.goml +++ b/tests/rustdoc-gui/stab-badge.goml @@ -1,12 +1,12 @@ // All stability badges should have rounded corners and colored backgrounds. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" show-text: true define-function: ( "check-badge", (theme, background, color), block { - local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": |theme|} - goto: "file://" + |DOC_PATH| + "/test_docs/index.html" + set-local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": |theme|} + go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" assert: ".docblock .stab" assert: ".item-table .stab" assert-css: (".stab", { @@ -14,7 +14,7 @@ define-function: ( "color": |color|, "background-color": |background|, }) - goto: "file://" + |DOC_PATH| + "/test_docs/fn.replaced_function.html" + go-to: "file://" + |DOC_PATH| + "/test_docs/fn.replaced_function.html" assert: (".item-info .stab") assert-css: (".stab", { "border-radius": "3px", diff --git a/tests/rustdoc-gui/struct-fields.goml b/tests/rustdoc-gui/struct-fields.goml index fa3e16cb8..da0467de1 100644 --- a/tests/rustdoc-gui/struct-fields.goml +++ b/tests/rustdoc-gui/struct-fields.goml @@ -1,5 +1,5 @@ // This test ensures that each field is on its own line (In other words, they have display: block). -goto: "file://" + |DOC_PATH| + "/test_docs/struct.StructWithPublicUndocumentedFields.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.StructWithPublicUndocumentedFields.html" store-property: (first_top, "//*[@id='structfield.first']", "offsetTop") assert-property-false: ("//*[@id='structfield.second']", { "offsetTop": |first_top| }) diff --git a/tests/rustdoc-gui/target.goml b/tests/rustdoc-gui/target.goml index ca393ee58..0c514fc68 100644 --- a/tests/rustdoc-gui/target.goml +++ b/tests/rustdoc-gui/target.goml @@ -1,5 +1,5 @@ // Check that the targetted element has the expected styles. -goto: "file://" + |DOC_PATH| + "/lib2/struct.Foo.html#method.a_method" +go-to: "file://" + |DOC_PATH| + "/lib2/struct.Foo.html#method.a_method" show-text: true // Confirming that the method is the target. @@ -9,7 +9,7 @@ define-function: ( "check-style", (theme, background, border), block { - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: assert-css: ("#method\.a_method:target", { "background-color": |background|, diff --git a/tests/rustdoc-gui/theme-change.goml b/tests/rustdoc-gui/theme-change.goml index 31c9d99aa..ae6947213 100644 --- a/tests/rustdoc-gui/theme-change.goml +++ b/tests/rustdoc-gui/theme-change.goml @@ -1,6 +1,6 @@ // Ensures that the theme change is working as expected. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" -local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": "dark"} +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" +set-local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": "dark"} reload: store-value: (background_light, "rgb(255, 255, 255)") @@ -22,11 +22,11 @@ click: "#theme-dark" wait-for-css: ("body", { "background-color": |background_dark| }) assert-local-storage: { "rustdoc-theme": "dark" } -local-storage: { +set-local-storage: { "rustdoc-preferred-light-theme": "light", "rustdoc-preferred-dark-theme": "light", } -goto: "file://" + |DOC_PATH| + "/settings.html" +go-to: "file://" + |DOC_PATH| + "/settings.html" wait-for: "#settings" click: "#theme-light" diff --git a/tests/rustdoc-gui/theme-defaults.goml b/tests/rustdoc-gui/theme-defaults.goml new file mode 100644 index 000000000..2cc5d716c --- /dev/null +++ b/tests/rustdoc-gui/theme-defaults.goml @@ -0,0 +1,24 @@ +// Ensure that the theme picker always starts with the actual defaults. +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" +click: "#settings-menu" +wait-for: "#theme-system-preference" +assert: "#theme-system-preference:checked" +assert: "#preferred-light-theme-light:checked" +assert: "#preferred-dark-theme-dark:checked" +assert-false: "#preferred-dark-theme-ayu:checked" + +// Test legacy migration from old theme setup without system-preference matching. +// See https://github.com/rust-lang/rust/pull/77809#issuecomment-707875732 +set-local-storage: { + "rustdoc-preferred-light-theme": null, + "rustdoc-preferred-dark-theme": null, + "rustdoc-use-system-theme": null, + "rustdoc-theme": "ayu" +} +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" +click: "#settings-menu" +wait-for: "#theme-system-preference" +assert: "#theme-system-preference:checked" +assert: "#preferred-light-theme-light:checked" +assert-false: "#preferred-dark-theme-dark:checked" +assert: "#preferred-dark-theme-ayu:checked" diff --git a/tests/rustdoc-gui/theme-in-history.goml b/tests/rustdoc-gui/theme-in-history.goml index 10508e86a..8fcd0ecd3 100644 --- a/tests/rustdoc-gui/theme-in-history.goml +++ b/tests/rustdoc-gui/theme-in-history.goml @@ -1,7 +1,7 @@ // Ensures that the theme is working when going back in history. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" // Set the theme to dark. -local-storage: { +set-local-storage: { "rustdoc-theme": "dark", "rustdoc-use-system-theme": "false", } @@ -11,7 +11,7 @@ assert-css: ("body", { "background-color": "rgb(53, 53, 53)" }) assert-local-storage: { "rustdoc-theme": "dark" } // Now we go to the settings page. -goto: "file://" + |DOC_PATH| + "/settings.html" +go-to: "file://" + |DOC_PATH| + "/settings.html" wait-for: "#settings" // We change the theme to "light". click: "#theme-light" diff --git a/tests/rustdoc-gui/toggle-click-deadspace.goml b/tests/rustdoc-gui/toggle-click-deadspace.goml index ac346f25b..f115f63ab 100644 --- a/tests/rustdoc-gui/toggle-click-deadspace.goml +++ b/tests/rustdoc-gui/toggle-click-deadspace.goml @@ -1,6 +1,6 @@ // This test ensures that clicking on a method summary, but not on the "[-]", // doesn't toggle the <details>. -goto: "file://" + |DOC_PATH| + "/lib2/struct.Foo.html" +go-to: "file://" + |DOC_PATH| + "/lib2/struct.Foo.html" assert-attribute: (".impl-items .toggle", {"open": ""}) click: "h4.code-header" // This is the position of "pub" in "pub fn a_method" assert-attribute: (".impl-items .toggle", {"open": ""}) diff --git a/tests/rustdoc-gui/toggle-docs-mobile.goml b/tests/rustdoc-gui/toggle-docs-mobile.goml index 6ce24a81b..b69aa6e30 100644 --- a/tests/rustdoc-gui/toggle-docs-mobile.goml +++ b/tests/rustdoc-gui/toggle-docs-mobile.goml @@ -1,7 +1,7 @@ // Checks that the documentation toggles on mobile have the correct position, style and work // as expected. -goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" -size: (433, 600) +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" +set-window-size: (433, 600) assert-attribute: (".top-doc", {"open": ""}) click: (4, 270) // This is the position of the top doc comment toggle assert-attribute-false: (".top-doc", {"open": ""}) @@ -22,7 +22,7 @@ assert-position: ( ) // Now we do the same but with a little bigger width -size: (600, 600) +set-window-size: (600, 600) assert-attribute: (".top-doc", {"open": ""}) click: (4, 270) // New Y position since all search elements are back on one line. assert-attribute-false: (".top-doc", {"open": ""}) diff --git a/tests/rustdoc-gui/toggle-docs.goml b/tests/rustdoc-gui/toggle-docs.goml index c9d236e9b..9ea6d9b18 100644 --- a/tests/rustdoc-gui/toggle-docs.goml +++ b/tests/rustdoc-gui/toggle-docs.goml @@ -1,5 +1,5 @@ // Checks that the documentation toggles have the correct position, style and work as expected. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" assert-attribute: ("#main-content > details.top-doc", {"open": ""}) assert-text: ("#toggle-all-docs", "[−]") click: "#toggle-all-docs" @@ -17,7 +17,7 @@ wait-for-attribute: ("#main-content > details.top-doc", {"open": ""}) assert-text: ("#toggle-all-docs", "[−]") // Check that it works on non-module pages as well. -goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" // We first check that everything is visible. assert-text: ("#toggle-all-docs", "[−]") assert-attribute: ("#implementations-list details.toggle", {"open": ""}, ALL) @@ -52,7 +52,7 @@ define-function: ( (theme, filter), block { // Setting the theme. - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} // We reload the page so the local storage settings are being used. reload: diff --git a/tests/rustdoc-gui/toggle-implementors.goml b/tests/rustdoc-gui/toggle-implementors.goml index 8ff5b91af..c4056275d 100644 --- a/tests/rustdoc-gui/toggle-implementors.goml +++ b/tests/rustdoc-gui/toggle-implementors.goml @@ -1,4 +1,4 @@ // This test ensures that the implementors toggle are not open by default. -goto: "file://" + |DOC_PATH| + "/implementors/trait.Whatever.html" +go-to: "file://" + |DOC_PATH| + "/implementors/trait.Whatever.html" assert-attribute-false: ("#implementors-list > details", {"open": ""}, ALL) diff --git a/tests/rustdoc-gui/toggled-open-implementations.goml b/tests/rustdoc-gui/toggled-open-implementations.goml index 000293b55..238205dd4 100644 --- a/tests/rustdoc-gui/toggled-open-implementations.goml +++ b/tests/rustdoc-gui/toggled-open-implementations.goml @@ -1,5 +1,5 @@ // This tests that the "implementations" section on struct/enum pages // has all the implementations toggled open by default, so users can // find method names in those implementations with Ctrl-F. -goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" assert-attribute: (".toggle.implementors-toggle", {"open": ""}) diff --git a/tests/rustdoc-gui/trait-sidebar-item-order.goml b/tests/rustdoc-gui/trait-sidebar-item-order.goml index e5d023544..9330ef040 100644 --- a/tests/rustdoc-gui/trait-sidebar-item-order.goml +++ b/tests/rustdoc-gui/trait-sidebar-item-order.goml @@ -4,7 +4,7 @@ // doesn't exist. fail-on-request-error: false -goto: "file://" + |DOC_PATH| + "/test_docs/trait.AnotherOne.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/trait.AnotherOne.html" assert-text: (".sidebar-elems section .block li:nth-of-type(1) > a", "another") assert-text: (".sidebar-elems section .block li:nth-of-type(2) > a", "func1") assert-text: (".sidebar-elems section .block li:nth-of-type(3) > a", "func2") diff --git a/tests/rustdoc-gui/type-declation-overflow.goml b/tests/rustdoc-gui/type-declation-overflow.goml index 708e9dca0..e8e42e400 100644 --- a/tests/rustdoc-gui/type-declation-overflow.goml +++ b/tests/rustdoc-gui/type-declation-overflow.goml @@ -6,20 +6,20 @@ // doesn't exist. fail-on-request-error: false -goto: "file://" + |DOC_PATH| + "/lib2/long_trait/trait.ALongNameBecauseItHelpsTestingTheCurrentProblem.html" +go-to: "file://" + |DOC_PATH| + "/lib2/long_trait/trait.ALongNameBecauseItHelpsTestingTheCurrentProblem.html" // We set a fixed size so there is no chance of "random" resize. -size: (1100, 800) +set-window-size: (1100, 800) // Logically, the <body> scroll width should be the width of the window. assert-property: ("body", {"scrollWidth": "1100"}) // However, since there is overflow in the type declaration, its scroll width is bigger. assert-property: ("pre.item-decl", {"scrollWidth": "1324"}) // In the table-ish view on the module index, the name should not be wrapped more than necessary. -goto: "file://" + |DOC_PATH| + "/lib2/too_long/index.html" +go-to: "file://" + |DOC_PATH| + "/lib2/too_long/index.html" assert-property: (".item-table .struct", {"offsetWidth": "684"}) // We now make the same check on type declaration... -goto: "file://" + |DOC_PATH| + "/lib2/too_long/type.ReallyLongTypeNameLongLongLong.html" +go-to: "file://" + |DOC_PATH| + "/lib2/too_long/type.ReallyLongTypeNameLongLongLong.html" assert-property: ("body", {"scrollWidth": "1100"}) // We now check that the section width hasn't grown because of it. assert-property: ("#main-content", {"scrollWidth": "840"}) @@ -28,7 +28,7 @@ assert-property: ("pre.item-decl", {"scrollWidth": "1103"}) // ... and constant. // On a sidenote, it also checks that the (very) long title isn't changing the docblock width. -goto: "file://" + |DOC_PATH| + "/lib2/too_long/constant.ReallyLongTypeNameLongLongLongConstBecauseWhyNotAConstRightGigaGigaSupraLong.html" +go-to: "file://" + |DOC_PATH| + "/lib2/too_long/constant.ReallyLongTypeNameLongLongLongConstBecauseWhyNotAConstRightGigaGigaSupraLong.html" assert-property: ("body", {"scrollWidth": "1100"}) // We now check that the section width hasn't grown because of it. assert-property: ("#main-content", {"scrollWidth": "840"}) @@ -36,8 +36,8 @@ assert-property: ("#main-content", {"scrollWidth": "840"}) assert-property: ("pre.item-decl", {"scrollWidth": "950"}) // On mobile: -size: (600, 600) -goto: "file://" + |DOC_PATH| + "/lib2/too_long/struct.SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName.html" +set-window-size: (600, 600) +go-to: "file://" + |DOC_PATH| + "/lib2/too_long/struct.SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName.html" // It shouldn't have an overflow in the topbar either. store-property: (scrollWidth, ".mobile-topbar h2", "scrollWidth") assert-property: (".mobile-topbar h2", {"clientWidth": |scrollWidth|}) @@ -45,24 +45,24 @@ assert-css: (".mobile-topbar h2", {"overflow-x": "hidden"}) // Check wrapping for top main-heading h1 and out-of-band. // On desktop, they wrap when too big. -size: (1100, 800) -goto: "file://" + |DOC_PATH| + "/lib2/too_long/struct.SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName.html" +set-window-size: (1100, 800) +go-to: "file://" + |DOC_PATH| + "/lib2/too_long/struct.SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName.html" compare-elements-position-false: (".main-heading h1", ".main-heading .out-of-band", ("y")) -goto: "file://" + |DOC_PATH| + "/lib2/index.html" +go-to: "file://" + |DOC_PATH| + "/lib2/index.html" compare-elements-position: (".main-heading h1", ".main-heading .out-of-band", ("y")) // make sure there is a gap between them compare-elements-position-near-false: (".main-heading h1", ".main-heading .out-of-band", {"x": 550}) // On mobile, they always wrap. -size: (600, 600) -goto: "file://" + |DOC_PATH| + "/lib2/too_long/struct.SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName.html" +set-window-size: (600, 600) +go-to: "file://" + |DOC_PATH| + "/lib2/too_long/struct.SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName.html" compare-elements-position-false: (".main-heading h1", ".main-heading .out-of-band", ("y")) -goto: "file://" + |DOC_PATH| + "/lib2/index.html" +go-to: "file://" + |DOC_PATH| + "/lib2/index.html" compare-elements-position-false: (".main-heading h1", ".main-heading .out-of-band", ("y")) // Now we will check that the scrolling is working. // First on an item with "hidden methods". -goto: "file://" + |DOC_PATH| + "/lib2/scroll_traits/trait.Iterator.html" +go-to: "file://" + |DOC_PATH| + "/lib2/scroll_traits/trait.Iterator.html" click: ".item-decl .type-contents-toggle" assert-property: ("pre.item-decl", {"scrollLeft": 0}) @@ -70,7 +70,7 @@ scroll-to: "//*[@class='rust item-decl']//details/a[text()='String']" assert-property-false: ("pre.item-decl", {"scrollLeft": 0}) // Then on an item without "hidden methods". -goto: "file://" + |DOC_PATH| + "/lib2/scroll_traits/trait.TraitWithLongItemsName.html" +go-to: "file://" + |DOC_PATH| + "/lib2/scroll_traits/trait.TraitWithLongItemsName.html" assert-property: ("pre.item-decl", {"scrollLeft": 0}) scroll-to: "//*[@class='rust item-decl']//code/a[text()='String']" assert-property-false: ("pre.item-decl", {"scrollLeft": 0}) diff --git a/tests/rustdoc-gui/unsafe-fn.goml b/tests/rustdoc-gui/unsafe-fn.goml index 9d2577178..51007b653 100644 --- a/tests/rustdoc-gui/unsafe-fn.goml +++ b/tests/rustdoc-gui/unsafe-fn.goml @@ -1,5 +1,5 @@ // Check position and color of the `<sup>` for unsafe elements. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +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 @@ -16,7 +16,7 @@ define-function: ( (theme, color), block { // Set the theme. - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} // We reload the page so the local storage settings are being used. reload: assert-css: (".item-name sup", {"color": |color|}) diff --git a/tests/rustdoc-gui/where-whitespace.goml b/tests/rustdoc-gui/where-whitespace.goml index 41596a9bc..69e6c3356 100644 --- a/tests/rustdoc-gui/where-whitespace.goml +++ b/tests/rustdoc-gui/where-whitespace.goml @@ -1,5 +1,5 @@ // This test ensures that the where conditions are correctly displayed. -goto: "file://" + |DOC_PATH| + "/lib2/trait.Whitespace.html" +go-to: "file://" + |DOC_PATH| + "/lib2/trait.Whitespace.html" show-text: true // First, we check in the trait definition if the where clause is "on its own" (not on the same // line than "pub trait Whitespace<Idx>"). @@ -7,9 +7,9 @@ compare-elements-position-false: (".item-decl code", ".where.fmt-newline", ("y") // And that the code following it isn't on the same line either. compare-elements-position-false: (".item-decl .fn", ".where.fmt-newline", ("y")) -goto: "file://" + |DOC_PATH| + "/lib2/struct.WhereWhitespace.html" +go-to: "file://" + |DOC_PATH| + "/lib2/struct.WhereWhitespace.html" // We make the screen a bit wider to ensure that the trait impl is on one line. -size: (915, 915) +set-window-size: (915, 915) compare-elements-position-false: ("#method\.new .fn", "#method\.new .where.fmt-newline", ("y")) // We ensure that both the trait name and the struct name are on the same line in |