webdriver: command, httpapi: add Get Timeouts command (#50)
authorAndreas Tolfsen <ato@mozilla.com>
Thu, 17 Nov 2016 18:18:27 +0000
changeset 428091 fc2ded84e2f7dc28c26d6cca443e2a2c87df3f25
parent 428090 407b87f5bfd43d2e4aa64d4685ba413058cfa930
child 428092 8090084673952e3cd7a3609cd9c9d811aa35c582
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
webdriver: command, httpapi: add Get Timeouts command (#50) Source-Repo: https://github.com/mozilla/webdriver-rust Source-Revision: 89f4b25630be330776ec06b7812015215a647ba4 committer: jgraham <james@hoppipolla.co.uk>
testing/webdriver/src/command.rs
testing/webdriver/src/httpapi.rs
--- a/testing/webdriver/src/command.rs
+++ b/testing/webdriver/src/command.rs
@@ -46,16 +46,17 @@ pub enum WebDriverCommand<T: WebDriverEx
     IsEnabled(WebElement),
     ExecuteScript(JavascriptCommandParameters),
     ExecuteAsyncScript(JavascriptCommandParameters),
     GetCookies,
     GetCookie(String),
     AddCookie(AddCookieParameters),
     DeleteCookies,
     DeleteCookie(String),
+    GetTimeouts,
     SetTimeouts(TimeoutsParameters),
     //Actions(ActionsParameters),
     ElementClick(WebElement),
     ElementTap(WebElement),
     ElementClear(WebElement),
     ElementSendKeys(WebElement, SendKeysParameters),
     DismissAlert,
     AcceptAlert,
@@ -122,16 +123,17 @@ impl <U: WebDriverExtensionRoute> WebDri
             Route::GoBack => WebDriverCommand::GoBack,
             Route::GoForward => WebDriverCommand::GoForward,
             Route::Refresh => WebDriverCommand::Refresh,
             Route::GetTitle => WebDriverCommand::GetTitle,
             Route::GetPageSource => WebDriverCommand::GetPageSource,
             Route::GetWindowHandle => WebDriverCommand::GetWindowHandle,
             Route::GetWindowHandles => WebDriverCommand::GetWindowHandles,
             Route::CloseWindow => WebDriverCommand::CloseWindow,
+            Route::GetTimeouts => WebDriverCommand::GetTimeouts,
             Route::SetTimeouts => {
                 let parameters: TimeoutsParameters = try!(Parameters::from_json(&body_data));
                 WebDriverCommand::SetTimeouts(parameters)
             },
             Route::GetWindowSize => WebDriverCommand::GetWindowSize,
             Route::SetWindowSize => {
                 let parameters: WindowSizeParameters = try!(Parameters::from_json(&body_data));
                 WebDriverCommand::SetWindowSize(parameters)
@@ -339,71 +341,74 @@ impl <U: WebDriverExtensionRoute> WebDri
     fn get_session_id(params: &Captures) -> Option<String> {
         params.name("sessionId").map(|x| x.to_string())
     }
 }
 
 impl <U:WebDriverExtensionRoute> ToJson for WebDriverMessage<U> {
     fn to_json(&self) -> Json {
         let parameters = match self.command {
-            WebDriverCommand::NewSession(_) |
+            WebDriverCommand::AcceptAlert |
+            WebDriverCommand::CloseWindow |
+            WebDriverCommand::DeleteCookie(_) |
+            WebDriverCommand::DeleteCookies |
             WebDriverCommand::DeleteSession |
+            WebDriverCommand::DismissAlert |
+            WebDriverCommand::ElementClear(_) |
+            WebDriverCommand::ElementClick(_) |
+            WebDriverCommand::ElementTap(_) |
+            WebDriverCommand::GetActiveElement |
+            WebDriverCommand::GetAlertText |
+            WebDriverCommand::GetCookie(_) |
+            WebDriverCommand::GetCookies |
+            WebDriverCommand::GetCSSValue(_, _) |
             WebDriverCommand::GetCurrentUrl |
-            WebDriverCommand::GoBack |
-            WebDriverCommand::GoForward |
-            WebDriverCommand::Refresh |
-            WebDriverCommand::GetTitle |
-            WebDriverCommand::GetPageSource |
-            WebDriverCommand::GetWindowHandle |
-            WebDriverCommand::GetWindowHandles |
-            WebDriverCommand::CloseWindow |
-            WebDriverCommand::GetWindowSize |
-            WebDriverCommand::GetWindowPosition |
-            WebDriverCommand::MaximizeWindow |
-            WebDriverCommand::SwitchToParentFrame |
-            WebDriverCommand::GetActiveElement |
-            WebDriverCommand::IsDisplayed(_) |
-            WebDriverCommand::IsSelected(_) |
             WebDriverCommand::GetElementAttribute(_, _) |
             WebDriverCommand::GetElementProperty(_, _) |
-            WebDriverCommand::GetCSSValue(_, _) |
+            WebDriverCommand::GetElementRect(_) |
+            WebDriverCommand::GetElementTagName(_) |
             WebDriverCommand::GetElementText(_) |
-            WebDriverCommand::GetElementTagName(_) |
-            WebDriverCommand::GetElementRect(_) |
+            WebDriverCommand::GetPageSource |
+            WebDriverCommand::GetTimeouts |
+            WebDriverCommand::GetTitle |
+            WebDriverCommand::GetWindowHandle |
+            WebDriverCommand::GetWindowHandles |
+            WebDriverCommand::GetWindowPosition |
+            WebDriverCommand::GetWindowSize |
+            WebDriverCommand::GoBack |
+            WebDriverCommand::GoForward |
+            WebDriverCommand::IsDisplayed(_) |
             WebDriverCommand::IsEnabled(_) |
-            WebDriverCommand::GetCookies |
-            WebDriverCommand::GetCookie(_) |
-            WebDriverCommand::DeleteCookies |
-            WebDriverCommand::DeleteCookie(_) |
-            WebDriverCommand::DismissAlert |
-            WebDriverCommand::AcceptAlert |
-            WebDriverCommand::GetAlertText |
-            WebDriverCommand::ElementClick(_) |
-            WebDriverCommand::ElementTap(_) |
-            WebDriverCommand::ElementClear(_) |
-            WebDriverCommand::TakeScreenshot |
+            WebDriverCommand::IsSelected(_) |
+            WebDriverCommand::MaximizeWindow |
+            WebDriverCommand::NewSession(_) |
+            WebDriverCommand::Refresh |
+            WebDriverCommand::Status |
+            WebDriverCommand::SwitchToParentFrame |
             WebDriverCommand::TakeElementScreenshot(_) |
-            WebDriverCommand::Status => {
+            WebDriverCommand::TakeScreenshot => {
                 None
             },
-            WebDriverCommand::Get(ref x) => Some(x.to_json()),
-            WebDriverCommand::SetTimeouts(ref x) => Some(x.to_json()),
-            WebDriverCommand::SetWindowSize(ref x) => Some(x.to_json()),
-            WebDriverCommand::SetWindowPosition(ref x) => Some(x.to_json()),
-            WebDriverCommand::SwitchToWindow(ref x) => Some(x.to_json()),
-            WebDriverCommand::SwitchToFrame(ref x) => Some(x.to_json()),
+
+            WebDriverCommand::AddCookie(ref x) => Some(x.to_json()),
+            WebDriverCommand::ElementSendKeys(_, ref x) => Some(x.to_json()),
+            WebDriverCommand::ExecuteAsyncScript(ref x) |
+            WebDriverCommand::ExecuteScript(ref x) => Some(x.to_json()),
+            WebDriverCommand::FindElementElement(_, ref x) => Some(x.to_json()),
+            WebDriverCommand::FindElementElements(_, ref x) => Some(x.to_json()),
             WebDriverCommand::FindElement(ref x) => Some(x.to_json()),
             WebDriverCommand::FindElements(ref x) => Some(x.to_json()),
-            WebDriverCommand::FindElementElement(_, ref x) => Some(x.to_json()),
-            WebDriverCommand::FindElementElements(_, ref x) => Some(x.to_json()),
-            WebDriverCommand::ElementSendKeys(_, ref x) => Some(x.to_json()),
-            WebDriverCommand::ExecuteScript(ref x) |
-            WebDriverCommand::ExecuteAsyncScript(ref x) => Some(x.to_json()),
-            WebDriverCommand::AddCookie(ref x) => Some(x.to_json()),
+            WebDriverCommand::Get(ref x) => Some(x.to_json()),
             WebDriverCommand::SendAlertText(ref x) => Some(x.to_json()),
+            WebDriverCommand::SetTimeouts(ref x) => Some(x.to_json()),
+            WebDriverCommand::SetWindowPosition(ref x) => Some(x.to_json()),
+            WebDriverCommand::SetWindowSize(ref x) => Some(x.to_json()),
+            WebDriverCommand::SwitchToFrame(ref x) => Some(x.to_json()),
+            WebDriverCommand::SwitchToWindow(ref x) => Some(x.to_json()),
+
             WebDriverCommand::Extension(ref x) => x.parameters_json(),
         };
 
         let mut data = BTreeMap::new();
         if let Some(parameters) = parameters {
             data.insert("parameters".to_string(), parameters);
         }
         Json::Object(data)
--- a/testing/webdriver/src/httpapi.rs
+++ b/testing/webdriver/src/httpapi.rs
@@ -45,16 +45,17 @@ fn standard_routes<U:WebDriverExtensionR
                 (Get, "/session/{sessionId}/element/{elementId}/enabled", Route::IsEnabled),
                 (Post, "/session/{sessionId}/execute/sync", Route::ExecuteScript),
                 (Post, "/session/{sessionId}/execute/async", Route::ExecuteAsyncScript),
                 (Get, "/session/{sessionId}/cookie", Route::GetCookies),
                 (Get, "/session/{sessionId}/cookie/{name}", Route::GetCookie),
                 (Post, "/session/{sessionId}/cookie", Route::AddCookie),
                 (Delete, "/session/{sessionId}/cookie", Route::DeleteCookies),
                 (Delete, "/session/{sessionId}/cookie/{name}", Route::DeleteCookie),
+                (Get, "/session/{sessionId}/timeouts", Route::GetTimeouts),
                 (Post, "/session/{sessionId}/timeouts", Route::SetTimeouts),
                 //(Post, "/session/{sessionId}/actions", Route::Actions),
                 (Post, "/session/{sessionId}/element/{elementId}/click", Route::ElementClick),
                 (Post, "/session/{sessionId}/element/{elementId}/tap", Route::ElementTap),
                 (Post, "/session/{sessionId}/element/{elementId}/clear", Route::ElementClear),
                 (Post, "/session/{sessionId}/element/{elementId}/value", Route::ElementSendKeys),
                 (Post, "/session/{sessionId}/alert/dismiss", Route::DismissAlert),
                 (Post, "/session/{sessionId}/alert/accept", Route::AcceptAlert),
@@ -114,16 +115,17 @@ pub enum Route<U:WebDriverExtensionRoute
     IsEnabled,
     ExecuteScript,
     ExecuteAsyncScript,
     GetCookies,
     GetCookie,
     AddCookie,
     DeleteCookies,
     DeleteCookie,
+    GetTimeouts,
     SetTimeouts,
     //Actions XXX - once I understand the spec, perhaps
     ElementClick,
     ElementTap,
     ElementClear,
     ElementSendKeys,
     DismissAlert,
     AcceptAlert,