зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1569100 - Marionette: Add IsDisplayed, IsEnabled and IsSelected commands and Bool response type. r=ato
Differential Revision: https://phabricator.services.mozilla.com/D41187 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
dcfecbcd60
Коммит
e500fdddbb
|
@ -30,6 +30,8 @@ pub struct ElementRect {
|
||||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
pub enum MarionetteResult {
|
pub enum MarionetteResult {
|
||||||
|
#[serde(deserialize_with = "from_value", serialize_with = "to_value")]
|
||||||
|
Bool(bool),
|
||||||
#[serde(deserialize_with = "from_value", serialize_with = "to_empty_value")]
|
#[serde(deserialize_with = "from_value", serialize_with = "to_empty_value")]
|
||||||
Null,
|
Null,
|
||||||
NewWindow(NewWindow),
|
NewWindow(NewWindow),
|
||||||
|
@ -96,6 +98,11 @@ mod tests {
|
||||||
use crate::test::{assert_de, assert_ser_de, ELEMENT_KEY};
|
use crate::test::{assert_de, assert_ser_de, ELEMENT_KEY};
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_boolean_response() {
|
||||||
|
assert_ser_de(&MarionetteResult::Bool(true), json!({"value": true}));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_cookies_response() {
|
fn test_cookies_response() {
|
||||||
let mut data = Vec::new();
|
let mut data = Vec::new();
|
||||||
|
|
|
@ -115,6 +115,12 @@ pub enum Command {
|
||||||
GetWindowHandles,
|
GetWindowHandles,
|
||||||
#[serde(rename = "WebDriver:GetWindowRect")]
|
#[serde(rename = "WebDriver:GetWindowRect")]
|
||||||
GetWindowRect,
|
GetWindowRect,
|
||||||
|
#[serde(rename = "WebDriver:IsElementDisplayed")]
|
||||||
|
IsDisplayed(LegacyWebElement),
|
||||||
|
#[serde(rename = "WebDriver:IsElementEnabled")]
|
||||||
|
IsEnabled(LegacyWebElement),
|
||||||
|
#[serde(rename = "WebDriver:IsElementSelected")]
|
||||||
|
IsSelected(LegacyWebElement),
|
||||||
#[serde(rename = "WebDriver:MaximizeWindow")]
|
#[serde(rename = "WebDriver:MaximizeWindow")]
|
||||||
MaximizeWindow,
|
MaximizeWindow,
|
||||||
#[serde(rename = "WebDriver:MinimizeWindow")]
|
#[serde(rename = "WebDriver:MinimizeWindow")]
|
||||||
|
|
|
@ -864,6 +864,15 @@ fn try_convert_to_marionette_message(
|
||||||
MarionetteWebDriverCommand::GetWindowRect,
|
MarionetteWebDriverCommand::GetWindowRect,
|
||||||
)),
|
)),
|
||||||
GetTimeouts => Some(Command::WebDriver(MarionetteWebDriverCommand::GetTimeouts)),
|
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(
|
MaximizeWindow => Some(Command::WebDriver(
|
||||||
MarionetteWebDriverCommand::MaximizeWindow,
|
MarionetteWebDriverCommand::MaximizeWindow,
|
||||||
)),
|
)),
|
||||||
|
@ -991,12 +1000,6 @@ impl MarionetteCommand {
|
||||||
GetTitle => (Some("WebDriver:GetTitle"), None),
|
GetTitle => (Some("WebDriver:GetTitle"), None),
|
||||||
GoBack => (Some("WebDriver:Back"), None),
|
GoBack => (Some("WebDriver:Back"), None),
|
||||||
GoForward => (Some("WebDriver:Forward"), 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(_) => {
|
NewSession(_) => {
|
||||||
let caps = capabilities
|
let caps = capabilities
|
||||||
.expect("Tried to create new session without processing capabilities");
|
.expect("Tried to create new session without processing capabilities");
|
||||||
|
|
Загрузка…
Ссылка в новой задаче