WebDriver: test imported/w3c/webdriver/tests/sessions/new_session/response.py::test_t...
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Jan 2018 16:21:43 +0000 (16:21 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Jan 2018 16:21:43 +0000 (16:21 +0000)
https://bugs.webkit.org/show_bug.cgi?id=180412

Reviewed by Carlos Alberto Lopez Perez.

Source/WebDriver:

Include all missing capabilities in the new session response message.

Fixes: imported/w3c/webdriver/tests/sessions/new_session/response.py::test_resp_capabilites
       imported/w3c/webdriver/tests/sessions/new_session/response.py::test_resp_data
       imported/w3c/webdriver/tests/sessions/new_session/response.py::test_timeouts

* Session.h:
(WebDriver::Session::scriptTimeout const):
(WebDriver::Session::pageLoadTimeout const):
(WebDriver::Session::implicitWaitTimeout const):
* WebDriverService.cpp:
(WebDriver::WebDriverService::newSession):

WebDriverTests:

Remove expectations for imported/w3c/webdriver/tests/sessions/new_session/response.py since all tests are
passing now.

* TestExpectations.json:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227413 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebDriver/ChangeLog
Source/WebDriver/Session.h
Source/WebDriver/WebDriverService.cpp
WebDriverTests/ChangeLog
WebDriverTests/TestExpectations.json

index 3e80205..d4d4c5b 100644 (file)
@@ -1,5 +1,25 @@
 2018-01-23  Carlos Garcia Campos  <cgarcia@igalia.com>
 
+        WebDriver: test imported/w3c/webdriver/tests/sessions/new_session/response.py::test_timeouts fails
+        https://bugs.webkit.org/show_bug.cgi?id=180412
+
+        Reviewed by Carlos Alberto Lopez Perez.
+
+        Include all missing capabilities in the new session response message.
+
+        Fixes: imported/w3c/webdriver/tests/sessions/new_session/response.py::test_resp_capabilites
+               imported/w3c/webdriver/tests/sessions/new_session/response.py::test_resp_data
+               imported/w3c/webdriver/tests/sessions/new_session/response.py::test_timeouts
+
+        * Session.h:
+        (WebDriver::Session::scriptTimeout const):
+        (WebDriver::Session::pageLoadTimeout const):
+        (WebDriver::Session::implicitWaitTimeout const):
+        * WebDriverService.cpp:
+        (WebDriver::WebDriverService::newSession):
+
+2018-01-23  Carlos Garcia Campos  <cgarcia@igalia.com>
+
         WebDriver: matched capabilities should include setWindowRect
         https://bugs.webkit.org/show_bug.cgi?id=180411
 
index fbee80b..5bcd9f6 100644 (file)
@@ -48,10 +48,12 @@ public:
 
     const String& id() const { return m_id; }
     const Capabilities& capabilities() const;
+    Seconds scriptTimeout() const  { return m_scriptTimeout; }
+    Seconds pageLoadTimeout() const { return m_pageLoadTimeout; }
+    Seconds implicitWaitTimeout() const { return m_implicitWaitTimeout; }
 
     enum class FindElementsMode { Single, Multiple };
     enum class ExecuteScriptMode { Sync, Async };
-    enum class Timeout { Script, PageLoad, Implicit };
 
     struct Cookie {
         String name;
index 013bc5a..04368ef 100644 (file)
@@ -647,29 +647,6 @@ void WebDriverService::newSession(RefPtr<JSON::Object>&& parameters, Function<vo
                 capabilitiesObject->setString(ASCIILiteral("platformName"), capabilities.platformName.value());
             if (capabilities.acceptInsecureCerts)
                 capabilitiesObject->setBoolean(ASCIILiteral("acceptInsecureCerts"), capabilities.acceptInsecureCerts.value());
-            if (capabilities.timeouts) {
-                RefPtr<JSON::Object> timeoutsObject = JSON::Object::create();
-                if (capabilities.timeouts.value().script)
-                    timeoutsObject->setInteger(ASCIILiteral("script"), capabilities.timeouts.value().script.value().millisecondsAs<int>());
-                if (capabilities.timeouts.value().pageLoad)
-                    timeoutsObject->setInteger(ASCIILiteral("pageLoad"), capabilities.timeouts.value().pageLoad.value().millisecondsAs<int>());
-                if (capabilities.timeouts.value().implicit)
-                    timeoutsObject->setInteger(ASCIILiteral("implicit"), capabilities.timeouts.value().implicit.value().millisecondsAs<int>());
-                capabilitiesObject->setObject(ASCIILiteral("timeouts"), WTFMove(timeoutsObject));
-            }
-            if (capabilities.pageLoadStrategy) {
-                switch (capabilities.pageLoadStrategy.value()) {
-                case PageLoadStrategy::None:
-                    capabilitiesObject->setString(ASCIILiteral("pageLoadStrategy"), "none");
-                    break;
-                case PageLoadStrategy::Normal:
-                    capabilitiesObject->setString(ASCIILiteral("pageLoadStrategy"), "normal");
-                    break;
-                case PageLoadStrategy::Eager:
-                    capabilitiesObject->setString(ASCIILiteral("pageLoadStrategy"), "eager");
-                    break;
-                }
-            }
             if (capabilities.setWindowRect)
                 capabilitiesObject->setBoolean(ASCIILiteral("setWindowRect"), capabilities.setWindowRect.value());
             if (capabilities.unhandledPromptBehavior) {
@@ -691,6 +668,25 @@ void WebDriverService::newSession(RefPtr<JSON::Object>&& parameters, Function<vo
                     break;
                 }
             }
+            switch (capabilities.pageLoadStrategy.value_or(PageLoadStrategy::Normal)) {
+            case PageLoadStrategy::None:
+                capabilitiesObject->setString(ASCIILiteral("pageLoadStrategy"), "none");
+                break;
+            case PageLoadStrategy::Normal:
+                capabilitiesObject->setString(ASCIILiteral("pageLoadStrategy"), "normal");
+                break;
+            case PageLoadStrategy::Eager:
+                capabilitiesObject->setString(ASCIILiteral("pageLoadStrategy"), "eager");
+                break;
+            }
+            // FIXME: implement proxy support.
+            capabilitiesObject->setObject(ASCIILiteral("proxy"), JSON::Object::create());
+            RefPtr<JSON::Object> timeoutsObject = JSON::Object::create();
+            timeoutsObject->setInteger(ASCIILiteral("script"), m_session->scriptTimeout().millisecondsAs<int>());
+            timeoutsObject->setInteger(ASCIILiteral("pageLoad"), m_session->pageLoadTimeout().millisecondsAs<int>());
+            timeoutsObject->setInteger(ASCIILiteral("implicit"), m_session->implicitWaitTimeout().millisecondsAs<int>());
+            capabilitiesObject->setObject(ASCIILiteral("timeouts"), WTFMove(timeoutsObject));
+
             resultObject->setObject(ASCIILiteral("capabilities"), WTFMove(capabilitiesObject));
             completionHandler(CommandResult::success(WTFMove(resultObject)));
         });
index 71908a2..d19e15a 100644 (file)
@@ -1,5 +1,17 @@
 2018-01-23  Carlos Garcia Campos  <cgarcia@igalia.com>
 
+        WebDriver: test imported/w3c/webdriver/tests/sessions/new_session/response.py::test_timeouts fails
+        https://bugs.webkit.org/show_bug.cgi?id=180412
+
+        Reviewed by Carlos Alberto Lopez Perez.
+
+        Remove expectations for imported/w3c/webdriver/tests/sessions/new_session/response.py since all tests are
+        passing now.
+
+        * TestExpectations.json:
+
+2018-01-23  Carlos Garcia Campos  <cgarcia@igalia.com>
+
         WebDriver: matched capabilities should include setWindowRect
         https://bugs.webkit.org/show_bug.cgi?id=180411
 
index 0255a14..9036bb9 100644 (file)
             }
         }
     },
-    "imported/w3c/webdriver/tests/sessions/new_session/response.py": {
-        "subtests": {
-            "test_resp_capabilites": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            },
-            "test_resp_data": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180412"}}
-            },
-            "test_timeouts": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180412"}}
-            }
-        }
-    },
     "imported/w3c/webdriver/tests/state/get_element_property.py": {
         "subtests": {
             "test_element_not_found": {