about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-05-11 17:43:09 -0700
committerGitHub <noreply@github.com>2023-05-11 17:43:09 -0700
commiteead6f4703c17882cdd77044ca4a60a7eb2f5ea0 (patch)
tree38e6fea57421f26a5d60eceb00ddcafe42e1f8a1
parent7c31df9d6c7f0baf38c331607dbc51be50d9eb84 (diff)
parent8e55400ec9b7b529ea28b1b152f2c5ad203761a6 (diff)
downloadrust-eead6f4703c17882cdd77044ca4a60a7eb2f5ea0.tar.gz
rust-eead6f4703c17882cdd77044ca4a60a7eb2f5ea0.zip
Rollup merge of #111459 - GuillaumeGomez:update-browser-ui-test, r=notriddle
Update browser-ui-test version to 0.16.0

This new version brings one major improvement: it allows to use the original color format in checks (I plan to slowly continue converting colors back to their "original" format, ie the one used in CSS).

It also provides some improvements in some commands API.

r? `````@notriddle`````
-rw-r--r--src/ci/docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version2
-rw-r--r--src/tools/rustdoc-gui/tester.js3
-rw-r--r--tests/rustdoc-gui/check-stab-in-docblock.goml18
-rw-r--r--tests/rustdoc-gui/codeblock-sub.goml2
-rw-r--r--tests/rustdoc-gui/docblock-details.goml2
-rw-r--r--tests/rustdoc-gui/item-info.goml4
-rw-r--r--tests/rustdoc-gui/notable-trait.goml8
-rw-r--r--tests/rustdoc-gui/scrape-examples-button-focus.goml6
-rw-r--r--tests/rustdoc-gui/scrape-examples-layout.goml7
-rw-r--r--tests/rustdoc-gui/search-result-display.goml4
-rw-r--r--tests/rustdoc-gui/settings.goml2
-rw-r--r--tests/rustdoc-gui/sidebar-source-code-display.goml26
-rw-r--r--tests/rustdoc-gui/sidebar.goml14
-rw-r--r--tests/rustdoc-gui/source-code-page.goml47
-rw-r--r--tests/rustdoc-gui/src-font-size.goml2
-rw-r--r--tests/rustdoc-gui/struct-fields.goml2
-rw-r--r--tests/rustdoc-gui/type-declation-overflow.goml2
17 files changed, 70 insertions, 81 deletions
diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version b/src/ci/docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version
index 7092c7c46f8..d183d4ace05 100644
--- a/src/ci/docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version
+++ b/src/ci/docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version
@@ -1 +1 @@
-0.15.0
\ No newline at end of file
+0.16.0
\ No newline at end of file
diff --git a/src/tools/rustdoc-gui/tester.js b/src/tools/rustdoc-gui/tester.js
index 692d5e3fcef..b26480f668b 100644
--- a/src/tools/rustdoc-gui/tester.js
+++ b/src/tools/rustdoc-gui/tester.js
@@ -143,7 +143,7 @@ async function runTests(opts, framework_options, files, results, status_bar, sho
     const tests_queue = [];
 
     for (const testPath of files) {
-        const callback = runTest(testPath, framework_options)
+        const callback = runTest(testPath, {"options": framework_options})
             .then(out => {
                 const [output, nb_failures] = out;
                 results[nb_failures === 0 ? "successful" : "failed"].push({
@@ -323,6 +323,7 @@ async function main(argv) {
     if (results.failed.length > 0 || results.errored.length > 0) {
         process.exit(1);
     }
+    process.exit(0);
 }
 
 main(process.argv);
diff --git a/tests/rustdoc-gui/check-stab-in-docblock.goml b/tests/rustdoc-gui/check-stab-in-docblock.goml
index 2f62636211b..f25c88690e5 100644
--- a/tests/rustdoc-gui/check-stab-in-docblock.goml
+++ b/tests/rustdoc-gui/check-stab-in-docblock.goml
@@ -7,20 +7,26 @@ set-window-size: (786, 600)
 // Confirms that there 3 paragraphs.
 assert-count: (".top-doc .docblock p", 3)
 // Checking that there is no scrollable content.
-store-property: (clientHeight, ".top-doc .docblock p:nth-of-type(1)", "clientHeight")
-store-property: (clientWidth, ".top-doc .docblock p:nth-of-type(1)", "clientWidth")
+store-property: (".top-doc .docblock p:nth-of-type(1)", {
+    "clientHeight": clientHeight,
+    "clientWidth": clientWidth,
+})
 assert-property: (
     ".top-doc .docblock p:nth-of-type(1)",
     {"scrollHeight": |clientHeight|, "scrollWidth": |clientWidth|},
 )
-store-property: (clientHeight, ".top-doc .docblock p:nth-of-type(2)", "clientHeight")
-store-property: (clientWidth, ".top-doc .docblock p:nth-of-type(2)", "clientWidth")
+store-property: (".top-doc .docblock p:nth-of-type(2)", {
+    "clientHeight": clientHeight,
+    "clientWidth": clientWidth,
+})
 assert-property: (
     ".top-doc .docblock p:nth-of-type(2)",
     {"scrollHeight": |clientHeight|, "scrollWidth": |clientWidth|},
 )
-store-property: (clientHeight, ".top-doc .docblock p:nth-of-type(3)", "clientHeight")
-store-property: (clientWidth, ".top-doc .docblock p:nth-of-type(3)", "clientWidth")
+store-property: (".top-doc .docblock p:nth-of-type(3)", {
+    "clientHeight": clientHeight,
+    "clientWidth": clientWidth,
+})
 assert-property: (
     ".top-doc .docblock p:nth-of-type(3)",
     {"scrollHeight": |clientHeight|, "scrollWidth": |clientWidth|},
diff --git a/tests/rustdoc-gui/codeblock-sub.goml b/tests/rustdoc-gui/codeblock-sub.goml
index 03575cc6aaa..a4b0558765a 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.
 go-to: "file://" + |DOC_PATH| + "/test_docs/codeblock_sub/index.html"
 
-store-property: (codeblock_sub_1, "#codeblock-sub-1", "offsetHeight")
+store-property: ("#codeblock-sub-1", {"offsetHeight": codeblock_sub_1})
 assert-property-false: ("#codeblock-sub-3", { "offsetHeight": |codeblock_sub_1| })
diff --git a/tests/rustdoc-gui/docblock-details.goml b/tests/rustdoc-gui/docblock-details.goml
index 58ff17619f6..8e6d2ba824f 100644
--- a/tests/rustdoc-gui/docblock-details.goml
+++ b/tests/rustdoc-gui/docblock-details.goml
@@ -9,7 +9,7 @@ reload:
 assert-text: (".top-doc .docblock > h3", "Hello")
 assert-css: (
     ".top-doc .docblock > h3",
-    {"border-bottom": "1px solid rgb(210, 210, 210)"},
+    {"border-bottom": "1px solid #d2d2d2"},
 )
 // We now check that the `<summary>` doesn't have a bottom border and has the correct display.
 assert-css: (
diff --git a/tests/rustdoc-gui/item-info.goml b/tests/rustdoc-gui/item-info.goml
index 60fd7c4e198..030ff8f8a3e 100644
--- a/tests/rustdoc-gui/item-info.goml
+++ b/tests/rustdoc-gui/item-info.goml
@@ -4,8 +4,8 @@ go-to: "file://" + |DOC_PATH| + "/lib2/struct.Foo.html"
 // We set a fixed size so there is no chance of "random" resize.
 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-size: (".item-info", {"width": 840})
+assert-size: (".item-info .stab", {"width": 289})
 assert-position: (".item-info .stab", {"x": 245})
 
 // Now we ensure that they're not rendered on the same line.
diff --git a/tests/rustdoc-gui/notable-trait.goml b/tests/rustdoc-gui/notable-trait.goml
index f65da577478..ecb57c274a5 100644
--- a/tests/rustdoc-gui/notable-trait.goml
+++ b/tests/rustdoc-gui/notable-trait.goml
@@ -225,12 +225,12 @@ assert: "#method\.create_an_iterator_from_read .tooltip:focus"
 
 // Now we check that the focus isn't given back to the wrong item when opening
 // another popover.
-store-window-property: (scroll, "scrollY")
+store-window-property: {"scrollY": scroll}
 click: "#method\.create_an_iterator_from_read .fn"
 // We ensure that the scroll position changed.
 assert-window-property-false: {"scrollY": |scroll|}
 // Store the new position.
-store-window-property: (scroll, "scrollY")
+store-window-property: {"scrollY": scroll}
 click: "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']"
 wait-for: "//*[@class='tooltip popover']"
 click: "#settings-menu a"
@@ -239,12 +239,12 @@ click: ".search-input"
 assert-window-property-false: {"scrollY": |scroll|}
 
 // Same but with Escape handling.
-store-window-property: (scroll, "scrollY")
+store-window-property: {"scrollY": scroll}
 click: "#method\.create_an_iterator_from_read .fn"
 // We ensure that the scroll position changed.
 assert-window-property-false: {"scrollY": |scroll|}
 // Store the new position.
-store-window-property: (scroll, "scrollY")
+store-window-property: {"scrollY": scroll}
 click: "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']"
 wait-for: "//*[@class='tooltip popover']"
 click: "#settings-menu a"
diff --git a/tests/rustdoc-gui/scrape-examples-button-focus.goml b/tests/rustdoc-gui/scrape-examples-button-focus.goml
index 77061ea2a3f..af4293dfc00 100644
--- a/tests/rustdoc-gui/scrape-examples-button-focus.goml
+++ b/tests/rustdoc-gui/scrape-examples-button-focus.goml
@@ -3,7 +3,7 @@
 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")
+store-property: (".scraped-example-list > .scraped-example pre", {"scrollTop": initialScrollTop})
 focus: ".scraped-example-list > .scraped-example .next"
 press-key: "Enter"
 assert-property-false: (".scraped-example-list > .scraped-example pre", {
@@ -16,7 +16,7 @@ assert-property: (".scraped-example-list > .scraped-example pre", {
 }, NEAR)
 
 // The expand button increases the scrollHeight of the minimized code viewport
-store-property: (smallOffsetHeight, ".scraped-example-list > .scraped-example pre", "offsetHeight")
+store-property: (".scraped-example-list > .scraped-example pre", {"offsetHeight": smallOffsetHeight})
 assert-property-false: (".scraped-example-list > .scraped-example pre", {
     "scrollHeight": |smallOffsetHeight|
 }, NEAR)
@@ -25,7 +25,7 @@ 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")
+store-property: (".scraped-example-list > .scraped-example pre", {"offsetHeight": fullOffsetHeight})
 assert-property: (".scraped-example-list > .scraped-example pre", {
     "scrollHeight": |fullOffsetHeight|
 }, NEAR)
diff --git a/tests/rustdoc-gui/scrape-examples-layout.goml b/tests/rustdoc-gui/scrape-examples-layout.goml
index 160056d6d05..4fc1c1ac065 100644
--- a/tests/rustdoc-gui/scrape-examples-layout.goml
+++ b/tests/rustdoc-gui/scrape-examples-layout.goml
@@ -9,9 +9,8 @@ assert-property-false: (
 
 // Check that examples with very long lines have the same width as ones that don't.
 store-property: (
-    clientWidth,
     ".more-scraped-examples .scraped-example:nth-child(2) .code-wrapper .src-line-numbers",
-    "clientWidth"
+    {"clientWidth": clientWidth},
 )
 
 assert-property: (
@@ -40,8 +39,8 @@ assert-property: (
 store-value: (offset_y, 4)
 
 // First with desktop
-assert-position: (".scraped-example .code-wrapper", {"y": 253})
-assert-position: (".scraped-example .code-wrapper .prev", {"y": 253 + |offset_y|})
+assert-position: (".scraped-example .code-wrapper", {"y": 226})
+assert-position: (".scraped-example .code-wrapper .prev", {"y": 226 + |offset_y|})
 
 // Then with mobile
 set-window-size: (600, 600)
diff --git a/tests/rustdoc-gui/search-result-display.goml b/tests/rustdoc-gui/search-result-display.goml
index 93c71f23f24..ee5598e4b21 100644
--- a/tests/rustdoc-gui/search-result-display.goml
+++ b/tests/rustdoc-gui/search-result-display.goml
@@ -32,8 +32,8 @@ set-text: (
 )
 
 // Then we compare again to confirm the height didn't change.
-assert-css: ("#crate-search", {"width": "527px"})
-assert-css: (".search-results-title", {"height": "50px", "width": "640px"})
+assert-size: ("#crate-search", {"width": 527})
+assert-size: (".search-results-title", {"height": 50, "width": 640})
 // And we check that the `<select>` isn't bigger than its container (".search-results-title").
 assert-css: ("#search", {"width": "640px"})
 
diff --git a/tests/rustdoc-gui/settings.goml b/tests/rustdoc-gui/settings.goml
index a44ff9d3e4a..bf1fe7be910 100644
--- a/tests/rustdoc-gui/settings.goml
+++ b/tests/rustdoc-gui/settings.goml
@@ -10,7 +10,7 @@ wait-for: "#settings"
 assert-css: ("#settings", {"display": "block"})
 
 // Store the line margin to compare with the settings.html later.
-store-css: (setting_line_margin, ".setting-line", "margin")
+store-css: (".setting-line", {"margin": setting_line_margin})
 
 // Let's close it by clicking on the same button.
 click: "#settings-menu"
diff --git a/tests/rustdoc-gui/sidebar-source-code-display.goml b/tests/rustdoc-gui/sidebar-source-code-display.goml
index 20bf0596f95..0c680bcc9fb 100644
--- a/tests/rustdoc-gui/sidebar-source-code-display.goml
+++ b/tests/rustdoc-gui/sidebar-source-code-display.goml
@@ -121,28 +121,28 @@ define-function: (
 
 call-function: ("check-colors", {
     "theme": "light",
-    "color": "rgb(0, 0, 0)",
-    "color_hover": "rgb(0, 0, 0)",
-    "background": "rgb(255, 255, 255)",
-    "background_hover": "rgb(224, 224, 224)",
+    "color": "black",
+    "color_hover": "#000",
+    "background": "#fff",
+    "background_hover": "#e0e0e0",
     "background_toggle": "rgba(0, 0, 0, 0)",
-    "background_toggle_hover": "rgb(224, 224, 224)",
+    "background_toggle_hover": "#e0e0e0",
 })
 call-function: ("check-colors", {
     "theme": "dark",
-    "color": "rgb(221, 221, 221)",
-    "color_hover": "rgb(221, 221, 221)",
-    "background": "rgb(51, 51, 51)",
-    "background_hover": "rgb(68, 68, 68)",
+    "color": "#ddd",
+    "color_hover": "#ddd",
+    "background": "#333",
+    "background_hover": "#444",
     "background_toggle": "rgba(0, 0, 0, 0)",
-    "background_toggle_hover": "rgb(103, 103, 103)",
+    "background_toggle_hover": "#676767",
 })
 call-function: ("check-colors", {
     "theme": "ayu",
-    "color": "rgb(197, 197, 197)",
-    "color_hover": "rgb(255, 180, 76)",
+    "color": "#c5c5c5",
+    "color_hover": "#ffb44c",
     "background": "rgb(20, 25, 31)",
-    "background_hover": "rgb(20, 25, 31)",
+    "background_hover": "#14191f",
     "background_toggle": "rgba(0, 0, 0, 0)",
     "background_toggle_hover": "rgba(70, 70, 70, 0.33)",
 })
diff --git a/tests/rustdoc-gui/sidebar.goml b/tests/rustdoc-gui/sidebar.goml
index 3c1ed009a33..574cc629a04 100644
--- a/tests/rustdoc-gui/sidebar.goml
+++ b/tests/rustdoc-gui/sidebar.goml
@@ -152,14 +152,16 @@ 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")
+store-property: (".sidebar .location a", {
+    "clientWidth": index_sidebar_width,
+    "clientHeight": index_sidebar_height,
+    "offsetTop": index_sidebar_y,
+    "offsetLeft": index_sidebar_x,
+})
 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|,
+    "offsetTop": |index_sidebar_y|,
+    "offsetLeft": |index_sidebar_x|,
 })
diff --git a/tests/rustdoc-gui/source-code-page.goml b/tests/rustdoc-gui/source-code-page.goml
index 42f3200e967..5c795928bdc 100644
--- a/tests/rustdoc-gui/source-code-page.goml
+++ b/tests/rustdoc-gui/source-code-page.goml
@@ -117,9 +117,8 @@ assert-property: ("#source-sidebar details:first-of-type", {"open": "true"})
 
 // Check the sidebar directory entries have a marker and spacing (desktop).
 store-property: (
-    link_height,
     "#source-sidebar > details:first-of-type.dir-entry[open] > .files > a",
-    "offsetHeight"
+    {"offsetHeight": link_height},
 )
 define-function: (
     "check-sidebar-dir-entry",
@@ -147,16 +146,10 @@ define-function: (
         )
     }
 )
-store-property: (
-    source_sidebar_title_height,
-    "#source-sidebar > .title",
-    "offsetHeight"
-)
-store-property: (
-    source_sidebar_title_y,
-    "#source-sidebar > .title",
-    "offsetTop"
-)
+store-property: ("#source-sidebar > .title", {
+    "offsetHeight": source_sidebar_title_height,
+    "offsetTop": source_sidebar_title_y,
+})
 call-function: ("check-sidebar-dir-entry", {
     "x": 0,
     // border + margin = 6
@@ -182,16 +175,10 @@ assert-property: ("#main-content", {"offsetTop": 76})
 // 21 = 76 - 34 - 21
 
 // Check the sidebar directory entries have a marker and spacing (tablet).
-store-property: (
-    source_sidebar_title_height,
-    "#source-sidebar > .title",
-    "offsetHeight"
-)
-store-property: (
-    source_sidebar_title_y,
-    "#source-sidebar > .title",
-    "offsetTop"
-)
+store-property: ("#source-sidebar > .title", {
+    "offsetHeight": source_sidebar_title_height,
+    "offsetTop": source_sidebar_title_y,
+})
 call-function: ("check-sidebar-dir-entry", {
     "x": 0,
     "y": |source_sidebar_title_y| + |source_sidebar_title_height| + 6,
@@ -202,16 +189,10 @@ set-window-size: (450, 700)
 assert-css: ("nav.sub", {"flex-direction": "column"})
 
 // Check the sidebar directory entries have a marker and spacing (phone).
-store-property: (
-    source_sidebar_title_height,
-    "#source-sidebar > .title",
-    "offsetHeight"
-)
-store-property: (
-    source_sidebar_title_y,
-    "#source-sidebar > .title",
-    "offsetTop"
-)
+store-property: ("#source-sidebar > .title", {
+    "offsetHeight": source_sidebar_title_height,
+    "offsetTop": source_sidebar_title_y,
+})
 call-function: ("check-sidebar-dir-entry", {
     "x": 0,
     "y": |source_sidebar_title_y| + |source_sidebar_title_height| + 6,
@@ -219,5 +200,5 @@ call-function: ("check-sidebar-dir-entry", {
 
 // 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")
+store-property: (".sub-logo-container", {"clientHeight": logo_height})
 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 790aeba529c..ff30bcdf2a2 100644
--- a/tests/rustdoc-gui/src-font-size.goml
+++ b/tests/rustdoc-gui/src-font-size.goml
@@ -11,6 +11,6 @@ assert-css: (".impl-items .srclink", {"font-size": "16px", "font-weight": 400},
 assert-css: (".impl-items .code-header", {"font-size": "16px", "font-weight": 600}, ALL)
 
 // Check that we can click on source link
-store-document-property: (url, "URL")
+store-document-property: {"URL": url}
 click: ".impl-items .srclink"
 assert-document-property-false: {"URL": |url|}
diff --git a/tests/rustdoc-gui/struct-fields.goml b/tests/rustdoc-gui/struct-fields.goml
index da0467de13a..3c87a4cd654 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).
 go-to: "file://" + |DOC_PATH| + "/test_docs/struct.StructWithPublicUndocumentedFields.html"
 
-store-property: (first_top, "//*[@id='structfield.first']", "offsetTop")
+store-property: ("//*[@id='structfield.first']", {"offsetTop": first_top})
 assert-property-false: ("//*[@id='structfield.second']", { "offsetTop": |first_top| })
diff --git a/tests/rustdoc-gui/type-declation-overflow.goml b/tests/rustdoc-gui/type-declation-overflow.goml
index e8e42e4004b..f212781e9b3 100644
--- a/tests/rustdoc-gui/type-declation-overflow.goml
+++ b/tests/rustdoc-gui/type-declation-overflow.goml
@@ -39,7 +39,7 @@ assert-property: ("pre.item-decl", {"scrollWidth": "950"})
 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")
+store-property: (".mobile-topbar h2", {"scrollWidth": scrollWidth})
 assert-property: (".mobile-topbar h2", {"clientWidth": |scrollWidth|})
 assert-css: (".mobile-topbar h2", {"overflow-x": "hidden"})