diff --git a/testing/marionette/harness/marionette/tests/unit/test_elementState.py b/testing/marionette/harness/marionette/tests/unit/test_element_state.py similarity index 62% rename from testing/marionette/harness/marionette/tests/unit/test_elementState.py rename to testing/marionette/harness/marionette/tests/unit/test_element_state.py index eb5351d8d510..f327a4492f5e 100644 --- a/testing/marionette/harness/marionette/tests/unit/test_elementState.py +++ b/testing/marionette/harness/marionette/tests/unit/test_element_state.py @@ -22,3 +22,17 @@ class TestState(MarionetteTestCase): 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")) diff --git a/testing/marionette/harness/marionette/tests/unit/test_elementState_chrome.py b/testing/marionette/harness/marionette/tests/unit/test_element_state_chrome.py similarity index 67% rename from testing/marionette/harness/marionette/tests/unit/test_elementState_chrome.py rename to testing/marionette/harness/marionette/tests/unit/test_element_state_chrome.py index ea50d445c212..d1f179704fbc 100644 --- a/testing/marionette/harness/marionette/tests/unit/test_elementState_chrome.py +++ b/testing/marionette/harness/marionette/tests/unit/test_element_state_chrome.py @@ -41,4 +41,24 @@ class TestStateChrome(MarionetteTestCase): 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 + ''' + + +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") diff --git a/testing/marionette/harness/marionette/tests/unit/test_getattr.py b/testing/marionette/harness/marionette/tests/unit/test_getattr.py deleted file mode 100644 index 431ec947a906..000000000000 --- 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")) diff --git a/testing/marionette/harness/marionette/tests/unit/test_getattr_chrome.py b/testing/marionette/harness/marionette/tests/unit/test_getattr_chrome.py deleted file mode 100644 index e05f47c120da..000000000000 --- 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") - diff --git a/testing/marionette/harness/marionette/tests/unit/unit-tests.ini b/testing/marionette/harness/marionette/tests/unit/unit-tests.ini index 4c3d753a854d..3fdee1bcc7a7 100644 --- a/testing/marionette/harness/marionette/tests/unit/unit-tests.ini +++ b/testing/marionette/harness/marionette/tests/unit/unit-tests.ini @@ -16,16 +16,13 @@ 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] @@ -134,4 +131,4 @@ skip-if = buildapp == 'b2g' || os == "win" # http://bugs.python.org/issue14574 [test_chrome.py] skip-if = buildapp == 'b2g' -[test_addons.py] +[test_addons.py] \ No newline at end of file