From 98d51960c4c187fd169bbf7bcb66f228f6d39017 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 25 Mar 2022 21:08:59 +0100 Subject: [PATCH 1/2] Update browser-ui-test version to 0.8.4 --- .../docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 fab77af2a1a73..fcbb5375b7e1d 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.8.3 \ No newline at end of file +0.8.4 \ No newline at end of file From e0a697aad445983707a4b61809c1727325635568 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 21 Mar 2022 15:50:05 +0100 Subject: [PATCH 2/2] Replace wait-for instructions for rustdoc GUI tests with wait-for-css --- src/test/rustdoc-gui/default-settings.goml | 4 ++-- src/test/rustdoc-gui/search-filter.goml | 6 ++---- .../rustdoc-gui/search-result-go-to-first.goml | 3 +-- .../rustdoc-gui/sidebar-source-code-display.goml | 6 ++---- src/test/rustdoc-gui/sidebar-source-code.goml | 9 +++------ src/test/rustdoc-gui/theme-change.goml | 15 +++++---------- src/test/rustdoc-gui/theme-in-history.goml | 3 +-- src/test/rustdoc-gui/toggle-docs.goml | 9 +++------ 8 files changed, 19 insertions(+), 36 deletions(-) diff --git a/src/test/rustdoc-gui/default-settings.goml b/src/test/rustdoc-gui/default-settings.goml index 68b674a11f2f5..90f0b087a1b8d 100644 --- a/src/test/rustdoc-gui/default-settings.goml +++ b/src/test/rustdoc-gui/default-settings.goml @@ -4,5 +4,5 @@ // check. goto: file://|DOC_PATH|/settings/index.html // Wait a bit to be sure the default theme is applied. -wait-for: 1000 -assert-css: ("body", {"background-color": "rgb(15, 20, 25)"}) +// If the theme isn't applied, the command will time out. +wait-for-css: ("body", {"background-color": "rgb(15, 20, 25)"}) diff --git a/src/test/rustdoc-gui/search-filter.goml b/src/test/rustdoc-gui/search-filter.goml index 3f78d60f28cdf..aca8390dfb3d5 100644 --- a/src/test/rustdoc-gui/search-filter.goml +++ b/src/test/rustdoc-gui/search-filter.goml @@ -24,11 +24,9 @@ assert-property: ("#crate-search", {"value": "lib2"}) // Now we check that leaving the search results and putting them back keeps the // crate filtering. press-key: "Escape" -wait-for: 100 -assert-css: ("#main-content", {"display": "block"}) +wait-for-css: ("#main-content", {"display": "block"}) focus: ".search-input" -wait-for: 100 -assert-css: ("#main-content", {"display": "none"}) +wait-for-css: ("#main-content", {"display": "none"}) // We check that there is no more "test_docs" appearing. assert-false: "#results .externcrate" assert-property: ("#crate-search", {"value": "lib2"}) diff --git a/src/test/rustdoc-gui/search-result-go-to-first.goml b/src/test/rustdoc-gui/search-result-go-to-first.goml index cadd7f6a3f3b5..255470a3e3590 100644 --- a/src/test/rustdoc-gui/search-result-go-to-first.goml +++ b/src/test/rustdoc-gui/search-result-go-to-first.goml @@ -16,5 +16,4 @@ 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 // Waiting for the page to load... -wait-for: 500 -assert-text: (".fqn .in-band", "Struct test_docs::Foo") +wait-for-text: (".fqn .in-band", "Struct test_docs::Foo") diff --git a/src/test/rustdoc-gui/sidebar-source-code-display.goml b/src/test/rustdoc-gui/sidebar-source-code-display.goml index 27229705a9f3f..377ee9c6eeff3 100644 --- a/src/test/rustdoc-gui/sidebar-source-code-display.goml +++ b/src/test/rustdoc-gui/sidebar-source-code-display.goml @@ -5,8 +5,7 @@ goto: file://|DOC_PATH|/src/test_docs/lib.rs.html assert-false: "#sidebar-toggle" // For some reason, we need to wait a bit here because it seems like the transition on opacity // is being applied whereas it can't be reproduced in a browser... -wait-for: 500 -assert-css: (".sidebar > *", {"visibility": "hidden", "opacity": 0}) +wait-for-css: (".sidebar > *", {"visibility": "hidden", "opacity": 0}) // Let's retry with javascript enabled. javascript: true @@ -17,6 +16,5 @@ assert-css: (".sidebar > *:not(#sidebar-toggle)", {"visibility": "hidden", "opac // Let's expand the sidebar now. click: "#sidebar-toggle" // Because of the transition CSS, better wait a second before checking. -wait-for: 1000 -assert-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1}) +wait-for-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1}) assert-css: (".sidebar > *:not(#sidebar-toggle)", {"visibility": "visible", "opacity": 1}) diff --git a/src/test/rustdoc-gui/sidebar-source-code.goml b/src/test/rustdoc-gui/sidebar-source-code.goml index 0cb8e7763851c..8b4a8bd40dd7e 100644 --- a/src/test/rustdoc-gui/sidebar-source-code.goml +++ b/src/test/rustdoc-gui/sidebar-source-code.goml @@ -7,16 +7,13 @@ size: (1100, 800) assert-css: ("nav.sidebar", {"width": "50px"}) // We now click on the button to expand the sidebar. click: (10, 10) -// We wait for the sidebar to be expanded (there is a 0.5s animation). -wait-for: 600 -assert-css: ("nav.sidebar.expanded", {"width": "300px"}) +// We wait for the sidebar to be expanded. +wait-for-css: ("nav.sidebar.expanded", {"width": "300px"}) assert-css: ("nav.sidebar.expanded a", {"font-size": "14px"}) // We collapse the sidebar. click: (10, 10) -// We wait for the sidebar to be collapsed (there is a 0.5s animation). -wait-for: 600 // We ensure that the class has been removed. -assert-false: "nav.sidebar.expanded" +wait-for: "nav.sidebar:not(.expanded)" assert: "nav.sidebar" // We now switch to mobile mode. diff --git a/src/test/rustdoc-gui/theme-change.goml b/src/test/rustdoc-gui/theme-change.goml index 73edee64e4372..333391ba27970 100644 --- a/src/test/rustdoc-gui/theme-change.goml +++ b/src/test/rustdoc-gui/theme-change.goml @@ -2,26 +2,21 @@ goto: file://|DOC_PATH|/test_docs/index.html click: "#theme-picker" click: "#theme-choices > button:first-child" -wait-for: 500 // should be the ayu theme so let's check the color -assert-css: ("body", { "background-color": "rgb(15, 20, 25)" }) +wait-for-css: ("body", { "background-color": "rgb(15, 20, 25)" }) click: "#theme-choices > button:last-child" -wait-for: 500 // should be the light theme so let's check the color -assert-css: ("body", { "background-color": "rgb(255, 255, 255)" }) +wait-for-css: ("body", { "background-color": "rgb(255, 255, 255)" }) goto: file://|DOC_PATH|/settings.html click: "#theme-light" -wait-for: 500 -assert-css: ("body", { "background-color": "rgb(255, 255, 255)" }) +wait-for-css: ("body", { "background-color": "rgb(255, 255, 255)" }) assert-local-storage: { "rustdoc-theme": "light" } click: "#theme-dark" -wait-for: 500 -assert-css: ("body", { "background-color": "rgb(53, 53, 53)" }) +wait-for-css: ("body", { "background-color": "rgb(53, 53, 53)" }) assert-local-storage: { "rustdoc-theme": "dark" } click: "#theme-ayu" -wait-for: 500 -assert-css: ("body", { "background-color": "rgb(15, 20, 25)" }) +wait-for-css: ("body", { "background-color": "rgb(15, 20, 25)" }) assert-local-storage: { "rustdoc-theme": "ayu" } diff --git a/src/test/rustdoc-gui/theme-in-history.goml b/src/test/rustdoc-gui/theme-in-history.goml index b53799188ef99..3b66c85d8dad2 100644 --- a/src/test/rustdoc-gui/theme-in-history.goml +++ b/src/test/rustdoc-gui/theme-in-history.goml @@ -12,8 +12,7 @@ click: "#settings-menu" wait-for: ".settings" // We change the theme to "light". click: "#theme-light" -wait-for: 250 -assert-css: ("body", { "background-color": "rgb(255, 255, 255)" }) +wait-for-css: ("body", { "background-color": "rgb(255, 255, 255)" }) assert-local-storage: { "rustdoc-theme": "light" } // We go back in history. diff --git a/src/test/rustdoc-gui/toggle-docs.goml b/src/test/rustdoc-gui/toggle-docs.goml index bbc85ecd4ad49..63962b576df47 100644 --- a/src/test/rustdoc-gui/toggle-docs.goml +++ b/src/test/rustdoc-gui/toggle-docs.goml @@ -8,9 +8,8 @@ wait-for: 50 assert-attribute-false: ("#main-content > details.top-doc", {"open": ""}) assert-text: ("#toggle-all-docs", "[+]") click: "#toggle-all-docs" -wait-for: 50 // Not collapsed anymore so the "open" attribute should be back. -assert-attribute: ("#main-content > details.top-doc", {"open": ""}) +wait-for-attribute: ("#main-content > details.top-doc", {"open": ""}) assert-text: ("#toggle-all-docs", "[−]") // Check that it works on non-module pages as well. @@ -27,8 +26,7 @@ assert-attribute-false: ( // We collapse them all. click: "#toggle-all-docs" -wait-for: 50 -assert-text: ("#toggle-all-docs", "[+]") +wait-for-text: ("#toggle-all-docs", "[+]") // We check that all
are collapsed (except for the impl block ones). assert-attribute-false: ("details.rustdoc-toggle:not(.implementors-toggle)", {"open": ""}, ALL) assert-attribute: ("#implementations-list > details.implementors-toggle", {"open": ""}) @@ -40,6 +38,5 @@ assert-attribute-false: ( ) // We open them all again. click: "#toggle-all-docs" -wait-for: 50 -assert-text: ("#toggle-all-docs", "[−]") +wait-for-text: ("#toggle-all-docs", "[−]") assert-attribute: ("details.rustdoc-toggle", {"open": ""}, ALL)