Skip to content

Commit eead6f4

Browse files
Rollup merge of rust-lang#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`````
2 parents 7c31df9 + 8e55400 commit eead6f4

17 files changed

+70
-81
lines changed
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.15.0
1+
0.16.0

src/tools/rustdoc-gui/tester.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ async function runTests(opts, framework_options, files, results, status_bar, sho
143143
const tests_queue = [];
144144

145145
for (const testPath of files) {
146-
const callback = runTest(testPath, framework_options)
146+
const callback = runTest(testPath, {"options": framework_options})
147147
.then(out => {
148148
const [output, nb_failures] = out;
149149
results[nb_failures === 0 ? "successful" : "failed"].push({
@@ -323,6 +323,7 @@ async function main(argv) {
323323
if (results.failed.length > 0 || results.errored.length > 0) {
324324
process.exit(1);
325325
}
326+
process.exit(0);
326327
}
327328

328329
main(process.argv);

tests/rustdoc-gui/check-stab-in-docblock.goml

+12-6
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,26 @@ set-window-size: (786, 600)
77
// Confirms that there 3 paragraphs.
88
assert-count: (".top-doc .docblock p", 3)
99
// Checking that there is no scrollable content.
10-
store-property: (clientHeight, ".top-doc .docblock p:nth-of-type(1)", "clientHeight")
11-
store-property: (clientWidth, ".top-doc .docblock p:nth-of-type(1)", "clientWidth")
10+
store-property: (".top-doc .docblock p:nth-of-type(1)", {
11+
"clientHeight": clientHeight,
12+
"clientWidth": clientWidth,
13+
})
1214
assert-property: (
1315
".top-doc .docblock p:nth-of-type(1)",
1416
{"scrollHeight": |clientHeight|, "scrollWidth": |clientWidth|},
1517
)
16-
store-property: (clientHeight, ".top-doc .docblock p:nth-of-type(2)", "clientHeight")
17-
store-property: (clientWidth, ".top-doc .docblock p:nth-of-type(2)", "clientWidth")
18+
store-property: (".top-doc .docblock p:nth-of-type(2)", {
19+
"clientHeight": clientHeight,
20+
"clientWidth": clientWidth,
21+
})
1822
assert-property: (
1923
".top-doc .docblock p:nth-of-type(2)",
2024
{"scrollHeight": |clientHeight|, "scrollWidth": |clientWidth|},
2125
)
22-
store-property: (clientHeight, ".top-doc .docblock p:nth-of-type(3)", "clientHeight")
23-
store-property: (clientWidth, ".top-doc .docblock p:nth-of-type(3)", "clientWidth")
26+
store-property: (".top-doc .docblock p:nth-of-type(3)", {
27+
"clientHeight": clientHeight,
28+
"clientWidth": clientWidth,
29+
})
2430
assert-property: (
2531
".top-doc .docblock p:nth-of-type(3)",
2632
{"scrollHeight": |clientHeight|, "scrollWidth": |clientWidth|},

tests/rustdoc-gui/codeblock-sub.goml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Test that code blocks nested within <sub> do not have a line height of 0.
22
go-to: "file://" + |DOC_PATH| + "/test_docs/codeblock_sub/index.html"
33

4-
store-property: (codeblock_sub_1, "#codeblock-sub-1", "offsetHeight")
4+
store-property: ("#codeblock-sub-1", {"offsetHeight": codeblock_sub_1})
55
assert-property-false: ("#codeblock-sub-3", { "offsetHeight": |codeblock_sub_1| })

tests/rustdoc-gui/docblock-details.goml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ reload:
99
assert-text: (".top-doc .docblock > h3", "Hello")
1010
assert-css: (
1111
".top-doc .docblock > h3",
12-
{"border-bottom": "1px solid rgb(210, 210, 210)"},
12+
{"border-bottom": "1px solid #d2d2d2"},
1313
)
1414
// We now check that the `<summary>` doesn't have a bottom border and has the correct display.
1515
assert-css: (

tests/rustdoc-gui/item-info.goml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ go-to: "file://" + |DOC_PATH| + "/lib2/struct.Foo.html"
44
// We set a fixed size so there is no chance of "random" resize.
55
set-window-size: (1100, 800)
66
// We check that ".item-info" is bigger than its content.
7-
assert-css: (".item-info", {"width": "840px"})
8-
assert-css: (".item-info .stab", {"width": "289px"})
7+
assert-size: (".item-info", {"width": 840})
8+
assert-size: (".item-info .stab", {"width": 289})
99
assert-position: (".item-info .stab", {"x": 245})
1010

1111
// Now we ensure that they're not rendered on the same line.

tests/rustdoc-gui/notable-trait.goml

+4-4
Original file line numberDiff line numberDiff line change
@@ -225,12 +225,12 @@ assert: "#method\.create_an_iterator_from_read .tooltip:focus"
225225

226226
// Now we check that the focus isn't given back to the wrong item when opening
227227
// another popover.
228-
store-window-property: (scroll, "scrollY")
228+
store-window-property: {"scrollY": scroll}
229229
click: "#method\.create_an_iterator_from_read .fn"
230230
// We ensure that the scroll position changed.
231231
assert-window-property-false: {"scrollY": |scroll|}
232232
// Store the new position.
233-
store-window-property: (scroll, "scrollY")
233+
store-window-property: {"scrollY": scroll}
234234
click: "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']"
235235
wait-for: "//*[@class='tooltip popover']"
236236
click: "#settings-menu a"
@@ -239,12 +239,12 @@ click: ".search-input"
239239
assert-window-property-false: {"scrollY": |scroll|}
240240

241241
// Same but with Escape handling.
242-
store-window-property: (scroll, "scrollY")
242+
store-window-property: {"scrollY": scroll}
243243
click: "#method\.create_an_iterator_from_read .fn"
244244
// We ensure that the scroll position changed.
245245
assert-window-property-false: {"scrollY": |scroll|}
246246
// Store the new position.
247-
store-window-property: (scroll, "scrollY")
247+
store-window-property: {"scrollY": scroll}
248248
click: "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']"
249249
wait-for: "//*[@class='tooltip popover']"
250250
click: "#settings-menu a"

tests/rustdoc-gui/scrape-examples-button-focus.goml

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test.html"
44

55
// The next/prev buttons vertically scroll the code viewport between examples
6-
store-property: (initialScrollTop, ".scraped-example-list > .scraped-example pre", "scrollTop")
6+
store-property: (".scraped-example-list > .scraped-example pre", {"scrollTop": initialScrollTop})
77
focus: ".scraped-example-list > .scraped-example .next"
88
press-key: "Enter"
99
assert-property-false: (".scraped-example-list > .scraped-example pre", {
@@ -16,7 +16,7 @@ assert-property: (".scraped-example-list > .scraped-example pre", {
1616
}, NEAR)
1717

1818
// The expand button increases the scrollHeight of the minimized code viewport
19-
store-property: (smallOffsetHeight, ".scraped-example-list > .scraped-example pre", "offsetHeight")
19+
store-property: (".scraped-example-list > .scraped-example pre", {"offsetHeight": smallOffsetHeight})
2020
assert-property-false: (".scraped-example-list > .scraped-example pre", {
2121
"scrollHeight": |smallOffsetHeight|
2222
}, NEAR)
@@ -25,7 +25,7 @@ press-key: "Enter"
2525
assert-property-false: (".scraped-example-list > .scraped-example pre", {
2626
"offsetHeight": |smallOffsetHeight|
2727
}, NEAR)
28-
store-property: (fullOffsetHeight, ".scraped-example-list > .scraped-example pre", "offsetHeight")
28+
store-property: (".scraped-example-list > .scraped-example pre", {"offsetHeight": fullOffsetHeight})
2929
assert-property: (".scraped-example-list > .scraped-example pre", {
3030
"scrollHeight": |fullOffsetHeight|
3131
}, NEAR)

tests/rustdoc-gui/scrape-examples-layout.goml

+3-4
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ assert-property-false: (
99

1010
// Check that examples with very long lines have the same width as ones that don't.
1111
store-property: (
12-
clientWidth,
1312
".more-scraped-examples .scraped-example:nth-child(2) .code-wrapper .src-line-numbers",
14-
"clientWidth"
13+
{"clientWidth": clientWidth},
1514
)
1615

1716
assert-property: (
@@ -40,8 +39,8 @@ assert-property: (
4039
store-value: (offset_y, 4)
4140

4241
// First with desktop
43-
assert-position: (".scraped-example .code-wrapper", {"y": 253})
44-
assert-position: (".scraped-example .code-wrapper .prev", {"y": 253 + |offset_y|})
42+
assert-position: (".scraped-example .code-wrapper", {"y": 226})
43+
assert-position: (".scraped-example .code-wrapper .prev", {"y": 226 + |offset_y|})
4544

4645
// Then with mobile
4746
set-window-size: (600, 600)

tests/rustdoc-gui/search-result-display.goml

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ set-text: (
3232
)
3333

3434
// Then we compare again to confirm the height didn't change.
35-
assert-css: ("#crate-search", {"width": "527px"})
36-
assert-css: (".search-results-title", {"height": "50px", "width": "640px"})
35+
assert-size: ("#crate-search", {"width": 527})
36+
assert-size: (".search-results-title", {"height": 50, "width": 640})
3737
// And we check that the `<select>` isn't bigger than its container (".search-results-title").
3838
assert-css: ("#search", {"width": "640px"})
3939

tests/rustdoc-gui/settings.goml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ wait-for: "#settings"
1010
assert-css: ("#settings", {"display": "block"})
1111

1212
// Store the line margin to compare with the settings.html later.
13-
store-css: (setting_line_margin, ".setting-line", "margin")
13+
store-css: (".setting-line", {"margin": setting_line_margin})
1414

1515
// Let's close it by clicking on the same button.
1616
click: "#settings-menu"

tests/rustdoc-gui/sidebar-source-code-display.goml

+13-13
Original file line numberDiff line numberDiff line change
@@ -121,28 +121,28 @@ define-function: (
121121

122122
call-function: ("check-colors", {
123123
"theme": "light",
124-
"color": "rgb(0, 0, 0)",
125-
"color_hover": "rgb(0, 0, 0)",
126-
"background": "rgb(255, 255, 255)",
127-
"background_hover": "rgb(224, 224, 224)",
124+
"color": "black",
125+
"color_hover": "#000",
126+
"background": "#fff",
127+
"background_hover": "#e0e0e0",
128128
"background_toggle": "rgba(0, 0, 0, 0)",
129-
"background_toggle_hover": "rgb(224, 224, 224)",
129+
"background_toggle_hover": "#e0e0e0",
130130
})
131131
call-function: ("check-colors", {
132132
"theme": "dark",
133-
"color": "rgb(221, 221, 221)",
134-
"color_hover": "rgb(221, 221, 221)",
135-
"background": "rgb(51, 51, 51)",
136-
"background_hover": "rgb(68, 68, 68)",
133+
"color": "#ddd",
134+
"color_hover": "#ddd",
135+
"background": "#333",
136+
"background_hover": "#444",
137137
"background_toggle": "rgba(0, 0, 0, 0)",
138-
"background_toggle_hover": "rgb(103, 103, 103)",
138+
"background_toggle_hover": "#676767",
139139
})
140140
call-function: ("check-colors", {
141141
"theme": "ayu",
142-
"color": "rgb(197, 197, 197)",
143-
"color_hover": "rgb(255, 180, 76)",
142+
"color": "#c5c5c5",
143+
"color_hover": "#ffb44c",
144144
"background": "rgb(20, 25, 31)",
145-
"background_hover": "rgb(20, 25, 31)",
145+
"background_hover": "#14191f",
146146
"background_toggle": "rgba(0, 0, 0, 0)",
147147
"background_toggle_hover": "rgba(70, 70, 70, 0.33)",
148148
})

tests/rustdoc-gui/sidebar.goml

+8-6
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,16 @@ assert-property: (".sidebar", {"clientWidth": "200"})
152152

153153
// Checks that all.html and index.html have their sidebar link in the same place.
154154
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
155-
store-property: (index_sidebar_width, ".sidebar .location a", "clientWidth")
156-
store-property: (index_sidebar_height, ".sidebar .location a", "clientHeight")
157-
store-property: (index_sidebar_x, ".sidebar .location a", "offsetTop")
158-
store-property: (index_sidebar_y, ".sidebar .location a", "offsetLeft")
155+
store-property: (".sidebar .location a", {
156+
"clientWidth": index_sidebar_width,
157+
"clientHeight": index_sidebar_height,
158+
"offsetTop": index_sidebar_y,
159+
"offsetLeft": index_sidebar_x,
160+
})
159161
go-to: "file://" + |DOC_PATH| + "/test_docs/all.html"
160162
assert-property: (".sidebar .location a", {
161163
"clientWidth": |index_sidebar_width|,
162164
"clientHeight": |index_sidebar_height|,
163-
"offsetTop": |index_sidebar_x|,
164-
"offsetLeft": |index_sidebar_y|,
165+
"offsetTop": |index_sidebar_y|,
166+
"offsetLeft": |index_sidebar_x|,
165167
})

tests/rustdoc-gui/source-code-page.goml

+14-33
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,8 @@ assert-property: ("#source-sidebar details:first-of-type", {"open": "true"})
117117

118118
// Check the sidebar directory entries have a marker and spacing (desktop).
119119
store-property: (
120-
link_height,
121120
"#source-sidebar > details:first-of-type.dir-entry[open] > .files > a",
122-
"offsetHeight"
121+
{"offsetHeight": link_height},
123122
)
124123
define-function: (
125124
"check-sidebar-dir-entry",
@@ -147,16 +146,10 @@ define-function: (
147146
)
148147
}
149148
)
150-
store-property: (
151-
source_sidebar_title_height,
152-
"#source-sidebar > .title",
153-
"offsetHeight"
154-
)
155-
store-property: (
156-
source_sidebar_title_y,
157-
"#source-sidebar > .title",
158-
"offsetTop"
159-
)
149+
store-property: ("#source-sidebar > .title", {
150+
"offsetHeight": source_sidebar_title_height,
151+
"offsetTop": source_sidebar_title_y,
152+
})
160153
call-function: ("check-sidebar-dir-entry", {
161154
"x": 0,
162155
// border + margin = 6
@@ -182,16 +175,10 @@ assert-property: ("#main-content", {"offsetTop": 76})
182175
// 21 = 76 - 34 - 21
183176

184177
// Check the sidebar directory entries have a marker and spacing (tablet).
185-
store-property: (
186-
source_sidebar_title_height,
187-
"#source-sidebar > .title",
188-
"offsetHeight"
189-
)
190-
store-property: (
191-
source_sidebar_title_y,
192-
"#source-sidebar > .title",
193-
"offsetTop"
194-
)
178+
store-property: ("#source-sidebar > .title", {
179+
"offsetHeight": source_sidebar_title_height,
180+
"offsetTop": source_sidebar_title_y,
181+
})
195182
call-function: ("check-sidebar-dir-entry", {
196183
"x": 0,
197184
"y": |source_sidebar_title_y| + |source_sidebar_title_height| + 6,
@@ -202,22 +189,16 @@ set-window-size: (450, 700)
202189
assert-css: ("nav.sub", {"flex-direction": "column"})
203190

204191
// Check the sidebar directory entries have a marker and spacing (phone).
205-
store-property: (
206-
source_sidebar_title_height,
207-
"#source-sidebar > .title",
208-
"offsetHeight"
209-
)
210-
store-property: (
211-
source_sidebar_title_y,
212-
"#source-sidebar > .title",
213-
"offsetTop"
214-
)
192+
store-property: ("#source-sidebar > .title", {
193+
"offsetHeight": source_sidebar_title_height,
194+
"offsetTop": source_sidebar_title_y,
195+
})
215196
call-function: ("check-sidebar-dir-entry", {
216197
"x": 0,
217198
"y": |source_sidebar_title_y| + |source_sidebar_title_height| + 6,
218199
})
219200

220201
// Now we check that the logo has a bottom margin so it's not stuck to the search input.
221202
assert-css: (".sub-logo-container > img", {"margin-bottom": "8px"})
222-
store-property: (logo_height, ".sub-logo-container", "clientHeight")
203+
store-property: (".sub-logo-container", {"clientHeight": logo_height})
223204
assert-position: (".search-form", {"y": |logo_height| + 8})

tests/rustdoc-gui/src-font-size.goml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ assert-css: (".impl-items .srclink", {"font-size": "16px", "font-weight": 400},
1111
assert-css: (".impl-items .code-header", {"font-size": "16px", "font-weight": 600}, ALL)
1212

1313
// Check that we can click on source link
14-
store-document-property: (url, "URL")
14+
store-document-property: {"URL": url}
1515
click: ".impl-items .srclink"
1616
assert-document-property-false: {"URL": |url|}

tests/rustdoc-gui/struct-fields.goml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// This test ensures that each field is on its own line (In other words, they have display: block).
22
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.StructWithPublicUndocumentedFields.html"
33

4-
store-property: (first_top, "//*[@id='structfield.first']", "offsetTop")
4+
store-property: ("//*[@id='structfield.first']", {"offsetTop": first_top})
55
assert-property-false: ("//*[@id='structfield.second']", { "offsetTop": |first_top| })

tests/rustdoc-gui/type-declation-overflow.goml

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ assert-property: ("pre.item-decl", {"scrollWidth": "950"})
3939
set-window-size: (600, 600)
4040
go-to: "file://" + |DOC_PATH| + "/lib2/too_long/struct.SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName.html"
4141
// It shouldn't have an overflow in the topbar either.
42-
store-property: (scrollWidth, ".mobile-topbar h2", "scrollWidth")
42+
store-property: (".mobile-topbar h2", {"scrollWidth": scrollWidth})
4343
assert-property: (".mobile-topbar h2", {"clientWidth": |scrollWidth|})
4444
assert-css: (".mobile-topbar h2", {"overflow-x": "hidden"})
4545

0 commit comments

Comments
 (0)