rust/tests/rustdoc-gui/scrape-examples-color.goml
Dylan DPC ec372a17e2
Rollup merge of #111844 - GuillaumeGomez:migrate-gui-test-color-4, r=notriddle
Migrate GUI colors test to original CSS color format

I updated the `browser-ui-test` version because I fixed https://github.com/GuillaumeGomez/browser-UI-test/issues/507. If inside a function, the colors were not considered, preventing the second commit of this PR.

Follow-up of https://github.com/rust-lang/rust/pull/111459.

r? `@notriddle`
2023-05-23 00:32:20 +05:30

97 lines
3.2 KiB
Plaintext

// Check that scrape example code blocks have the expected colors.
go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html"
show-text: true
define-function: (
"check-colors",
(theme, highlight, highlight_focus, help_border, help_color, help_hover_border,
help_hover_color),
block {
set-local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false", }
reload:
wait-for: ".more-examples-toggle"
assert-css: (".scraped-example .example-wrap .rust span.highlight:not(.focus)", {
"background-color": |highlight|,
}, ALL)
assert-css: (".scraped-example .example-wrap .rust span.highlight.focus", {
"background-color": |highlight_focus|,
}, ALL)
assert-css: (".scraped-example-list .scrape-help", {
"border-color": |help_border|,
"color": |help_color|,
})
move-cursor-to: ".scraped-example-list .scrape-help"
assert-css: (".scraped-example-list .scrape-help:hover", {
"border-color": |help_hover_border|,
"color": |help_hover_color|,
})
// Moving the cursor to another item to not break next runs.
move-cursor-to: ".search-input"
}
)
call-function: ("check-colors", {
"theme": "ayu",
"highlight": "#5b3b01",
"highlight_focus": "#7c4b0f",
"help_border": "#aaa",
"help_color": "#eee",
"help_hover_border": "#fff",
"help_hover_color": "#fff",
})
call-function: ("check-colors", {
"theme": "dark",
"highlight": "#5b3b01",
"highlight_focus": "#7c4b0f",
"help_border": "#aaa",
"help_color": "#eee",
"help_hover_border": "#fff",
"help_hover_color": "#fff",
})
call-function: ("check-colors", {
"theme": "light",
"highlight": "#fcffd6",
"highlight_focus": "#f6fdb0",
"help_border": "#555",
"help_color": "#333",
"help_hover_border": "#000",
"help_hover_color": "#000",
})
// Now testing the top and bottom background in case there is only one scraped examples.
go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test.html"
define-function: (
"check-background",
(theme, background_color_start, background_color_end),
block {
set-local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false", }
reload:
assert-css: (".scraped-example:not(.expanded) .code-wrapper::before", {
"background-image": "linear-gradient(" + |background_color_start| + ", " +
|background_color_end| + ")",
})
assert-css: (".scraped-example:not(.expanded) .code-wrapper::after", {
"background-image": "linear-gradient(to top, " + |background_color_start| + ", " +
|background_color_end| + ")",
})
},
)
call-function: ("check-background", {
"theme": "ayu",
"background_color_start": "rgba(15, 20, 25, 1)",
"background_color_end": "rgba(15, 20, 25, 0)",
})
call-function: ("check-background", {
"theme": "dark",
"background_color_start": "rgba(53, 53, 53, 1)",
"background_color_end": "rgba(53, 53, 53, 0)",
})
call-function: ("check-background", {
"theme": "light",
"background_color_start": "rgba(255, 255, 255, 1)",
"background_color_end": "rgba(255, 255, 255, 0)",
})