Update GUI tests

This commit is contained in:
Guillaume Gomez 2022-05-11 23:11:31 +02:00
parent e8762757c3
commit 44e5b3bf3e
3 changed files with 20 additions and 34 deletions

View file

@ -5,36 +5,25 @@ assert-false: "#settings"
// We now click on the settings button.
click: "#settings-menu"
wait-for: "#settings"
assert: "#main-content.hidden"
assert-css: ("#settings", {"display": "block"})
// Let's close it by clicking on the same button.
click: "#settings-menu"
assert-false: "#alternative-display #settings"
assert: "#not-displayed #settings"
assert: "#main-content:not(.hidden)"
// Let's open and then close it again with the "close settings" button.
click: "#settings-menu"
wait-for: "#alternative-display #settings"
assert: "#main-content.hidden"
click: "#back"
wait-for: "#not-displayed #settings"
assert: "#main-content:not(.hidden)"
wait-for-css: ("#settings", {"display": "none"})
// Let's check that pressing "ESCAPE" is closing it.
click: "#settings-menu"
wait-for: "#alternative-display #settings"
wait-for-css: ("#settings", {"display": "block"})
press-key: "Escape"
wait-for: "#not-displayed #settings"
assert: "#main-content:not(.hidden)"
wait-for-css: ("#settings", {"display": "none"})
// Let's click on it when the search results are displayed.
focus: ".search-input"
write: "test"
wait-for: "#alternative-display #search"
click: "#settings-menu"
wait-for: "#alternative-display #settings"
assert: "#not-displayed #search"
wait-for-css: ("#settings", {"display": "block"})
// Ensure that the search is still displayed.
wait-for: "#alternative-display #search"
assert: "#main-content.hidden"
// Now let's check the content of the settings menu.

View file

@ -12,15 +12,3 @@ assert-css: ("#help", {"display": "flex"})
assert-false: "#help.hidden"
press-key: "Escape"
assert-css: ("#help.hidden", {"display": "none"})
// Check for the themes list.
assert-css: ("#theme-choices", {"display": "none"})
press-key: "t"
assert-css: ("#theme-choices", {"display": "block"})
press-key: "t"
// We ensure that 't' hides back the menu.
assert-css: ("#theme-choices", {"display": "none"})
press-key: "t"
assert-css: ("#theme-choices", {"display": "block"})
press-key: "Escape"
// We ensure that 'Escape' hides the menu too.
assert-css: ("#theme-choices", {"display": "none"})

View file

@ -1,12 +1,21 @@
// Ensures that the theme change is working as expected.
goto: file://|DOC_PATH|/test_docs/index.html
click: "#theme-picker"
click: "#theme-choices > button:first-child"
// should be the ayu theme so let's check the color
local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": "dark"}
reload:
click: "#settings-menu"
wait-for: "#theme-ayu"
click: "#theme-ayu"
// should be the ayu theme so let's check the color.
wait-for-css: ("body", { "background-color": "rgb(15, 20, 25)" })
click: "#theme-choices > button:last-child"
// should be the light theme so let's check the color
assert-local-storage: { "rustdoc-theme": "ayu" }
click: "#theme-light"
// should be the light theme so let's check the color.
wait-for-css: ("body", { "background-color": "rgb(255, 255, 255)" })
assert-local-storage: { "rustdoc-theme": "light" }
click: "#theme-dark"
// Should be the dark theme so let's check the color.
wait-for-css: ("body", { "background-color": "rgb(53, 53, 53)" })
assert-local-storage: { "rustdoc-theme": "dark" }
goto: file://|DOC_PATH|/settings.html
wait-for: "#settings"