Bug 974891 - Move TestCapabilities to test_capabilities.py file. r=ato
authorVikas Mishra <vikasmishra95@gmail.com>
Fri, 14 Mar 2014 23:57:03 +0530
changeset 190981 a94de1fe002c7ca3c60f7a5a14210c8bd242e501
parent 190980 0d77baea6b5877f2e87e0e764ad2416632c39e2b
child 190982 68199aba42d51b0c6aa91f14347a21553c102f8f
push id3503
push userraliiev@mozilla.com
push dateMon, 28 Apr 2014 18:51:11 +0000
treeherdermozilla-beta@c95ac01e332e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersato
bugs974891
milestone30.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
Bug 974891 - Move TestCapabilities to test_capabilities.py file. r=ato
testing/marionette/client/marionette/tests/unit/test_capabilities.py
testing/marionette/client/marionette/tests/unit/test_session.py
testing/marionette/client/marionette/tests/unit/unit-tests.ini
--- a/testing/marionette/client/marionette/tests/unit/test_capabilities.py
+++ b/testing/marionette/client/marionette/tests/unit/test_capabilities.py
@@ -1,12 +1,58 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from marionette_test import MarionetteTestCase
 
 class TestCapabilities(MarionetteTestCase):
+    def setUp(self):
+        super(TestCapabilities, self).setUp()
+        self.caps = self.marionette.session_capabilities
+        self.marionette.set_context("chrome")
+        self.appinfo = self.marionette.execute_script(
+            "return Services.appinfo")
 
-    def testThatWeCanGetTheCapabilities(self):
-        capabilities = self.marionette.session_capabilities
-        self.assertTrue(capabilities.has_key('takesScreenshot'))
+    def test_mandates_capabilities(self):
+        self.assertIn("browserName", self.caps)
+        self.assertIn("browserVersion", self.caps)
+        self.assertIn("platformName", self.caps)
+        self.assertIn("platformVersion", self.caps)
+
+        self.assertEqual(self.caps["browserName"], self.appinfo["name"])
+        self.assertEqual(self.caps["browserVersion"], self.appinfo["version"])
+        self.assertEqual(self.caps["platformName"], self.appinfo["OS"].upper())
+        self.assertEqual(self.caps["platformVersion"],
+                         self.appinfo["platformVersion"])
+
+    def test_supported_features(self):
+        self.assertIn("cssSelectorsEnabled", self.caps)
+        self.assertIn("handlesAlerts", self.caps)
+        self.assertIn("javascriptEnabled", self.caps)
+        self.assertIn("nativeEvents", self.caps)
+        self.assertIn("rotatable", self.caps)
+        self.assertIn("secureSsl", self.caps)
+        self.assertIn("takesElementScreenshot", self.caps)
+        self.assertIn("takesScreenshot", self.caps)
 
+        self.assertTrue(self.caps["cssSelectorsEnabled"])
+        self.assertFalse(self.caps["handlesAlerts"])
+        self.assertTrue(self.caps["javascriptEnabled"])
+        self.assertFalse(self.caps["nativeEvents"])
+        self.assertEqual(self.caps["rotatable"], self.appinfo["name"] == "B2G")
+        self.assertFalse(self.caps["secureSsl"])
+        self.assertTrue(self.caps["takesElementScreenshot"])
+        self.assertTrue(self.caps["takesScreenshot"])
+
+    def test_selenium2_compat(self):
+        self.assertIn("platform", self.caps)
+        self.assertEqual(self.caps["platform"], self.caps["platformName"])
+
+    def test_extensions(self):
+        self.assertIn("XULappId", self.caps)
+        self.assertIn("appBuildId", self.caps)
+        self.assertIn("device", self.caps)
+        self.assertIn("version", self.caps)
+
+        self.assertEqual(self.caps["XULappId"], self.appinfo["ID"])
+        self.assertEqual(self.caps["appBuildId"], self.appinfo["appBuildID"])
+        self.assertEqual(self.caps["version"], self.appinfo["version"])
--- a/testing/marionette/client/marionette/tests/unit/test_session.py
+++ b/testing/marionette/client/marionette/tests/unit/test_session.py
@@ -26,60 +26,9 @@ class TestSession(marionette_test.Marion
         self.assertIn("cssSelectorsEnabled", caps)
         self.assertIn("device", caps)
         self.assertIn("handlesAlerts", caps)
         self.assertIn("javascriptEnabled", caps)
         self.assertIn("rotatable", caps)
         self.assertIn("takesScreenshot", caps)
         self.assertIn("version", caps)
 
-class TestCapabilities(marionette_test.MarionetteTestCase):
-    def setUp(self):
-        super(TestCapabilities, self).setUp()
-        self.caps = self.marionette.session_capabilities
-        self.marionette.set_context("chrome")
-        self.appinfo = self.marionette.execute_script(
-            "return Services.appinfo")
 
-    def test_mandates_capabilities(self):
-        self.assertIn("browserName", self.caps)
-        self.assertIn("browserVersion", self.caps)
-        self.assertIn("platformName", self.caps)
-        self.assertIn("platformVersion", self.caps)
-
-        self.assertEqual(self.caps["browserName"], self.appinfo["name"])
-        self.assertEqual(self.caps["browserVersion"], self.appinfo["version"])
-        self.assertEqual(self.caps["platformName"], self.appinfo["OS"].upper())
-        self.assertEqual(self.caps["platformVersion"],
-                         self.appinfo["platformVersion"])
-
-    def test_supported_features(self):
-        self.assertIn("cssSelectorsEnabled", self.caps)
-        self.assertIn("handlesAlerts", self.caps)
-        self.assertIn("javascriptEnabled", self.caps)
-        self.assertIn("nativeEvents", self.caps)
-        self.assertIn("rotatable", self.caps)
-        self.assertIn("secureSsl", self.caps)
-        self.assertIn("takesElementScreenshot", self.caps)
-        self.assertIn("takesScreenshot", self.caps)
-
-        self.assertTrue(self.caps["cssSelectorsEnabled"])
-        self.assertFalse(self.caps["handlesAlerts"])
-        self.assertTrue(self.caps["javascriptEnabled"])
-        self.assertFalse(self.caps["nativeEvents"])
-        self.assertEqual(self.caps["rotatable"], self.appinfo["name"] == "B2G")
-        self.assertFalse(self.caps["secureSsl"])
-        self.assertTrue(self.caps["takesElementScreenshot"])
-        self.assertTrue(self.caps["takesScreenshot"])
-
-    def test_selenium2_compat(self):
-        self.assertIn("platform", self.caps)
-        self.assertEqual(self.caps["platform"], self.caps["platformName"])
-
-    def test_extensions(self):
-        self.assertIn("XULappId", self.caps)
-        self.assertIn("appBuildId", self.caps)
-        self.assertIn("device", self.caps)
-        self.assertIn("version", self.caps)
-
-        self.assertEqual(self.caps["XULappId"], self.appinfo["ID"])
-        self.assertEqual(self.caps["appBuildId"], self.appinfo["appBuildID"])
-        self.assertEqual(self.caps["version"], self.appinfo["version"])
--- a/testing/marionette/client/marionette/tests/unit/unit-tests.ini
+++ b/testing/marionette/client/marionette/tests/unit/unit-tests.ini
@@ -7,16 +7,17 @@ browser = true
 
 ; true if the test is compatible with b2g, otherwise false
 b2g = true
 
 ; true if the test should be skipped
 skip = false
 
 [test_session.py]
+[test_capabilities.py]
 
 [test_expectedfail.py]
 expected = fail
 [test_import_script.py]
 [test_import_script_reuse_window.py]
 b2g = false
 [test_click.py]
 [test_click_chrome.py]