Auto merge of #95172 - GuillaumeGomez:reduce-wait-for, r=notriddle

Reduce wait-for instructions for rustdoc GUI tests

r? `@notriddle`
This commit is contained in:
bors 2022-03-25 22:16:44 +00:00
commit a2ebd5a1f1
9 changed files with 20 additions and 37 deletions

View File

@ -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)"})

View File

@ -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"})

View File

@ -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")

View File

@ -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})

View File

@ -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.

View File

@ -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" }

View File

@ -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.

View File

@ -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 <details> 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)