Bug 1272653 - Restructure element state test cases; r=jgriffin
authorAndreas Tolfsen <ato@mozilla.com>
Fri, 13 May 2016 14:27:36 +0100
changeset 337742 36021d89d5bf391526d7a29983a14064dc22ba09
parent 337741 685b7400fe1b4a86d22640959cda05a364ed5428
child 337743 2a6a5e53e03f80f4c38df19bd59e682c038ecc58
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgriffin
bugs1272653
milestone49.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 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")