Update existing rustdoc-gui tests and add a new one

This commit is contained in:
Guillaume Gomez 2022-08-13 15:47:19 +02:00
parent 2d968a142f
commit 9898793323
4 changed files with 248 additions and 6 deletions

View file

@ -56,7 +56,7 @@ reload:
click: "#help-button" click: "#help-button"
assert-css: ( assert-css: (
"#help-button .popover", "#help-button .popover",
{"display": "block", "border-color": "rgb(210, 210, 210)"}, {"display": "block", "border-color": "rgb(224, 224, 224)"},
) )
compare-elements-css: ("#help-button .popover", "#help-button .top", ["border-color"]) compare-elements-css: ("#help-button .popover", "#help-button .top", ["border-color"])
compare-elements-css: ("#help-button .popover", "#help-button .bottom", ["border-color"]) compare-elements-css: ("#help-button .popover", "#help-button .bottom", ["border-color"])

View file

@ -69,7 +69,7 @@ click: "#settings-menu"
wait-for: "#settings" wait-for: "#settings"
click: "#theme-dark" click: "#theme-dark"
wait-for-css: ("#crate-search", { wait-for-css: ("#crate-search", {
"border": "1px solid rgb(210, 210, 210)", "border": "1px solid rgb(224, 224, 224)",
"color": "rgb(221, 221, 221)", "color": "rgb(221, 221, 221)",
"background-color": "rgb(53, 53, 53)", "background-color": "rgb(53, 53, 53)",
}) })

View file

@ -0,0 +1,243 @@
// This test ensures that the elements in ".search-form" have the expected display.
goto: file://|DOC_PATH|/test_docs/index.html
show-text: true
// Ayu theme
local-storage: {
"rustdoc-theme": "ayu",
"rustdoc-use-system-theme": "false",
}
reload:
assert-css: (
".search-input",
{
"border-color": "rgb(92, 103, 115)",
"background-color": "rgb(20, 25, 32)",
"color": "rgb(255, 255, 255)",
},
)
focus: ".search-input"
// Nothing should change.
assert-css: (
".search-input",
{
"border-color": "rgb(92, 103, 115)",
"background-color": "rgb(20, 25, 32)",
"color": "rgb(255, 255, 255)",
},
)
assert-css: (
"#help-button",
{"border-color": "rgb(197, 197, 197)"},
)
assert-css: (
"#help-button > button",
{
"color": "rgb(255, 255, 255)",
"border-color": "rgb(92, 103, 115)",
"background-color": "rgb(20, 25, 32)",
},
)
move-cursor-to: "#help-button"
assert-css: (
"#help-button:hover",
{"border-color": "rgb(197, 197, 197)"},
)
// Only "border-color" should change.
assert-css: (
"#help-button:hover > button",
{
"color": "rgb(255, 255, 255)",
"border-color": "rgb(224, 224, 224)",
"background-color": "rgb(20, 25, 32)",
},
)
assert-css: (
"#settings-menu",
{"border-color": "rgb(197, 197, 197)"},
)
assert-css: (
"#settings-menu > a",
{
"color": "rgb(255, 255, 255)",
"border-color": "rgb(92, 103, 115)",
"background-color": "rgb(20, 25, 32)",
},
)
move-cursor-to: "#settings-menu"
assert-css: (
"#settings-menu:hover",
{"border-color": "rgb(197, 197, 197)"},
)
// Only "border-color" should change.
assert-css: (
"#settings-menu:hover > a",
{
"color": "rgb(255, 255, 255)",
"border-color": "rgb(224, 224, 224)",
"background-color": "rgb(20, 25, 32)",
},
)
// Dark theme
local-storage: {
"rustdoc-theme": "dark",
"rustdoc-use-system-theme": "false",
}
reload:
assert-css: (
".search-input",
{
"border-color": "rgb(240, 240, 240)",
"background-color": "rgb(240, 240, 240)",
"color": "rgb(17, 17, 17)",
},
)
focus: ".search-input"
// Only "border-color" should change.
assert-css: (
".search-input",
{
"border-color": "rgb(0, 141, 253)",
"background-color": "rgb(240, 240, 240)",
"color": "rgb(17, 17, 17)",
},
)
assert-css: (
"#help-button",
{"border-color": "rgb(221, 221, 221)"},
)
assert-css: (
"#help-button > button",
{
"color": "rgb(0, 0, 0)",
"border-color": "rgb(224, 224, 224)",
"background-color": "rgb(240, 240, 240)",
},
)
move-cursor-to: "#help-button"
assert-css: (
"#help-button:hover",
{"border-color": "rgb(221, 221, 221)"},
)
// Only "border-color" should change.
assert-css: (
"#help-button:hover > button",
{
"color": "rgb(0, 0, 0)",
"border-color": "rgb(255, 185, 0)",
"background-color": "rgb(240, 240, 240)",
},
)
assert-css: (
"#settings-menu",
{"border-color": "rgb(221, 221, 221)"},
)
assert-css: (
"#settings-menu > a",
{
"color": "rgb(0, 0, 0)",
"border-color": "rgb(224, 224, 224)",
"background-color": "rgb(240, 240, 240)",
},
)
move-cursor-to: "#settings-menu"
assert-css: (
"#settings-menu:hover",
{"border-color": "rgb(221, 221, 221)"},
)
// Only "border-color" should change.
assert-css: (
"#settings-menu:hover > a",
{
"color": "rgb(0, 0, 0)",
"border-color": "rgb(255, 185, 0)",
"background-color": "rgb(240, 240, 240)",
},
)
// Light theme
local-storage: {
"rustdoc-theme": "light",
"rustdoc-use-system-theme": "false",
}
reload:
assert-css: (
".search-input",
{
"border-color": "rgb(224, 224, 224)",
"background-color": "rgb(255, 255, 255)",
"color": "rgb(0, 0, 0)",
},
)
focus: ".search-input"
// Nothing should change.
assert-css: (
".search-input",
{
"border-color": "rgb(102, 175, 233)",
"background-color": "rgb(255, 255, 255)",
"color": "rgb(0, 0, 0)",
},
)
assert-css: (
"#help-button",
{"border-color": "rgb(0, 0, 0)"},
)
assert-css: (
"#help-button > button",
{
"color": "rgb(0, 0, 0)",
"border-color": "rgb(224, 224, 224)",
"background-color": "rgb(255, 255, 255)",
},
)
move-cursor-to: "#help-button"
assert-css: (
"#help-button:hover",
{"border-color": "rgb(0, 0, 0)"},
)
// Only "border-color" should change.
assert-css: (
"#help-button:hover > button",
{
"color": "rgb(0, 0, 0)",
"border-color": "rgb(113, 113, 113)",
"background-color": "rgb(255, 255, 255)",
},
)
assert-css: (
"#settings-menu",
{"border-color": "rgb(0, 0, 0)"},
)
assert-css: (
"#settings-menu > a",
{
"color": "rgb(56, 115, 173)",
"border-color": "rgb(224, 224, 224)",
"background-color": "rgb(255, 255, 255)",
},
)
move-cursor-to: "#settings-menu"
assert-css: (
"#settings-menu:hover",
{"border-color": "rgb(0, 0, 0)"},
)
// Only "border-color" should change.
assert-css: (
"#settings-menu:hover > a",
{
"color": "rgb(56, 115, 173)",
"border-color": "rgb(113, 113, 113)",
"background-color": "rgb(255, 255, 255)",
},
)

View file

@ -3,9 +3,8 @@ goto: file://|DOC_PATH|/test_docs/index.html
local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": "dark"} local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": "dark"}
reload: reload:
assert-css: (".search-input", {"border-color": "rgb(224, 224, 224)"}) assert-css: (".search-input", {"border-color": "rgb(240, 240, 240)"})
click: ".search-input" click: ".search-input"
focus: ".search-input"
assert-css: (".search-input", {"border-color": "rgb(0, 141, 253)"}) assert-css: (".search-input", {"border-color": "rgb(0, 141, 253)"})
local-storage: {"rustdoc-theme": "light"} local-storage: {"rustdoc-theme": "light"}
@ -18,6 +17,6 @@ assert-css: (".search-input", {"border-color": "rgb(102, 175, 233)"})
local-storage: {"rustdoc-theme": "ayu"} local-storage: {"rustdoc-theme": "ayu"}
reload: reload:
assert-css: (".search-input", {"border-color": "rgb(66, 76, 87)"}) assert-css: (".search-input", {"border-color": "rgb(92, 103, 115)"})
click: ".search-input" click: ".search-input"
assert-css: (".search-input", {"border-color": "rgb(66, 76, 87)"}) assert-css: (".search-input", {"border-color": "rgb(92, 103, 115)"})