Update rustdoc GUI tests

This commit is contained in:
Guillaume Gomez 2024-08-31 00:12:10 +02:00
parent 0d156f223a
commit 5b75f8a892
3 changed files with 15 additions and 14 deletions

View file

@ -3,6 +3,7 @@
go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test.html" go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test.html"
// The next/prev buttons vertically scroll the code viewport between examples // The next/prev buttons vertically scroll the code viewport between examples
move-cursor-to: ".scraped-example-list > .scraped-example"
store-property: (".scraped-example-list > .scraped-example pre", {"scrollTop": initialScrollTop}) store-property: (".scraped-example-list > .scraped-example pre", {"scrollTop": initialScrollTop})
focus: ".scraped-example-list > .scraped-example .next" focus: ".scraped-example-list > .scraped-example .next"
press-key: "Enter" press-key: "Enter"

View file

@ -10,10 +10,10 @@ define-function: (
block { block {
call-function: ("switch-theme", {"theme": |theme|}) call-function: ("switch-theme", {"theme": |theme|})
wait-for: ".more-examples-toggle" wait-for: ".more-examples-toggle"
assert-css: (".scraped-example .example-wrap .rust span.highlight:not(.focus)", { assert-css: (".scraped-example .rust span.highlight:not(.focus)", {
"background-color": |highlight|, "background-color": |highlight|,
}, ALL) }, ALL)
assert-css: (".scraped-example .example-wrap .rust span.highlight.focus", { assert-css: (".scraped-example .rust span.highlight.focus", {
"background-color": |highlight_focus|, "background-color": |highlight_focus|,
}, ALL) }, ALL)
@ -67,11 +67,11 @@ define-function: (
[theme, background_color_start, background_color_end], [theme, background_color_start, background_color_end],
block { block {
call-function: ("switch-theme", {"theme": |theme|}) call-function: ("switch-theme", {"theme": |theme|})
assert-css: (".scraped-example:not(.expanded) .code-wrapper::before", { assert-css: (".scraped-example:not(.expanded)::before", {
"background-image": "linear-gradient(" + |background_color_start| + ", " + "background-image": "linear-gradient(" + |background_color_start| + ", " +
|background_color_end| + ")", |background_color_end| + ")",
}) })
assert-css: (".scraped-example:not(.expanded) .code-wrapper::after", { assert-css: (".scraped-example:not(.expanded)::after", {
"background-image": "linear-gradient(to top, " + |background_color_start| + ", " + "background-image": "linear-gradient(to top, " + |background_color_start| + ", " +
|background_color_end| + ")", |background_color_end| + ")",
}) })

View file

@ -3,33 +3,33 @@ go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html"
// Check that it's not zero. // Check that it's not zero.
assert-property-false: ( assert-property-false: (
".more-scraped-examples .scraped-example .code-wrapper .src-line-numbers", ".more-scraped-examples .scraped-example .src-line-numbers",
{"clientWidth": "0"} {"clientWidth": "0"}
) )
// Check that examples with very long lines have the same width as ones that don't. // Check that examples with very long lines have the same width as ones that don't.
store-property: ( store-property: (
".more-scraped-examples .scraped-example:nth-child(2) .code-wrapper .src-line-numbers", ".more-scraped-examples .scraped-example:nth-child(2) .src-line-numbers",
{"clientWidth": clientWidth}, {"clientWidth": clientWidth},
) )
assert-property: ( assert-property: (
".more-scraped-examples .scraped-example:nth-child(3) .code-wrapper .src-line-numbers", ".more-scraped-examples .scraped-example:nth-child(3) .src-line-numbers",
{"clientWidth": |clientWidth|} {"clientWidth": |clientWidth|}
) )
assert-property: ( assert-property: (
".more-scraped-examples .scraped-example:nth-child(4) .code-wrapper .src-line-numbers", ".more-scraped-examples .scraped-example:nth-child(4) .src-line-numbers",
{"clientWidth": |clientWidth|} {"clientWidth": |clientWidth|}
) )
assert-property: ( assert-property: (
".more-scraped-examples .scraped-example:nth-child(5) .code-wrapper .src-line-numbers", ".more-scraped-examples .scraped-example:nth-child(5) .src-line-numbers",
{"clientWidth": |clientWidth|} {"clientWidth": |clientWidth|}
) )
assert-property: ( assert-property: (
".more-scraped-examples .scraped-example:nth-child(6) .code-wrapper .src-line-numbers", ".more-scraped-examples .scraped-example:nth-child(6) .src-line-numbers",
{"clientWidth": |clientWidth|} {"clientWidth": |clientWidth|}
) )
@ -39,10 +39,10 @@ assert-property: (
store-value: (offset_y, 4) store-value: (offset_y, 4)
// First with desktop // First with desktop
assert-position: (".scraped-example .code-wrapper", {"y": 226}) assert-position: (".scraped-example", {"y": 226})
assert-position: (".scraped-example .code-wrapper .prev", {"y": 226 + |offset_y|}) assert-position: (".scraped-example .prev", {"y": 226 + |offset_y|})
// Then with mobile // Then with mobile
set-window-size: (600, 600) set-window-size: (600, 600)
assert-position: (".scraped-example .code-wrapper", {"y": 308}) assert-position: (".scraped-example", {"y": 284})
assert-position: (".scraped-example .code-wrapper .prev", {"y": 308 + |offset_y|}) assert-position: (".scraped-example .prev", {"y": 284 + |offset_y|})