Bug 1272653 - Restructure element state test cases; r?jgriffin draft
authorAndreas Tolfsen <ato@mozilla.com>
Fri, 13 May 2016 14:27:36 +0100
changeset 370204 bad5d42a77f0bbb520518ad00e8d74c30c711e9a
parent 370203 94d6088b22234dcc5c753dbd0c782586b5d2a9d9
child 370205 9fb857821b85f1e778c16ebfe5c2ba81e8448d33
push id19009
push userbmo:ato@mozilla.com
push dateTue, 24 May 2016 09:41:57 +0000
reviewersjgriffin
bugs1272653
milestone49.0a1
Bug 1272653 - Restructure element state test cases; r?jgriffin MozReview-Commit-ID: L5rqWpSruYG
testing/marionette/harness/marionette/tests/unit/test_element_state.py
testing/marionette/harness/marionette/tests/unit/test_element_state_chrome.py
--- a/testing/marionette/harness/marionette/tests/unit/test_element_state.py
+++ b/testing/marionette/harness/marionette/tests/unit/test_element_state.py
@@ -1,38 +1,40 @@
 # 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 import MarionetteTestCase
 from marionette_driver.by import By
 
 
-class TestState(MarionetteTestCase):
-    def test_isEnabled(self):
+class TestIsElementEnabled(MarionetteTestCase):
+    def test_is_enabled(self):
         test_html = self.marionette.absolute_url("test.html")
         self.marionette.navigate(test_html)
         l = self.marionette.find_element(By.NAME, "myCheckBox")
         self.assertTrue(l.is_enabled())
         self.marionette.execute_script("arguments[0].disabled = true;", [l])
         self.assertFalse(l.is_enabled())
 
-    def test_isDisplayed(self):
+
+class TestIsElementDisplayed(MarionetteTestCase):
+    def test_is_displayed(self):
         test_html = self.marionette.absolute_url("test.html")
         self.marionette.navigate(test_html)
         l = self.marionette.find_element(By.NAME, "myCheckBox")
         self.assertTrue(l.is_displayed())
         self.marionette.execute_script("arguments[0].hidden = true;", [l])
         self.assertFalse(l.is_displayed())
 
 
-class TestGetAttribute(MarionetteTestCase):
-    def test_getAttribute(self):
+class TestGetElementAttribute(MarionetteTestCase):
+    def test_get(self):
         test_html = self.marionette.absolute_url("test.html")
         self.marionette.navigate(test_html)
         l = self.marionette.find_element(By.ID, "mozLink")
         self.assertEqual("mozLink", l.get_attribute("id"))
 
-    def test_that_we_can_return_a_boolean_attribute_correctly(self):
+    def test_boolean(self):
         test_html = self.marionette.absolute_url("html5/boolean_attributes.html")
         self.marionette.navigate(test_html)
         disabled = self.marionette.find_element(By.ID, "disabled")
         self.assertEqual('true', disabled.get_attribute("disabled"))
--- a/testing/marionette/harness/marionette/tests/unit/test_element_state_chrome.py
+++ b/testing/marionette/harness/marionette/tests/unit/test_element_state_chrome.py
@@ -1,64 +1,68 @@
 # 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 import MarionetteTestCase
 from marionette_driver.by import By
 
 
-class TestStateChrome(MarionetteTestCase):
+class TestIsElementEnabledChrome(MarionetteTestCase):
     def setUp(self):
         MarionetteTestCase.setUp(self)
         self.marionette.set_context("chrome")
         self.win = self.marionette.current_window_handle
         self.marionette.execute_script("window.open('chrome://marionette/content/test.xul', 'foo', 'chrome,centerscreen');")
         self.marionette.switch_to_window('foo')
         self.assertNotEqual(self.win, self.marionette.current_window_handle)
 
     def tearDown(self):
         self.assertNotEqual(self.win, self.marionette.current_window_handle)
         self.marionette.execute_script("window.close();")
         self.marionette.switch_to_window(self.win)
         MarionetteTestCase.tearDown(self)
 
-    def test_isEnabled(self):
+    def test_enabled(self):
         l = self.marionette.find_element(By.ID, "textInput")
         self.assertTrue(l.is_enabled())
         self.marionette.execute_script("arguments[0].disabled = true;", [l])
         self.assertFalse(l.is_enabled())
         self.marionette.execute_script("arguments[0].disabled = false;", [l])
 
     def test_can_get_element_rect(self):
         l = self.marionette.find_element(By.ID, "textInput")
         rect = l.rect
         self.assertTrue(rect['x'] > 0)
         self.assertTrue(rect['y'] > 0)
 
-    ''' Switched on in Bug 896043 to be turned on in Bug 896046
+
+# Switched off in bug 896043,
+# and to be turned on in bug 896046
+"""
+class TestIsElementDisplayed(MarionetteTestCase):
     def test_isDisplayed(self):
         l = self.marionette.find_element(By.ID, "textInput")
         self.assertTrue(l.is_displayed())
         self.marionette.execute_script("arguments[0].hidden = true;", [l])
         self.assertFalse(l.is_displayed())
         self.marionette.execute_script("arguments[0].hidden = false;", [l])
-    '''
+"""
 
 
-class TestGetAttributeChrome(MarionetteTestCase):
+class TestGetElementAttributeChrome(MarionetteTestCase):
     def setUp(self):
         MarionetteTestCase.setUp(self)
         self.marionette.set_context("chrome")
         self.win = self.marionette.current_window_handle
         self.marionette.execute_script("window.open('chrome://marionette/content/test.xul', 'foo', 'chrome,centerscreen');")
         self.marionette.switch_to_window('foo')
         self.assertNotEqual(self.win, self.marionette.current_window_handle)
 
     def tearDown(self):
         self.assertNotEqual(self.win, self.marionette.current_window_handle)
         self.marionette.execute_script("window.close();")
         self.marionette.switch_to_window(self.win)
         MarionetteTestCase.tearDown(self)
 
-    def test_getAttribute(self):
+    def test_get(self):
         el = self.marionette.execute_script("return window.document.getElementById('textInput');")
         self.assertEqual(el.get_attribute("id"), "textInput")