Bug 1272653 - Merge element state tests; r?jgriffin draft
authorAndreas Tolfsen <ato@mozilla.com>
Fri, 13 May 2016 14:23:10 +0100
changeset 370203 94d6088b22234dcc5c753dbd0c782586b5d2a9d9
parent 370189 6da876371bb4d5e385b2b20bb15a392a72bf5ae3
child 370204 bad5d42a77f0bbb520518ad00e8d74c30c711e9a
push id19009
push userbmo:ato@mozilla.com
push dateTue, 24 May 2016 09:41:57 +0000
reviewersjgriffin
bugs1272653
milestone49.0a1
Bug 1272653 - Merge element state tests; r?jgriffin Renames test_elementState.py to test_element_state.py to patch Python naming conventions. Merges test_getattr*.py tests into test_element_state.py to match WebDriver specification chapter structure. MozReview-Commit-ID: GkHgaUCdktp
testing/marionette/harness/marionette/tests/unit/test_elementState.py
testing/marionette/harness/marionette/tests/unit/test_elementState_chrome.py
testing/marionette/harness/marionette/tests/unit/test_element_state.py
testing/marionette/harness/marionette/tests/unit/test_element_state_chrome.py
testing/marionette/harness/marionette/tests/unit/test_getattr.py
testing/marionette/harness/marionette/tests/unit/test_getattr_chrome.py
testing/marionette/harness/marionette/tests/unit/unit-tests.ini
deleted file mode 100644
--- a/testing/marionette/harness/marionette/tests/unit/test_elementState.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# 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):
-        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):
-        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())
deleted file mode 100644
--- a/testing/marionette/harness/marionette/tests/unit/test_elementState_chrome.py
+++ /dev/null
@@ -1,44 +0,0 @@
-# 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):
-    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):
-        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
-    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])
-    '''
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/testing/marionette/harness/marionette/tests/unit/test_element_state.py
@@ -0,0 +1,38 @@
+# 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):
+        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):
+        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):
+        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):
+        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"))
new file mode 100644
--- /dev/null
+++ b/testing/marionette/harness/marionette/tests/unit/test_element_state_chrome.py
@@ -0,0 +1,64 @@
+# 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):
+    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):
+        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
+    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):
+    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):
+        el = self.marionette.execute_script("return window.document.getElementById('textInput');")
+        self.assertEqual(el.get_attribute("id"), "textInput")
deleted file mode 100644
--- a/testing/marionette/harness/marionette/tests/unit/test_getattr.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# 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 TestGetAttribute(MarionetteTestCase):
-    def test_getAttribute(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):
-        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"))
deleted file mode 100644
--- a/testing/marionette/harness/marionette/tests/unit/test_getattr_chrome.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# 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
-
-
-class TestGetAttributeChrome(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):
-        el = self.marionette.execute_script("return window.document.getElementById('textInput');")
-        self.assertEqual(el.get_attribute("id"), "textInput")
-
--- a/testing/marionette/harness/marionette/tests/unit/unit-tests.ini
+++ b/testing/marionette/harness/marionette/tests/unit/unit-tests.ini
@@ -11,26 +11,23 @@ expected = fail
 [test_import_script.py]
 skip-if = buildapp == 'b2g'
 [test_click.py]
 [test_click_chrome.py]
 skip-if = buildapp == 'b2g'
 [test_selected.py]
 [test_selected_chrome.py]
 skip-if = buildapp == 'b2g'
-[test_getattr.py]
-[test_getattr_chrome.py]
-skip-if = buildapp == 'b2g'
 [test_elementsize.py]
 [test_position.py]
 [test_rendered_element.py]
 [test_chrome_element_css.py]
 skip-if = buildapp == 'b2g'
-[test_elementState.py]
-[test_elementState_chrome.py]
+[test_element_state.py]
+[test_element_state_chrome.py]
 skip-if = buildapp == 'b2g'
 [test_text.py]
 [test_text_chrome.py]
 skip-if = true # "Bug 896046"
 
 [test_clearing.py]
 [test_typing.py]
 
@@ -129,9 +126,9 @@ skip-if = buildapp == 'b2g' || os == "wi
 [test_using_permissions.py]
 [test_using_prefs.py]
 
 [test_shadow_dom.py]
 
 [test_chrome.py]
 skip-if = buildapp == 'b2g'
 
-[test_addons.py]
+[test_addons.py]
\ No newline at end of file