Migrate GUI test to use functions
This commit is contained in:
parent
928d14bcd1
commit
23e5fa164e
1 changed files with 87 additions and 162 deletions
|
@ -29,170 +29,95 @@ assert-local-storage: {"rustdoc-source-sidebar-show": "true"}
|
||||||
// Now we check the display of the sidebar items.
|
// Now we check the display of the sidebar items.
|
||||||
show-text: true
|
show-text: true
|
||||||
|
|
||||||
// First we start with the light theme.
|
define-function: (
|
||||||
local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
|
"check-colors",
|
||||||
reload:
|
(
|
||||||
// Waiting for the sidebar to be displayed...
|
theme, color, color_hover, background, background_hover, background_toggle,
|
||||||
wait-for-css: ("#sidebar-toggle", {"visibility": "visible"})
|
background_toggle_hover,
|
||||||
assert-css: (
|
),
|
||||||
"#source-sidebar details[open] > .files a.selected",
|
[
|
||||||
{"color": "rgb(0, 0, 0)", "background-color": "rgb(255, 255, 255)"},
|
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
|
||||||
)
|
("reload"),
|
||||||
// Without hover or focus.
|
("wait-for-css", ("#sidebar-toggle", {"visibility": "visible"})),
|
||||||
assert-css: ("#sidebar-toggle > button", {"background-color": "rgba(0, 0, 0, 0)"})
|
("assert-css", (
|
||||||
// With focus.
|
"#source-sidebar details[open] > .files a.selected",
|
||||||
focus: "#sidebar-toggle > button"
|
{"color": |color_hover|, "background-color": |background|},
|
||||||
assert-css: ("#sidebar-toggle > button", {"background-color": "rgb(224, 224, 224)"})
|
)),
|
||||||
focus: ".search-input"
|
// Without hover or focus.
|
||||||
// With hover.
|
("assert-css", ("#sidebar-toggle > button", {"background-color": |background_toggle|})),
|
||||||
move-cursor-to: "#sidebar-toggle > button"
|
// With focus.
|
||||||
assert-css: ("#sidebar-toggle > button", {"background-color": "rgb(224, 224, 224)"})
|
("focus", "#sidebar-toggle > button"),
|
||||||
// Without hover.
|
("assert-css", ("#sidebar-toggle > button", {"background-color": |background_toggle_hover|})),
|
||||||
assert-css: (
|
("focus", ".search-input"),
|
||||||
"#source-sidebar details[open] > .files a:not(.selected)",
|
// With hover.
|
||||||
{"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"},
|
("move-cursor-to", "#sidebar-toggle > button"),
|
||||||
)
|
("assert-css", ("#sidebar-toggle > button", {"background-color": |background_toggle_hover|})),
|
||||||
// With focus.
|
// Without hover.
|
||||||
focus: "#source-sidebar details[open] > .files a:not(.selected)"
|
("assert-css", (
|
||||||
wait-for-css: (
|
"#source-sidebar details[open] > .files a:not(.selected)",
|
||||||
"#source-sidebar details[open] > .files a:not(.selected)",
|
{"color": |color|, "background-color": |background_toggle|},
|
||||||
{"color": "rgb(0, 0, 0)", "background-color": "rgb(224, 224, 224)"},
|
)),
|
||||||
)
|
// With focus.
|
||||||
focus: ".search-input"
|
("focus", "#source-sidebar details[open] > .files a:not(.selected)"),
|
||||||
// With hover.
|
("wait-for-css", (
|
||||||
move-cursor-to: "#source-sidebar details[open] > .files a:not(.selected)"
|
"#source-sidebar details[open] > .files a:not(.selected)",
|
||||||
assert-css: (
|
{"color": |color_hover|, "background-color": |background_hover|},
|
||||||
"#source-sidebar details[open] > .files a:not(.selected)",
|
)),
|
||||||
{"color": "rgb(0, 0, 0)", "background-color": "rgb(224, 224, 224)"},
|
("focus", ".search-input"),
|
||||||
)
|
// With hover.
|
||||||
// Without hover.
|
("move-cursor-to", "#source-sidebar details[open] > .files a:not(.selected)"),
|
||||||
assert-css: (
|
("assert-css", (
|
||||||
"#source-sidebar details[open] > .folders > details > summary",
|
"#source-sidebar details[open] > .files a:not(.selected)",
|
||||||
{"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"},
|
{"color": |color_hover|, "background-color": |background_hover|},
|
||||||
)
|
)),
|
||||||
// With focus.
|
// Without hover.
|
||||||
focus: "#source-sidebar details[open] > .folders > details > summary"
|
("assert-css", (
|
||||||
wait-for-css: (
|
"#source-sidebar details[open] > .folders > details > summary",
|
||||||
"#source-sidebar details[open] > .folders > details > summary",
|
{"color": |color|, "background-color": |background_toggle|},
|
||||||
{"color": "rgb(0, 0, 0)", "background-color": "rgb(224, 224, 224)"},
|
)),
|
||||||
)
|
// With focus.
|
||||||
focus: ".search-input"
|
("focus", "#source-sidebar details[open] > .folders > details > summary"),
|
||||||
// With hover.
|
("wait-for-css", (
|
||||||
move-cursor-to: "#source-sidebar details[open] > .folders > details > summary"
|
"#source-sidebar details[open] > .folders > details > summary",
|
||||||
assert-css: (
|
{"color": |color_hover|, "background-color": |background_hover|},
|
||||||
"#source-sidebar details[open] > .folders > details > summary",
|
)),
|
||||||
{"color": "rgb(0, 0, 0)", "background-color": "rgb(224, 224, 224)"},
|
("focus", ".search-input"),
|
||||||
|
// With hover.
|
||||||
|
("move-cursor-to", "#source-sidebar details[open] > .folders > details > summary"),
|
||||||
|
("assert-css", (
|
||||||
|
"#source-sidebar details[open] > .folders > details > summary",
|
||||||
|
{"color": |color_hover|, "background-color": |background_hover|},
|
||||||
|
)),
|
||||||
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
// Now with the dark theme.
|
call-function: ("check-colors", {
|
||||||
local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false"}
|
"theme": "light",
|
||||||
reload:
|
"color": "rgb(0, 0, 0)",
|
||||||
// Waiting for the sidebar to be displayed...
|
"color_hover": "rgb(0, 0, 0)",
|
||||||
wait-for-css: ("#sidebar-toggle", {"visibility": "visible"})
|
"background": "rgb(255, 255, 255)",
|
||||||
assert-css: (
|
"background_hover": "rgb(224, 224, 224)",
|
||||||
"#source-sidebar details[open] > .files > a.selected",
|
"background_toggle": "rgba(0, 0, 0, 0)",
|
||||||
{"color": "rgb(221, 221, 221)", "background-color": "rgb(51, 51, 51)"},
|
"background_toggle_hover": "rgb(224, 224, 224)",
|
||||||
)
|
})
|
||||||
// Without hover or focus.
|
call-function: ("check-colors", {
|
||||||
assert-css: ("#sidebar-toggle > button", {"background-color": "rgba(0, 0, 0, 0)"})
|
"theme": "dark",
|
||||||
// With focus.
|
"color": "rgb(221, 221, 221)",
|
||||||
focus: "#sidebar-toggle > button"
|
"color_hover": "rgb(221, 221, 221)",
|
||||||
assert-css: ("#sidebar-toggle > button", {"background-color": "rgb(103, 103, 103)"})
|
"background": "rgb(51, 51, 51)",
|
||||||
focus: ".search-input"
|
"background_hover": "rgb(68, 68, 68)",
|
||||||
// With hover.
|
"background_toggle": "rgba(0, 0, 0, 0)",
|
||||||
move-cursor-to: "#sidebar-toggle > button"
|
"background_toggle_hover": "rgb(103, 103, 103)",
|
||||||
assert-css: ("#sidebar-toggle > button", {"background-color": "rgb(103, 103, 103)"})
|
})
|
||||||
// Without hover.
|
call-function: ("check-colors", {
|
||||||
assert-css: (
|
"theme": "ayu",
|
||||||
"#source-sidebar details[open] > .files > a:not(.selected)",
|
"color": "rgb(197, 197, 197)",
|
||||||
{"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"},
|
"color_hover": "rgb(255, 180, 76)",
|
||||||
)
|
"background": "rgb(20, 25, 31)",
|
||||||
// With focus.
|
"background_hover": "rgb(20, 25, 31)",
|
||||||
focus: "#source-sidebar details[open] > .files a:not(.selected)"
|
"background_toggle": "rgba(0, 0, 0, 0)",
|
||||||
wait-for-css: (
|
"background_toggle_hover": "rgba(70, 70, 70, 0.33)",
|
||||||
"#source-sidebar details[open] > .files a:not(.selected)",
|
})
|
||||||
{"color": "rgb(221, 221, 221)", "background-color": "rgb(68, 68, 68)"},
|
|
||||||
)
|
|
||||||
focus: ".search-input"
|
|
||||||
// With hover.
|
|
||||||
move-cursor-to: "#source-sidebar details[open] > .files a:not(.selected)"
|
|
||||||
assert-css: (
|
|
||||||
"#source-sidebar details[open] > .files a:not(.selected)",
|
|
||||||
{"color": "rgb(221, 221, 221)", "background-color": "rgb(68, 68, 68)"},
|
|
||||||
)
|
|
||||||
// Without hover.
|
|
||||||
assert-css: (
|
|
||||||
"#source-sidebar details[open] > .folders > details > summary",
|
|
||||||
{"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"},
|
|
||||||
)
|
|
||||||
// With focus.
|
|
||||||
focus: "#source-sidebar details[open] > .folders > details > summary"
|
|
||||||
wait-for-css: (
|
|
||||||
"#source-sidebar details[open] > .folders > details > summary",
|
|
||||||
{"color": "rgb(221, 221, 221)", "background-color": "rgb(68, 68, 68)"},
|
|
||||||
)
|
|
||||||
focus: ".search-input"
|
|
||||||
// With hover.
|
|
||||||
move-cursor-to: "#source-sidebar details[open] > .folders > details > summary"
|
|
||||||
assert-css: (
|
|
||||||
"#source-sidebar details[open] > .folders > details > summary",
|
|
||||||
{"color": "rgb(221, 221, 221)", "background-color": "rgb(68, 68, 68)"},
|
|
||||||
)
|
|
||||||
|
|
||||||
// And finally with the ayu theme.
|
|
||||||
local-storage: {"rustdoc-theme": "ayu", "rustdoc-use-system-theme": "false"}
|
|
||||||
reload:
|
|
||||||
// Waiting for the sidebar to be displayed...
|
|
||||||
wait-for-css: ("#sidebar-toggle", {"visibility": "visible"})
|
|
||||||
assert-css: (
|
|
||||||
"#source-sidebar details[open] > .files a.selected",
|
|
||||||
{"color": "rgb(255, 180, 76)", "background-color": "rgb(20, 25, 31)"},
|
|
||||||
)
|
|
||||||
// Without hover or focus.
|
|
||||||
assert-css: ("#sidebar-toggle > button", {"background-color": "rgba(0, 0, 0, 0)"})
|
|
||||||
// With focus.
|
|
||||||
focus: "#sidebar-toggle > button"
|
|
||||||
assert-css: ("#sidebar-toggle > button", {"background-color": "rgba(70, 70, 70, 0.33)"})
|
|
||||||
focus: ".search-input"
|
|
||||||
// With hover.
|
|
||||||
move-cursor-to: "#sidebar-toggle > button"
|
|
||||||
assert-css: ("#sidebar-toggle > button", {"background-color": "rgba(70, 70, 70, 0.33)"})
|
|
||||||
// Without hover.
|
|
||||||
assert-css: (
|
|
||||||
"#source-sidebar details[open] > .files a:not(.selected)",
|
|
||||||
{"color": "rgb(197, 197, 197)", "background-color": "rgba(0, 0, 0, 0)"},
|
|
||||||
)
|
|
||||||
// With focus.
|
|
||||||
focus: "#source-sidebar details[open] > .files a:not(.selected)"
|
|
||||||
wait-for-css: (
|
|
||||||
"#source-sidebar details[open] > .files a:not(.selected)",
|
|
||||||
{"color": "rgb(255, 180, 76)", "background-color": "rgb(20, 25, 31)"},
|
|
||||||
)
|
|
||||||
focus: ".search-input"
|
|
||||||
// With hover.
|
|
||||||
move-cursor-to: "#source-sidebar details[open] > .files a:not(.selected)"
|
|
||||||
assert-css: (
|
|
||||||
"#source-sidebar details[open] > .files a:not(.selected)",
|
|
||||||
{"color": "rgb(255, 180, 76)", "background-color": "rgb(20, 25, 31)"},
|
|
||||||
)
|
|
||||||
// Without hover.
|
|
||||||
assert-css: (
|
|
||||||
"#source-sidebar details[open] > .folders > details > summary",
|
|
||||||
{"color": "rgb(197, 197, 197)", "background-color": "rgba(0, 0, 0, 0)"},
|
|
||||||
)
|
|
||||||
// With focus.
|
|
||||||
focus: "#source-sidebar details[open] > .folders > details > summary"
|
|
||||||
wait-for-css: (
|
|
||||||
"#source-sidebar details[open] > .folders > details > summary",
|
|
||||||
{"color": "rgb(255, 180, 76)", "background-color": "rgb(20, 25, 31)"},
|
|
||||||
)
|
|
||||||
focus: ".search-input"
|
|
||||||
// With hover.
|
|
||||||
move-cursor-to: "#source-sidebar details[open] > .folders > details > summary"
|
|
||||||
assert-css: (
|
|
||||||
"#source-sidebar details[open] > .folders > details > summary",
|
|
||||||
{"color": "rgb(255, 180, 76)", "background-color": "rgb(20, 25, 31)"},
|
|
||||||
)
|
|
||||||
|
|
||||||
// Now checking on mobile devices.
|
// Now checking on mobile devices.
|
||||||
size: (500, 700)
|
size: (500, 700)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue