Skip to content

Commit a2ebd5a

Browse files
committed
Auto merge of #95172 - GuillaumeGomez:reduce-wait-for, r=notriddle
Reduce wait-for instructions for rustdoc GUI tests r? `@notriddle`
2 parents d53246f + e0a697a commit a2ebd5a

9 files changed

+20
-37
lines changed
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.8.3
1+
0.8.4

src/test/rustdoc-gui/default-settings.goml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
// check.
55
goto: file://|DOC_PATH|/settings/index.html
66
// Wait a bit to be sure the default theme is applied.
7-
wait-for: 1000
8-
assert-css: ("body", {"background-color": "rgb(15, 20, 25)"})
7+
// If the theme isn't applied, the command will time out.
8+
wait-for-css: ("body", {"background-color": "rgb(15, 20, 25)"})

src/test/rustdoc-gui/search-filter.goml

+2-4
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,9 @@ assert-property: ("#crate-search", {"value": "lib2"})
2424
// Now we check that leaving the search results and putting them back keeps the
2525
// crate filtering.
2626
press-key: "Escape"
27-
wait-for: 100
28-
assert-css: ("#main-content", {"display": "block"})
27+
wait-for-css: ("#main-content", {"display": "block"})
2928
focus: ".search-input"
30-
wait-for: 100
31-
assert-css: ("#main-content", {"display": "none"})
29+
wait-for-css: ("#main-content", {"display": "none"})
3230
// We check that there is no more "test_docs" appearing.
3331
assert-false: "#results .externcrate"
3432
assert-property: ("#crate-search", {"value": "lib2"})

src/test/rustdoc-gui/search-result-go-to-first.goml

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,4 @@ assert-css: ("#main-content", {"display": "none"})
1616
// Now we can check that the feature is working as expected!
1717
goto: file://|DOC_PATH|/test_docs/index.html?search=struct%3AFoo&go_to_first=true
1818
// Waiting for the page to load...
19-
wait-for: 500
20-
assert-text: (".fqn .in-band", "Struct test_docs::Foo")
19+
wait-for-text: (".fqn .in-band", "Struct test_docs::Foo")

src/test/rustdoc-gui/sidebar-source-code-display.goml

+2-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ goto: file://|DOC_PATH|/src/test_docs/lib.rs.html
55
assert-false: "#sidebar-toggle"
66
// For some reason, we need to wait a bit here because it seems like the transition on opacity
77
// is being applied whereas it can't be reproduced in a browser...
8-
wait-for: 500
9-
assert-css: (".sidebar > *", {"visibility": "hidden", "opacity": 0})
8+
wait-for-css: (".sidebar > *", {"visibility": "hidden", "opacity": 0})
109

1110
// Let's retry with javascript enabled.
1211
javascript: true
@@ -17,6 +16,5 @@ assert-css: (".sidebar > *:not(#sidebar-toggle)", {"visibility": "hidden", "opac
1716
// Let's expand the sidebar now.
1817
click: "#sidebar-toggle"
1918
// Because of the transition CSS, better wait a second before checking.
20-
wait-for: 1000
21-
assert-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1})
19+
wait-for-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1})
2220
assert-css: (".sidebar > *:not(#sidebar-toggle)", {"visibility": "visible", "opacity": 1})

src/test/rustdoc-gui/sidebar-source-code.goml

+3-6
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,13 @@ size: (1100, 800)
77
assert-css: ("nav.sidebar", {"width": "50px"})
88
// We now click on the button to expand the sidebar.
99
click: (10, 10)
10-
// We wait for the sidebar to be expanded (there is a 0.5s animation).
11-
wait-for: 600
12-
assert-css: ("nav.sidebar.expanded", {"width": "300px"})
10+
// We wait for the sidebar to be expanded.
11+
wait-for-css: ("nav.sidebar.expanded", {"width": "300px"})
1312
assert-css: ("nav.sidebar.expanded a", {"font-size": "14px"})
1413
// We collapse the sidebar.
1514
click: (10, 10)
16-
// We wait for the sidebar to be collapsed (there is a 0.5s animation).
17-
wait-for: 600
1815
// We ensure that the class has been removed.
19-
assert-false: "nav.sidebar.expanded"
16+
wait-for: "nav.sidebar:not(.expanded)"
2017
assert: "nav.sidebar"
2118

2219
// We now switch to mobile mode.

src/test/rustdoc-gui/theme-change.goml

+5-10
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,21 @@
22
goto: file://|DOC_PATH|/test_docs/index.html
33
click: "#theme-picker"
44
click: "#theme-choices > button:first-child"
5-
wait-for: 500
65
// should be the ayu theme so let's check the color
7-
assert-css: ("body", { "background-color": "rgb(15, 20, 25)" })
6+
wait-for-css: ("body", { "background-color": "rgb(15, 20, 25)" })
87
click: "#theme-choices > button:last-child"
9-
wait-for: 500
108
// should be the light theme so let's check the color
11-
assert-css: ("body", { "background-color": "rgb(255, 255, 255)" })
9+
wait-for-css: ("body", { "background-color": "rgb(255, 255, 255)" })
1210

1311
goto: file://|DOC_PATH|/settings.html
1412
click: "#theme-light"
15-
wait-for: 500
16-
assert-css: ("body", { "background-color": "rgb(255, 255, 255)" })
13+
wait-for-css: ("body", { "background-color": "rgb(255, 255, 255)" })
1714
assert-local-storage: { "rustdoc-theme": "light" }
1815

1916
click: "#theme-dark"
20-
wait-for: 500
21-
assert-css: ("body", { "background-color": "rgb(53, 53, 53)" })
17+
wait-for-css: ("body", { "background-color": "rgb(53, 53, 53)" })
2218
assert-local-storage: { "rustdoc-theme": "dark" }
2319

2420
click: "#theme-ayu"
25-
wait-for: 500
26-
assert-css: ("body", { "background-color": "rgb(15, 20, 25)" })
21+
wait-for-css: ("body", { "background-color": "rgb(15, 20, 25)" })
2722
assert-local-storage: { "rustdoc-theme": "ayu" }

src/test/rustdoc-gui/theme-in-history.goml

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ click: "#settings-menu"
1212
wait-for: ".settings"
1313
// We change the theme to "light".
1414
click: "#theme-light"
15-
wait-for: 250
16-
assert-css: ("body", { "background-color": "rgb(255, 255, 255)" })
15+
wait-for-css: ("body", { "background-color": "rgb(255, 255, 255)" })
1716
assert-local-storage: { "rustdoc-theme": "light" }
1817

1918
// We go back in history.

src/test/rustdoc-gui/toggle-docs.goml

+3-6
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ wait-for: 50
88
assert-attribute-false: ("#main-content > details.top-doc", {"open": ""})
99
assert-text: ("#toggle-all-docs", "[+]")
1010
click: "#toggle-all-docs"
11-
wait-for: 50
1211
// Not collapsed anymore so the "open" attribute should be back.
13-
assert-attribute: ("#main-content > details.top-doc", {"open": ""})
12+
wait-for-attribute: ("#main-content > details.top-doc", {"open": ""})
1413
assert-text: ("#toggle-all-docs", "[−]")
1514

1615
// Check that it works on non-module pages as well.
@@ -27,8 +26,7 @@ assert-attribute-false: (
2726

2827
// We collapse them all.
2928
click: "#toggle-all-docs"
30-
wait-for: 50
31-
assert-text: ("#toggle-all-docs", "[+]")
29+
wait-for-text: ("#toggle-all-docs", "[+]")
3230
// We check that all <details> are collapsed (except for the impl block ones).
3331
assert-attribute-false: ("details.rustdoc-toggle:not(.implementors-toggle)", {"open": ""}, ALL)
3432
assert-attribute: ("#implementations-list > details.implementors-toggle", {"open": ""})
@@ -40,6 +38,5 @@ assert-attribute-false: (
4038
)
4139
// We open them all again.
4240
click: "#toggle-all-docs"
43-
wait-for: 50
44-
assert-text: ("#toggle-all-docs", "[−]")
41+
wait-for-text: ("#toggle-all-docs", "[−]")
4542
assert-attribute: ("details.rustdoc-toggle", {"open": ""}, ALL)

0 commit comments

Comments
 (0)