mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-04 19:29:07 +00:00
Add GUI test for settings menu
This commit is contained in:
parent
9625ed8be7
commit
e7d7d75c81
@ -4,17 +4,20 @@ goto: file://|DOC_PATH|/test_docs/index.html
|
|||||||
// First, we check that the search results are hidden when the Escape key is pressed.
|
// First, we check that the search results are hidden when the Escape key is pressed.
|
||||||
write: (".search-input", "test")
|
write: (".search-input", "test")
|
||||||
wait-for: "#search h1" // The search element is empty before the first search
|
wait-for: "#search h1" // The search element is empty before the first search
|
||||||
assert-attribute: ("#search", {"class": "content"})
|
// Check that the currently displayed element is search.
|
||||||
|
wait-for: "#alternative-display #search"
|
||||||
assert-attribute: ("#main-content", {"class": "content hidden"})
|
assert-attribute: ("#main-content", {"class": "content hidden"})
|
||||||
assert-document-property: ({"URL": "index.html?search=test"}, ENDS_WITH)
|
assert-document-property: ({"URL": "index.html?search=test"}, ENDS_WITH)
|
||||||
press-key: "Escape"
|
press-key: "Escape"
|
||||||
assert-attribute: ("#search", {"class": "content hidden"})
|
// Checks that search is no longer in the displayed content.
|
||||||
|
wait-for: "#not-displayed #search"
|
||||||
|
assert-false: "#alternative-display #search"
|
||||||
assert-attribute: ("#main-content", {"class": "content"})
|
assert-attribute: ("#main-content", {"class": "content"})
|
||||||
assert-document-property: ({"URL": "index.html"}, [ENDS_WITH])
|
assert-document-property: ({"URL": "index.html"}, [ENDS_WITH])
|
||||||
|
|
||||||
// Check that focusing the search input brings back the search results
|
// Check that focusing the search input brings back the search results
|
||||||
focus: ".search-input"
|
focus: ".search-input"
|
||||||
assert-attribute: ("#search", {"class": "content"})
|
wait-for: "#alternative-display #search"
|
||||||
assert-attribute: ("#main-content", {"class": "content hidden"})
|
assert-attribute: ("#main-content", {"class": "content hidden"})
|
||||||
assert-document-property: ({"URL": "index.html?search=test"}, ENDS_WITH)
|
assert-document-property: ({"URL": "index.html?search=test"}, ENDS_WITH)
|
||||||
|
|
||||||
@ -24,8 +27,8 @@ click: "#help-button"
|
|||||||
assert-document-property: ({"URL": "index.html?search=test"}, [ENDS_WITH])
|
assert-document-property: ({"URL": "index.html?search=test"}, [ENDS_WITH])
|
||||||
assert-attribute: ("#help", {"class": ""})
|
assert-attribute: ("#help", {"class": ""})
|
||||||
press-key: "Escape"
|
press-key: "Escape"
|
||||||
|
wait-for: "#alternative-display #search"
|
||||||
assert-attribute: ("#help", {"class": "hidden"})
|
assert-attribute: ("#help", {"class": "hidden"})
|
||||||
assert-attribute: ("#search", {"class": "content"})
|
|
||||||
assert-attribute: ("#main-content", {"class": "content hidden"})
|
assert-attribute: ("#main-content", {"class": "content hidden"})
|
||||||
assert-document-property: ({"URL": "index.html?search=test"}, [ENDS_WITH])
|
assert-document-property: ({"URL": "index.html?search=test"}, [ENDS_WITH])
|
||||||
|
|
||||||
@ -37,5 +40,6 @@ assert-false: ".search-input:focus"
|
|||||||
assert: "#results a:focus"
|
assert: "#results a:focus"
|
||||||
press-key: "Escape"
|
press-key: "Escape"
|
||||||
assert-attribute: ("#help", {"class": "hidden"})
|
assert-attribute: ("#help", {"class": "hidden"})
|
||||||
assert-attribute: ("#search", {"class": "content hidden"})
|
wait-for: "#not-displayed #search"
|
||||||
|
assert-false: "#alternative-display #search"
|
||||||
assert-attribute: ("#main-content", {"class": "content"})
|
assert-attribute: ("#main-content", {"class": "content"})
|
||||||
|
38
src/test/rustdoc-gui/settings.goml
Normal file
38
src/test/rustdoc-gui/settings.goml
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
// This test ensures that the settings menu display is working as expected.
|
||||||
|
goto: file://|DOC_PATH|/test_docs/index.html
|
||||||
|
// First, we check that the settings page doesn't exist.
|
||||||
|
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)"
|
||||||
|
|
||||||
|
// Let's check that pressing "ESCAPE" is closing it.
|
||||||
|
click: "#settings-menu"
|
||||||
|
wait-for: "#alternative-display #settings"
|
||||||
|
press-key: "Escape"
|
||||||
|
wait-for: "#not-displayed #settings"
|
||||||
|
assert: "#main-content:not(.hidden)"
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
assert: "#main-content.hidden"
|
@ -9,6 +9,7 @@ click: "#theme-choices > button:last-child"
|
|||||||
wait-for-css: ("body", { "background-color": "rgb(255, 255, 255)" })
|
wait-for-css: ("body", { "background-color": "rgb(255, 255, 255)" })
|
||||||
|
|
||||||
goto: file://|DOC_PATH|/settings.html
|
goto: file://|DOC_PATH|/settings.html
|
||||||
|
wait-for: "#settings"
|
||||||
click: "#theme-light"
|
click: "#theme-light"
|
||||||
wait-for-css: ("body", { "background-color": "rgb(255, 255, 255)" })
|
wait-for-css: ("body", { "background-color": "rgb(255, 255, 255)" })
|
||||||
assert-local-storage: { "rustdoc-theme": "light" }
|
assert-local-storage: { "rustdoc-theme": "light" }
|
||||||
|
@ -1,15 +1,19 @@
|
|||||||
// Ensures that the theme is working when going back in history.
|
// Ensures that the theme is working when going back in history.
|
||||||
goto: file://|DOC_PATH|/test_docs/index.html
|
goto: file://|DOC_PATH|/test_docs/index.html
|
||||||
// Set the theme to dark.
|
// Set the theme to dark.
|
||||||
local-storage: {"rustdoc-theme": "dark", "rustdoc-preferred-dark-theme": "dark", "rustdoc-use-system-theme": "false"}
|
local-storage: {
|
||||||
|
"rustdoc-theme": "dark",
|
||||||
|
"rustdoc-preferred-dark-theme": "dark",
|
||||||
|
"rustdoc-use-system-theme": "false",
|
||||||
|
}
|
||||||
// We reload the page so the local storage settings are being used.
|
// We reload the page so the local storage settings are being used.
|
||||||
reload:
|
reload:
|
||||||
assert-css: ("body", { "background-color": "rgb(53, 53, 53)" })
|
assert-css: ("body", { "background-color": "rgb(53, 53, 53)" })
|
||||||
assert-local-storage: { "rustdoc-theme": "dark" }
|
assert-local-storage: { "rustdoc-theme": "dark" }
|
||||||
|
|
||||||
// Now we go to the settings page.
|
// Now we go to the settings page.
|
||||||
click: "#settings-menu"
|
goto: file://|DOC_PATH|/settings.html
|
||||||
wait-for: ".settings"
|
wait-for: "#settings"
|
||||||
// We change the theme to "light".
|
// We change the theme to "light".
|
||||||
click: "#theme-light"
|
click: "#theme-light"
|
||||||
wait-for-css: ("body", { "background-color": "rgb(255, 255, 255)" })
|
wait-for-css: ("body", { "background-color": "rgb(255, 255, 255)" })
|
||||||
@ -18,7 +22,7 @@ assert-local-storage: { "rustdoc-theme": "light" }
|
|||||||
// We go back in history.
|
// We go back in history.
|
||||||
history-go-back:
|
history-go-back:
|
||||||
// Confirm that we're not on the settings page.
|
// Confirm that we're not on the settings page.
|
||||||
assert-false: ".settings"
|
assert-false: "#settings"
|
||||||
// Check that the current theme is still "light".
|
// Check that the current theme is still "light".
|
||||||
assert-css: ("body", { "background-color": "rgb(255, 255, 255)" })
|
assert-css: ("body", { "background-color": "rgb(255, 255, 255)" })
|
||||||
assert-local-storage: { "rustdoc-theme": "light" }
|
assert-local-storage: { "rustdoc-theme": "light" }
|
||||||
|
Loading…
Reference in New Issue
Block a user