From 83aed9b889054dab7129bc3d33d3d568fb446354 Mon Sep 17 00:00:00 2001 From: Jonathan Griffin Date: Tue, 6 Aug 2013 17:34:30 -0700 Subject: [PATCH] Bug 790787 - Enable more unit tests on B2G. r=mdas --- .../marionette/tests/unit/test_click.py | 26 ------- .../tests/unit/test_click_chrome.py | 32 ++++++++ .../tests/unit/test_elementState.py | 33 +------- .../tests/unit/test_elementState_chrome.py | 37 +++++++++ .../marionette/tests/unit/test_findelement.py | 68 ----------------- .../tests/unit/test_findelement_chrome.py | 75 +++++++++++++++++++ .../marionette/tests/unit/test_getattr.py | 22 +----- .../tests/unit/test_getattr_chrome.py | 26 +++++++ .../marionette/tests/unit/test_selected.py | 24 +----- .../tests/unit/test_selected_chrome.py | 28 +++++++ .../client/marionette/tests/unit/test_text.py | 47 +----------- .../marionette/tests/unit/test_text_chrome.py | 51 +++++++++++++ .../marionette/tests/unit/unit-tests.ini | 9 ++- 13 files changed, 260 insertions(+), 218 deletions(-) create mode 100644 testing/marionette/client/marionette/tests/unit/test_click_chrome.py create mode 100644 testing/marionette/client/marionette/tests/unit/test_elementState_chrome.py create mode 100644 testing/marionette/client/marionette/tests/unit/test_findelement_chrome.py create mode 100644 testing/marionette/client/marionette/tests/unit/test_getattr_chrome.py create mode 100644 testing/marionette/client/marionette/tests/unit/test_selected_chrome.py create mode 100644 testing/marionette/client/marionette/tests/unit/test_text_chrome.py diff --git a/testing/marionette/client/marionette/tests/unit/test_click.py b/testing/marionette/client/marionette/tests/unit/test_click.py index fa356e8ce9a..657f3450388 100644 --- a/testing/marionette/client/marionette/tests/unit/test_click.py +++ b/testing/marionette/client/marionette/tests/unit/test_click.py @@ -27,29 +27,3 @@ class TestClick(MarionetteTestCase): self.fail("Element id=username not found after 30 seconds") self.assertEqual(self.marionette.title, "XHTML Test Page") - - -class TestClickChrome(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_click(self): - wins = self.marionette.window_handles - wins.remove(self.win) - newWin = wins.pop() - self.marionette.switch_to_window(newWin) - box = self.marionette.find_element(By.ID, "testBox") - self.assertFalse(self.marionette.execute_script("return arguments[0].checked;", [box])) - box.click() - self.assertTrue(self.marionette.execute_script("return arguments[0].checked;", [box])) diff --git a/testing/marionette/client/marionette/tests/unit/test_click_chrome.py b/testing/marionette/client/marionette/tests/unit/test_click_chrome.py new file mode 100644 index 00000000000..35e441958d3 --- /dev/null +++ b/testing/marionette/client/marionette/tests/unit/test_click_chrome.py @@ -0,0 +1,32 @@ +# 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 +from by import By + + +class TestClickChrome(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_click(self): + wins = self.marionette.window_handles + wins.remove(self.win) + newWin = wins.pop() + self.marionette.switch_to_window(newWin) + box = self.marionette.find_element(By.ID, "testBox") + self.assertFalse(self.marionette.execute_script("return arguments[0].checked;", [box])) + box.click() + self.assertTrue(self.marionette.execute_script("return arguments[0].checked;", [box])) diff --git a/testing/marionette/client/marionette/tests/unit/test_elementState.py b/testing/marionette/client/marionette/tests/unit/test_elementState.py index d5cfc54a771..aa2d60d6ef3 100644 --- a/testing/marionette/client/marionette/tests/unit/test_elementState.py +++ b/testing/marionette/client/marionette/tests/unit/test_elementState.py @@ -2,9 +2,9 @@ # 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/. -import os from marionette_test import MarionetteTestCase + class TestState(MarionetteTestCase): def test_isEnabled(self): test_html = self.marionette.absolute_url("test.html") @@ -21,34 +21,3 @@ class TestState(MarionetteTestCase): self.assertTrue(l.is_displayed()) self.marionette.execute_script("arguments[0].hidden = true;", [l]) self.assertFalse(l.is_displayed()) - -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("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]) - - ''' Switched on in Bug 896043 to be turned on in Bug 896046 - def test_isDisplayed(self): - l = self.marionette.find_element("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 diff --git a/testing/marionette/client/marionette/tests/unit/test_elementState_chrome.py b/testing/marionette/client/marionette/tests/unit/test_elementState_chrome.py new file mode 100644 index 00000000000..d7418c5f91f --- /dev/null +++ b/testing/marionette/client/marionette/tests/unit/test_elementState_chrome.py @@ -0,0 +1,37 @@ +# 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 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("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]) + + ''' Switched on in Bug 896043 to be turned on in Bug 896046 + def test_isDisplayed(self): + l = self.marionette.find_element("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 diff --git a/testing/marionette/client/marionette/tests/unit/test_findelement.py b/testing/marionette/client/marionette/tests/unit/test_findelement.py index d441f8b0d00..3ec7f0413e3 100644 --- a/testing/marionette/client/marionette/tests/unit/test_findelement.py +++ b/testing/marionette/client/marionette/tests/unit/test_findelement.py @@ -2,7 +2,6 @@ # 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/. -import os from marionette_test import MarionetteTestCase from marionette import HTMLElement from by import By @@ -145,70 +144,3 @@ class TestElements(MarionetteTestCase): fbody = self.marionette.find_element(By.TAG_NAME, 'body') abody = self.marionette.get_active_element() self.assertEqual(fbody, abody) - - -class TestElementsChrome(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_id(self): - el = self.marionette.execute_script("return window.document.getElementById('textInput');") - found_el = self.marionette.find_element(By.ID, "textInput") - self.assertEqual(HTMLElement, type(found_el)) - self.assertEqual(el, found_el) - - def test_child_element(self): - el = self.marionette.find_element(By.ID, "textInput") - parent = self.marionette.find_element(By.ID, "things") - found_el = parent.find_element(By.TAG_NAME, "textbox") - self.assertEqual(HTMLElement, type(found_el)) - self.assertEqual(el, found_el) - - def test_child_elements(self): - el = self.marionette.find_element(By.ID, "textInput3") - parent = self.marionette.find_element(By.ID, "things") - found_els = parent.find_elements(By.TAG_NAME, "textbox") - self.assertTrue(el.id in [found_el.id for found_el in found_els]) - - def test_tag_name(self): - el = self.marionette.execute_script("return window.document.getElementsByTagName('vbox')[0];") - found_el = self.marionette.find_element(By.TAG_NAME, "vbox") - self.assertEquals('vbox', found_el.tag_name) - self.assertEqual(HTMLElement, type(found_el)) - self.assertEqual(el, found_el) - - def test_class_name(self): - el = self.marionette.execute_script("return window.document.getElementsByClassName('asdf')[0];") - found_el = self.marionette.find_element(By.CLASS_NAME, "asdf") - self.assertEqual(HTMLElement, type(found_el)) - self.assertEqual(el, found_el) - - def test_xpath(self): - el = self.marionette.execute_script("return window.document.getElementById('testBox');") - found_el = self.marionette.find_element(By.XPATH, "id('testBox')") - self.assertEqual(HTMLElement, type(found_el)) - self.assertEqual(el, found_el) - - def test_not_found(self): - self.marionette.set_search_timeout(1000) - self.assertRaises(NoSuchElementException, self.marionette.find_element, By.ID, "I'm not on the page") - self.marionette.set_search_timeout(0) - self.assertRaises(NoSuchElementException, self.marionette.find_element, By.ID, "I'm not on the page") - - def test_timeout(self): - self.assertRaises(NoSuchElementException, self.marionette.find_element, By.ID, "myid") - self.assertTrue(True, self.marionette.set_search_timeout(4000)) - self.marionette.execute_script("window.setTimeout(function() {var b = window.document.createElement('button'); b.id = 'myid'; document.getElementById('things').appendChild(b);}, 1000)") - self.assertEqual(HTMLElement, type(self.marionette.find_element(By.ID, "myid"))) - self.marionette.execute_script("window.document.getElementById('things').removeChild(window.document.getElementById('myid'));") diff --git a/testing/marionette/client/marionette/tests/unit/test_findelement_chrome.py b/testing/marionette/client/marionette/tests/unit/test_findelement_chrome.py new file mode 100644 index 00000000000..cb0d98eb4dc --- /dev/null +++ b/testing/marionette/client/marionette/tests/unit/test_findelement_chrome.py @@ -0,0 +1,75 @@ +# 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 +from marionette import HTMLElement +from by import By +from errors import NoSuchElementException + + +class TestElementsChrome(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_id(self): + el = self.marionette.execute_script("return window.document.getElementById('textInput');") + found_el = self.marionette.find_element(By.ID, "textInput") + self.assertEqual(HTMLElement, type(found_el)) + self.assertEqual(el, found_el) + + def test_child_element(self): + el = self.marionette.find_element(By.ID, "textInput") + parent = self.marionette.find_element(By.ID, "things") + found_el = parent.find_element(By.TAG_NAME, "textbox") + self.assertEqual(HTMLElement, type(found_el)) + self.assertEqual(el, found_el) + + def test_child_elements(self): + el = self.marionette.find_element(By.ID, "textInput3") + parent = self.marionette.find_element(By.ID, "things") + found_els = parent.find_elements(By.TAG_NAME, "textbox") + self.assertTrue(el.id in [found_el.id for found_el in found_els]) + + def test_tag_name(self): + el = self.marionette.execute_script("return window.document.getElementsByTagName('vbox')[0];") + found_el = self.marionette.find_element(By.TAG_NAME, "vbox") + self.assertEquals('vbox', found_el.tag_name) + self.assertEqual(HTMLElement, type(found_el)) + self.assertEqual(el, found_el) + + def test_class_name(self): + el = self.marionette.execute_script("return window.document.getElementsByClassName('asdf')[0];") + found_el = self.marionette.find_element(By.CLASS_NAME, "asdf") + self.assertEqual(HTMLElement, type(found_el)) + self.assertEqual(el, found_el) + + def test_xpath(self): + el = self.marionette.execute_script("return window.document.getElementById('testBox');") + found_el = self.marionette.find_element(By.XPATH, "id('testBox')") + self.assertEqual(HTMLElement, type(found_el)) + self.assertEqual(el, found_el) + + def test_not_found(self): + self.marionette.set_search_timeout(1000) + self.assertRaises(NoSuchElementException, self.marionette.find_element, By.ID, "I'm not on the page") + self.marionette.set_search_timeout(0) + self.assertRaises(NoSuchElementException, self.marionette.find_element, By.ID, "I'm not on the page") + + def test_timeout(self): + self.assertRaises(NoSuchElementException, self.marionette.find_element, By.ID, "myid") + self.assertTrue(True, self.marionette.set_search_timeout(4000)) + self.marionette.execute_script("window.setTimeout(function() {var b = window.document.createElement('button'); b.id = 'myid'; document.getElementById('things').appendChild(b);}, 1000)") + self.assertEqual(HTMLElement, type(self.marionette.find_element(By.ID, "myid"))) + self.marionette.execute_script("window.document.getElementById('things').removeChild(window.document.getElementById('myid'));") diff --git a/testing/marionette/client/marionette/tests/unit/test_getattr.py b/testing/marionette/client/marionette/tests/unit/test_getattr.py index 7bd3804bece..d64e36cb654 100644 --- a/testing/marionette/client/marionette/tests/unit/test_getattr.py +++ b/testing/marionette/client/marionette/tests/unit/test_getattr.py @@ -2,32 +2,12 @@ # 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/. -import os from marionette_test import MarionetteTestCase + 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("id", "mozLink") self.assertEqual("mozLink", l.get_attribute("id")) - -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/client/marionette/tests/unit/test_getattr_chrome.py b/testing/marionette/client/marionette/tests/unit/test_getattr_chrome.py new file mode 100644 index 00000000000..00a24fbe33d --- /dev/null +++ b/testing/marionette/client/marionette/tests/unit/test_getattr_chrome.py @@ -0,0 +1,26 @@ +# 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 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/client/marionette/tests/unit/test_selected.py b/testing/marionette/client/marionette/tests/unit/test_selected.py index d0760a9d475..60172408264 100644 --- a/testing/marionette/client/marionette/tests/unit/test_selected.py +++ b/testing/marionette/client/marionette/tests/unit/test_selected.py @@ -2,9 +2,9 @@ # 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/. -import os from marionette_test import MarionetteTestCase + class TestSelected(MarionetteTestCase): def test_selected(self): test_html = self.marionette.absolute_url("test.html") @@ -13,25 +13,3 @@ class TestSelected(MarionetteTestCase): self.assertFalse(box.is_selected()) box.click() self.assertTrue(box.is_selected()) - -class TestSelectedChrome(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', '_blank', 'chrome,centerscreen');") - - def tearDown(self): - self.marionette.execute_script("window.close();") - self.marionette.switch_to_window(self.win) - MarionetteTestCase.tearDown(self) - - def test_selected(self): - wins = self.marionette.window_handles - wins.remove(self.win) - newWin = wins.pop() - self.marionette.switch_to_window(newWin) - box = self.marionette.find_element("id", "testBox") - self.assertFalse(box.is_selected()) - self.assertFalse(self.marionette.execute_script("arguments[0].checked = true;", [box])) - self.assertTrue(box.is_selected()) diff --git a/testing/marionette/client/marionette/tests/unit/test_selected_chrome.py b/testing/marionette/client/marionette/tests/unit/test_selected_chrome.py new file mode 100644 index 00000000000..0723e8c93e5 --- /dev/null +++ b/testing/marionette/client/marionette/tests/unit/test_selected_chrome.py @@ -0,0 +1,28 @@ +# 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 TestSelectedChrome(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', '_blank', 'chrome,centerscreen');") + + def tearDown(self): + self.marionette.execute_script("window.close();") + self.marionette.switch_to_window(self.win) + MarionetteTestCase.tearDown(self) + + def test_selected(self): + wins = self.marionette.window_handles + wins.remove(self.win) + newWin = wins.pop() + self.marionette.switch_to_window(newWin) + box = self.marionette.find_element("id", "testBox") + self.assertFalse(box.is_selected()) + self.assertFalse(self.marionette.execute_script("arguments[0].checked = true;", [box])) + self.assertTrue(box.is_selected()) diff --git a/testing/marionette/client/marionette/tests/unit/test_text.py b/testing/marionette/client/marionette/tests/unit/test_text.py index 0b7ac6d1cd0..70706a3fbd2 100644 --- a/testing/marionette/client/marionette/tests/unit/test_text.py +++ b/testing/marionette/client/marionette/tests/unit/test_text.py @@ -2,9 +2,9 @@ # 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/. -import os from marionette_test import MarionetteTestCase + class TestText(MarionetteTestCase): def test_getText(self): test_html = self.marionette.absolute_url("test.html") @@ -27,48 +27,3 @@ class TestText(MarionetteTestCase): self.assertEqual("asdf", self.marionette.execute_script("return arguments[0].value;", [l])) l.send_keys("o") self.assertEqual("asdfo", self.marionette.execute_script("return arguments[0].value;", [l])) - -''' Disabled in bug 896043 and when working on Chrome code re-enable for bug 896046 -class TestTextChrome(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_getText(self): - wins = self.marionette.window_handles - wins.remove(self.win) - newWin = wins.pop() - self.marionette.switch_to_window(newWin) - box = self.marionette.find_element("id", "textInput") - self.assertEqual("test", box.text) - - def test_clearText(self): - wins = self.marionette.window_handles - wins.remove(self.win) - newWin = wins.pop() - self.marionette.switch_to_window(newWin) - box = self.marionette.find_element("id", "textInput") - self.assertEqual("test", box.text) - box.clear() - self.assertEqual("", box.text) - - def test_sendKeys(self): - wins = self.marionette.window_handles - wins.remove(self.win) - newWin = wins.pop() - self.marionette.switch_to_window(newWin) - box = self.marionette.find_element("id", "textInput") - self.assertEqual("test", box.text) - box.send_keys("at") - self.assertEqual("attest", box.text) -''' \ No newline at end of file diff --git a/testing/marionette/client/marionette/tests/unit/test_text_chrome.py b/testing/marionette/client/marionette/tests/unit/test_text_chrome.py new file mode 100644 index 00000000000..cea322afc4b --- /dev/null +++ b/testing/marionette/client/marionette/tests/unit/test_text_chrome.py @@ -0,0 +1,51 @@ +# 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 + + +''' Disabled in bug 896043 and when working on Chrome code re-enable for bug 896046 +class TestTextChrome(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_getText(self): + wins = self.marionette.window_handles + wins.remove(self.win) + newWin = wins.pop() + self.marionette.switch_to_window(newWin) + box = self.marionette.find_element("id", "textInput") + self.assertEqual("test", box.text) + + def test_clearText(self): + wins = self.marionette.window_handles + wins.remove(self.win) + newWin = wins.pop() + self.marionette.switch_to_window(newWin) + box = self.marionette.find_element("id", "textInput") + self.assertEqual("test", box.text) + box.clear() + self.assertEqual("", box.text) + + def test_sendKeys(self): + wins = self.marionette.window_handles + wins.remove(self.win) + newWin = wins.pop() + self.marionette.switch_to_window(newWin) + box = self.marionette.find_element("id", "textInput") + self.assertEqual("test", box.text) + box.send_keys("at") + self.assertEqual("attest", box.text) +''' \ No newline at end of file diff --git a/testing/marionette/client/marionette/tests/unit/unit-tests.ini b/testing/marionette/client/marionette/tests/unit/unit-tests.ini index 6f5b796bb04..83f96db2ca9 100644 --- a/testing/marionette/client/marionette/tests/unit/unit-tests.ini +++ b/testing/marionette/client/marionette/tests/unit/unit-tests.ini @@ -16,15 +16,20 @@ skip = false [test_import_script_content.py.py] b2g = false [test_click.py] +[test_click_chrome.py] b2g = false [test_selected.py] +[test_selected_chrome.py] b2g = false [test_getattr.py] +[test_getattr_chrome.py] b2g = false [test_elementState.py] +[test_elementState_chrome.py] b2g = false [test_text.py] -b2g = false +[test_text_chrome.py] +disabled = "Bug 896046" [test_log.py] [test_emulator.py] @@ -35,13 +40,13 @@ qemu = true [test_execute_script.py] [test_simpletest_fail.js] [test_findelement.py] +[test_findelement_chrome.py] b2g = false [test_navigation.py] b2g = false [test_timeouts.py] -b2g = false [test_element_touch.py] b2g = true