diff --git a/testing/geckodriver/marionette/src/result.rs b/testing/geckodriver/marionette/src/result.rs index 6cb33ec1ff12..218a06843763 100644 --- a/testing/geckodriver/marionette/src/result.rs +++ b/testing/geckodriver/marionette/src/result.rs @@ -30,6 +30,8 @@ pub struct ElementRect { #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(untagged)] pub enum MarionetteResult { + #[serde(deserialize_with = "from_value", serialize_with = "to_value")] + Bool(bool), #[serde(deserialize_with = "from_value", serialize_with = "to_empty_value")] Null, NewWindow(NewWindow), @@ -96,6 +98,11 @@ mod tests { use crate::test::{assert_de, assert_ser_de, ELEMENT_KEY}; use serde_json::json; + #[test] + fn test_boolean_response() { + assert_ser_de(&MarionetteResult::Bool(true), json!({"value": true})); + } + #[test] fn test_cookies_response() { let mut data = Vec::new(); diff --git a/testing/geckodriver/marionette/src/webdriver.rs b/testing/geckodriver/marionette/src/webdriver.rs index c90818d3e55d..d9dbb7061ca1 100644 --- a/testing/geckodriver/marionette/src/webdriver.rs +++ b/testing/geckodriver/marionette/src/webdriver.rs @@ -115,6 +115,12 @@ pub enum Command { GetWindowHandles, #[serde(rename = "WebDriver:GetWindowRect")] GetWindowRect, + #[serde(rename = "WebDriver:IsElementDisplayed")] + IsDisplayed(LegacyWebElement), + #[serde(rename = "WebDriver:IsElementEnabled")] + IsEnabled(LegacyWebElement), + #[serde(rename = "WebDriver:IsElementSelected")] + IsSelected(LegacyWebElement), #[serde(rename = "WebDriver:MaximizeWindow")] MaximizeWindow, #[serde(rename = "WebDriver:MinimizeWindow")] diff --git a/testing/geckodriver/src/marionette.rs b/testing/geckodriver/src/marionette.rs index 84efc1b26a97..387aa3e9d091 100644 --- a/testing/geckodriver/src/marionette.rs +++ b/testing/geckodriver/src/marionette.rs @@ -864,6 +864,15 @@ fn try_convert_to_marionette_message( MarionetteWebDriverCommand::GetWindowRect, )), GetTimeouts => Some(Command::WebDriver(MarionetteWebDriverCommand::GetTimeouts)), + IsDisplayed(ref x) => Some(Command::WebDriver(MarionetteWebDriverCommand::IsDisplayed( + x.to_marionette()?, + ))), + IsEnabled(ref x) => Some(Command::WebDriver(MarionetteWebDriverCommand::IsEnabled( + x.to_marionette()?, + ))), + IsSelected(ref x) => Some(Command::WebDriver(MarionetteWebDriverCommand::IsSelected( + x.to_marionette()?, + ))), MaximizeWindow => Some(Command::WebDriver( MarionetteWebDriverCommand::MaximizeWindow, )), @@ -991,12 +1000,6 @@ impl MarionetteCommand { GetTitle => (Some("WebDriver:GetTitle"), None), GoBack => (Some("WebDriver:Back"), None), GoForward => (Some("WebDriver:Forward"), None), - IsDisplayed(ref x) => ( - Some("WebDriver:IsElementDisplayed"), - Some(x.to_marionette()), - ), - IsEnabled(ref x) => (Some("WebDriver:IsElementEnabled"), Some(x.to_marionette())), - IsSelected(ref x) => (Some("WebDriver:IsElementSelected"), Some(x.to_marionette())), NewSession(_) => { let caps = capabilities .expect("Tried to create new session without processing capabilities");