Bug 1326534 - Correct capability wrapping in tests; r=automatedtester
authorAndreas Tolfsen <ato@mozilla.com>
Fri, 30 Dec 2016 14:12:53 +0000
changeset 353417 8b2278c947ebfd1b1e9758f4f6351c43bd06476a
parent 353416 95e1ee87b0543380ec058ac9b3337bcd6fe5965c
child 353418 a77fb55d711d0dfc9df080dcc8a4850986a7cd42
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersautomatedtester
bugs1326534
milestone52.0a2
Bug 1326534 - Correct capability wrapping in tests; r=automatedtester Capabilities should be sent in either a `desiredCapabilities` or a `requiredCapabilities` block inside `capabilities`: {capabilities: {requiredCapabilities: {acceptInsecureCerts: true}}} Marionette currently accepts capabilities in the top-level dictionary, but this is not conforming to the WebDriver. MozReview-Commit-ID: 9JWjvPKBp6S
testing/marionette/harness/marionette_harness/tests/unit/test_accessibility.py
testing/marionette/harness/marionette_harness/tests/unit/test_click.py
testing/marionette/harness/marionette_harness/tests/unit/test_navigation.py
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_accessibility.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_accessibility.py
@@ -87,17 +87,22 @@ class TestAccessibility(MarionetteTestCa
 
     def run_element_test(self, ids, testFn):
         for id in ids:
             element = self.marionette.find_element(By.ID, id)
             testFn(element)
 
     def setup_accessibility(self, enable_a11y_checks=True, navigate=True):
         self.marionette.delete_session()
-        self.marionette.start_session({"moz:accessibilityChecks": enable_a11y_checks})
+        self.marionette.start_session(
+            {"requiredCapabilities": {"moz:accessibilityChecks": enable_a11y_checks}})
+        self.assertEqual(
+            self.marionette.session_capabilities["moz:accessibilityChecks"],
+            enable_a11y_checks)
+
         # Navigate to test_accessibility.html
         if navigate:
             test_accessibility = self.marionette.absolute_url("test_accessibility.html")
             self.marionette.navigate(test_accessibility)
 
     def test_valid_single_tap(self):
         self.setup_accessibility()
         # No exception should be raised
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_click.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_click.py
@@ -94,17 +94,18 @@ class TestLegacyClick(MarionetteTestCase
 class TestClick(TestLegacyClick):
     """Uses WebDriver specification compatible element interactability
     checks.
     """
 
     def setUp(self):
         TestLegacyClick.setUp(self)
         self.marionette.delete_session()
-        self.marionette.start_session({"specificationLevel": 1})
+        self.marionette.start_session(
+            {"requiredCapabilities": {"specificationLevel": 1}})
 
     def test_click_element_obscured_by_absolute_positioned_element(self):
         self.marionette.navigate(inline("""
             <style>
             * { margin: 0; padding: 0; }
             div { display: block; width: 100%; height: 100%; }
             #obscured { background-color: blue }
             #overlay { background-color: red; position: absolute; top: 0; }
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_navigation.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_navigation.py
@@ -196,40 +196,40 @@ class TestNavigate(WindowManagerMixin, M
 class TestTLSNavigation(MarionetteTestCase):
     insecure_tls = {"acceptInsecureCerts": True}
     secure_tls = {"acceptInsecureCerts": False}
 
     def setUp(self):
         MarionetteTestCase.setUp(self)
         self.marionette.delete_session()
         self.capabilities = self.marionette.start_session(
-            desired_capabilities=self.insecure_tls)
+            {"requiredCapabilities": self.insecure_tls})
 
     def tearDown(self):
         try:
             self.marionette.delete_session()
         except:
             pass
         MarionetteTestCase.tearDown(self)
 
     @contextlib.contextmanager
     def safe_session(self):
         try:
             self.capabilities = self.marionette.start_session(
-                desired_capabilities=self.secure_tls)
+                {"requiredCapabilities": self.secure_tls})
             self.assertFalse(self.capabilities["acceptInsecureCerts"])
             yield self.marionette
         finally:
             self.marionette.delete_session()
 
     @contextlib.contextmanager
     def unsafe_session(self):
         try:
             self.capabilities = self.marionette.start_session(
-                desired_capabilities=self.insecure_tls)
+                {"requiredCapabilities": self.insecure_tls})
             self.assertTrue(self.capabilities["acceptInsecureCerts"])
             yield self.marionette
         finally:
             self.marionette.delete_session()
 
     def test_navigate_by_command(self):
         self.marionette.navigate(
             self.fixtures.where_is("/test.html", on="https"))