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"
// 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})
focus: ".scraped-example-list > .scraped-example .next"
press-key: "Enter"

View File

@ -10,10 +10,10 @@ define-function: (
block {
call-function: ("switch-theme", {"theme": |theme|})
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|,
}, ALL)
assert-css: (".scraped-example .example-wrap .rust span.highlight.focus", {
assert-css: (".scraped-example .rust span.highlight.focus", {
"background-color": |highlight_focus|,
}, ALL)
@ -67,11 +67,11 @@ define-function: (
[theme, background_color_start, background_color_end],
block {
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_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_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.
assert-property-false: (
".more-scraped-examples .scraped-example .code-wrapper .src-line-numbers",
".more-scraped-examples .scraped-example .src-line-numbers",
{"clientWidth": "0"}
)
// Check that examples with very long lines have the same width as ones that don't.
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},
)
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|}
)
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|}
)
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|}
)
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|}
)
@ -39,10 +39,10 @@ assert-property: (
store-value: (offset_y, 4)
// First with desktop
assert-position: (".scraped-example .code-wrapper", {"y": 226})
assert-position: (".scraped-example .code-wrapper .prev", {"y": 226 + |offset_y|})
assert-position: (".scraped-example", {"y": 226})
assert-position: (".scraped-example .prev", {"y": 226 + |offset_y|})
// Then with mobile
set-window-size: (600, 600)
assert-position: (".scraped-example .code-wrapper", {"y": 308})
assert-position: (".scraped-example .code-wrapper .prev", {"y": 308 + |offset_y|})
assert-position: (".scraped-example", {"y": 284})
assert-position: (".scraped-example .prev", {"y": 284 + |offset_y|})