Bug 1323770 - Fix inappropriatelly skipped/disabled tests. draft
authorHenrik Skupin <mail@hskupin.info>
Wed, 21 Dec 2016 17:34:59 +0100
changeset 454413 21fd9a20138642eea09a1b30c8b629aa3fd7d044
parent 454412 a2ba031cd12797e61c40bdfc5553a901f40173c5
child 540701 dd7dea385ba654090f7ca5cd5f34ff159ba4475a
push id39920
push userbmo:hskupin@gmail.com
push dateThu, 29 Dec 2016 08:25:24 +0000
bugs1323770
milestone53.0a1
Bug 1323770 - Fix inappropriatelly skipped/disabled tests. Commenting out test methods is not the way how we should mark tests as being skipped. The correct skip methods have to be used instead so that the final results also show the correct skip count. MozReview-Commit-ID: LKL4YQCyFko
testing/marionette/harness/marionette_harness/tests/unit/test_certificates.py
testing/marionette/harness/marionette_harness/tests/unit/test_element_state_chrome.py
testing/marionette/harness/marionette_harness/tests/unit/test_navigation.py
testing/marionette/harness/marionette_harness/tests/unit/test_single_finger_desktop.py
testing/marionette/harness/marionette_harness/tests/unit/test_text_chrome.py
testing/marionette/harness/marionette_harness/tests/unit/test_typing.py
testing/marionette/harness/marionette_harness/tests/unit/unit-tests.ini
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_certificates.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_certificates.py
@@ -1,32 +1,34 @@
 # 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_driver.errors import UnknownException
 
-from marionette_harness import MarionetteTestCase
+from marionette_harness import MarionetteTestCase, skip
 
 
 class TestCertificates(MarionetteTestCase):
+
+    @skip("Bug 1325079")
     def test_block_insecure_sites(self):
         self.marionette.delete_session()
         self.marionette.start_session()
 
         self.marionette.navigate(self.fixtures.where_is("test.html", on="http"))
         self.assertIn("http://", self.marionette.get_url())
         with self.assertRaises(UnknownException):
             self.marionette.navigate(self.fixtures.where_is("test.html", on="https"))
 
+    @skip("Bug 1325079")
     def test_accept_all_insecure(self):
         self.marionette.delete_session()
         self.marionette.start_session({"desiredCapability": {"acceptSslCerts": ["*"]}})
         self.marionette.navigate(self.fixtures.where_is("test.html", on="https"))
         self.assertIn("https://", self.marionette.url)
 
-    """
+    @skip("Bug 1325079")
     def test_accept_some_insecure(self):
         self.marionette.delete_session()
         self.marionette.start_session({"requiredCapabilities": {"acceptSslCerts": ["127.0.0.1"]}})
         self.marionette.navigate(self.fixtures.where_is("test.html", on="https"))
         self.assertIn("https://", self.marionette.url)
-    """
\ No newline at end of file
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_element_state_chrome.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_element_state_chrome.py
@@ -1,15 +1,15 @@
 # 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_driver.by import By
 
-from marionette_harness import MarionetteTestCase
+from marionette_harness import MarionetteTestCase, skip
 
 
 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');")
@@ -31,27 +31,24 @@ class TestIsElementEnabledChrome(Marione
 
     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 off in bug 896043,
-# and to be turned on in bug 896046
-"""
+@skip("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 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');")
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_navigation.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_navigation.py
@@ -1,21 +1,23 @@
 # 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 unittest import skip
-
 import contextlib
 import time
 import urllib
 
 from marionette_driver import errors, By, Wait
-
-from marionette_harness import MarionetteTestCase, skip_if_mobile, WindowManagerMixin
+from marionette_harness import (
+    MarionetteTestCase,
+    skip,
+    skip_if_mobile,
+    WindowManagerMixin,
+)
 
 
 def inline(doc):
     return "data:text/html;charset=utf-8,%s" % urllib.quote(doc)
 
 
 class TestNavigate(WindowManagerMixin, MarionetteTestCase):
 
@@ -107,17 +109,17 @@ class TestNavigate(WindowManagerMixin, M
     def test_navigate_frame(self):
         self.marionette.navigate(self.marionette.absolute_url("test_iframe.html"))
         self.marionette.switch_to_frame(0)
         self.marionette.navigate(self.marionette.absolute_url("empty.html"))
         self.assertTrue('empty.html' in self.marionette.get_url())
         self.marionette.switch_to_frame()
         self.assertTrue('test_iframe.html' in self.marionette.get_url())
 
-    @skip_if_mobile  # Bug 1323755 - Socket timeout
+    @skip_if_mobile("Bug 1323755 - Socket timeout")
     def test_invalid_protocol(self):
         with self.assertRaises(errors.MarionetteException):
             self.marionette.navigate("thisprotocoldoesnotexist://")
 
     def test_should_navigate_to_requested_about_page(self):
         self.marionette.navigate("about:neterror")
         self.assertEqual(self.marionette.get_url(), "about:neterror")
         self.marionette.navigate(self.marionette.absolute_url("test.html"))
@@ -145,17 +147,17 @@ class TestNavigate(WindowManagerMixin, M
     def test_fragment(self):
         doc = inline("<p id=foo>")
         self.marionette.navigate(doc)
         self.marionette.execute_script("window.visited = true", sandbox=None)
         self.marionette.navigate("%s#foo" % doc)
         self.assertTrue(self.marionette.execute_script(
             "return window.visited", sandbox=None))
 
-    @skip_if_mobile  # Fennec doesn't support other chrome windows
+    @skip_if_mobile("Fennec doesn't support other chrome windows")
     def test_about_blank_for_new_docshell(self):
         """ Bug 1312674 - Hang when loading about:blank for a new docshell."""
         # Open a window to get a new docshell created for the first tab
         with self.marionette.using_context("chrome"):
             tab = self.open_tab(lambda: self.marionette.execute_script(" window.open() "))
             self.marionette.switch_to_window(tab)
 
         self.marionette.navigate('about:blank')
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_single_finger_desktop.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_single_finger_desktop.py
@@ -1,19 +1,19 @@
 # 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/.
 
 import os
 import sys
 
 from marionette_driver.errors import MarionetteException
-from marionette_driver.by import By
+from marionette_driver import Actions, By
 
-from marionette_harness import MarionetteTestCase
+from marionette_harness import MarionetteTestCase, skip
 
 # add this directory to the path
 sys.path.append(os.path.dirname(__file__))
 
 from single_finger_functions import (
     chain, chain_flick, context_menu, double_tap,
     long_press_action, long_press_on_xy_action,
     move_element, move_element_offset, press_release, single_tap, wait,
@@ -80,38 +80,40 @@ prefs.setIntPref("ui.click_hold_context_
         move_element_offset(self.marionette, self.wait_for_condition, "button1-mousemove-mousedown", "button2-mousemove-mouseup")
 
     def test_wait(self):
         wait(self.marionette, self.wait_for_condition, "button1-mousemove-mousedown-mouseup-click")
 
     def test_wait_with_value(self):
         wait_with_value(self.marionette, self.wait_for_condition, "button1-mousemove-mousedown-mouseup-click")
 
-    """
-    // Skipping due to Bug 1191066
+    @skip("Bug 1191066")
     def test_context_menu(self):
-        context_menu(self.marionette, self.wait_for_condition, "button1-mousemove-mousedown-contextmenu", "button1-mousemove-mousedown-contextmenu-mouseup-click")
+        context_menu(self.marionette, self.wait_for_condition,
+                     "button1-mousemove-mousedown-contextmenu",
+                     "button1-mousemove-mousedown-contextmenu-mouseup-click")
 
+    @skip("Bug 1191066")
     def test_long_press_action(self):
-        long_press_action(self.marionette, self.wait_for_condition, "button1-mousemove-mousedown-contextmenu-mouseup-click")
+        long_press_action(self.marionette, self.wait_for_condition,
+                          "button1-mousemove-mousedown-contextmenu-mouseup-click")
 
+    @skip("Bug 1191066")
     def test_long_press_on_xy_action(self):
-        long_press_on_xy_action(self.marionette, self.wait_for_condition, "button1-mousemove-mousedown-contextmenu-mouseup-click")
-    """
+        long_press_on_xy_action(self.marionette, self.wait_for_condition,
+                                "button1-mousemove-mousedown-contextmenu-mouseup-click")
 
-    """
-    //Skipping due to Bug 865334
+    @skip("Bug 865334")
     def test_long_press_fail(self):
         testAction = self.marionette.absolute_url("testAction.html")
         self.marionette.navigate(testAction)
         button = self.marionette.find_element(By.ID, "button1Copy")
         action = Actions(self.marionette)
         action.press(button).long_press(button, 5)
-        assertRaises(MarionetteException, action.perform)
-    """
+        self.assertRaises(MarionetteException, action.perform)
 
     def test_chain(self):
         chain(self.marionette, self.wait_for_condition, "button1-mousemove-mousedown", "delayed-mousemove-mouseup")
 
     def test_chain_flick(self):
         chain_flick(self.marionette, self.wait_for_condition, "button1-mousemove-mousedown-mousemove", "buttonFlick-mousemove-mouseup")
 
     def test_single_tap(self):
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_text_chrome.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_text_chrome.py
@@ -1,18 +1,18 @@
 # 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_driver.by import By
 
-from marionette_harness import MarionetteTestCase, WindowManagerMixin
+from marionette_harness import MarionetteTestCase, skip, WindowManagerMixin
 
 
-''' Disabled in bug 896043 and when working on Chrome code re-enable for bug 896046
+@skip("Disabled in bug 896043 and when working on Chrome code re-enable for bug 896046")
 class TestTextChrome(WindowManagerMixin, MarionetteTestCase):
 
     def setUp(self):
         super(TestTextChrome, self).setUp()
         self.marionette.set_context("chrome")
 
         def open_window_with_js():
             self.marionette.execute_script("""
@@ -37,9 +37,8 @@ class TestTextChrome(WindowManagerMixin,
         box.clear()
         self.assertEqual("", box.text)
 
     def test_sendKeys(self):
         box = self.marionette.find_element(By.ID, "textInput")
         self.assertEqual("test", box.text)
         box.send_keys("at")
         self.assertEqual("attest", box.text)
-'''
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_typing.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_typing.py
@@ -3,17 +3,17 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 import urllib
 
 from marionette_driver.by import By
 from marionette_driver.errors import ElementNotVisibleException
 from marionette_driver.keys import Keys
 
-from marionette_harness import MarionetteTestCase, skip_if_mobile
+from marionette_harness import MarionetteTestCase, skip, skip_if_mobile
 
 
 def inline(doc):
     return "data:text/html;charset=utf-8,{}".format(urllib.quote(doc))
 
 
 class TypingTestCase(MarionetteTestCase):
 
@@ -27,17 +27,17 @@ class TypingTestCase(MarionetteTestCase)
 
 
 class TestTypingChrome(TypingTestCase):
 
     def setUp(self):
         super(TestTypingChrome, self).setUp()
         self.marionette.set_context("chrome")
 
-    @skip_if_mobile  # Interacting with chrome elements not available for Fennec
+    @skip_if_mobile("Interacting with chrome elements not available for Fennec")
     def test_cut_and_paste_shortcuts(self):
         with self.marionette.using_context("content"):
             test_html = self.marionette.absolute_url("javascriptPage.html")
             self.marionette.navigate(test_html)
 
             keyReporter = self.marionette.find_element(By.ID, "keyReporter")
             self.assertEqual("", keyReporter.get_property("value"))
             keyReporter.send_keys("zyxwvutsr")
@@ -208,17 +208,17 @@ class TestTypingContent(TypingTestCase):
 
         element = self.marionette.find_element(By.ID, "keyPressArea")
         element.send_keys("I like cheese")
         result = self.marionette.find_element(By.ID, "result")
         #  Because the key down gets the result before the input element is
         #  filled, we're a letter short here
         self.assertEqual(result.text, "I like chees")
 
-    @skip_if_mobile  # Bug 1324752 - Arrow keys cannot be sent in Fennec
+    @skip_if_mobile("Bug 1324752 - Arrow keys cannot be sent in Fennec")
     def testShouldReportKeyCodeOfArrowKeysUpDownEvents(self):
         test_html = self.marionette.absolute_url("javascriptPage.html")
         self.marionette.navigate(test_html)
 
         result = self.marionette.find_element(By.ID, "result")
         element = self.marionette.find_element(By.ID, "keyReporter")
 
         element.send_keys(Keys.ARROW_DOWN)
@@ -236,74 +236,70 @@ class TestTypingContent(TypingTestCase):
 
         element.send_keys(Keys.ARROW_RIGHT)
         self.assertIn("down: 39", result.text.strip())
         self.assertIn("up: 39", result.text.strip())
 
         #  And leave no rubbish/printable keys in the "keyReporter"
         self.assertEqual("", element.get_property("value"))
 
-    """Disabled. Reenable in Bug 1068728
+    @skip("Reenable in Bug 1068728")
     def testNumericShiftKeys(self):
         test_html = self.marionette.absolute_url("javascriptPage.html")
         self.marionette.navigate(test_html)
 
         result = self.marionette.find_element(By.ID, "result")
         element = self.marionette.find_element(By.ID, "keyReporter")
         numericShiftsEtc = "~!@#$%^&*()_+{}:i\"<>?|END~"
         element.send_keys(numericShiftsEtc)
         self.assertEqual(numericShiftsEtc, element.get_property("value"))
         self.assertIn(" up: 16", result.text.strip())
-    """
 
     def testLowerCaseAlphaKeys(self):
         test_html = self.marionette.absolute_url("javascriptPage.html")
         self.marionette.navigate(test_html)
 
         element = self.marionette.find_element(By.ID, "keyReporter")
         lowerAlphas = "abcdefghijklmnopqrstuvwxyz"
         element.send_keys(lowerAlphas)
         self.assertEqual(lowerAlphas, element.get_property("value"))
 
-    """Disabled. Reenable in Bug 1068735
+    @skip("Reenable in Bug 1068735")
     def testUppercaseAlphaKeys(self):
         test_html = self.marionette.absolute_url("javascriptPage.html")
         self.marionette.navigate(test_html)
 
         result = self.marionette.find_element(By.ID, "result")
         element = self.marionette.find_element(By.ID, "keyReporter")
         upperAlphas = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
         element.send_keys(upperAlphas)
         self.assertEqual(upperAlphas, element.get_property("value"))
         self.assertIn(" up: 16", result.text.strip())
-    """
 
-    """Disabled. Reenable in Bug 1068726
+    @skip("Reenable in Bug 1068726")
     def testAllPrintableKeys(self):
         test_html = self.marionette.absolute_url("javascriptPage.html")
         self.marionette.navigate(test_html)
 
         result = self.marionette.find_element(By.ID, "result")
         element = self.marionette.find_element(By.ID, "keyReporter")
         allPrintable = "!\"#$%&'()*+,-./0123456789:<=>?@ ABCDEFGHIJKLMNOPQRSTUVWXYZ [\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
         element.send_keys(allPrintable)
 
         self.assertTrue(allPrintable, element.get_property("value"))
         self.assertIn(" up: 16", result.text.strip())
-    """
 
-    """Disabled. Reenable in Bug 1068733
+    @skip("Reenable in Bug 1068733")
     def testSpecialSpaceKeys(self):
         test_html = self.marionette.absolute_url("javascriptPage.html")
         self.marionette.navigate(test_html)
 
         element = self.marionette.find_element(By.ID, "keyReporter")
         element.send_keys("abcd" + Keys.SPACE + "fgh" + Keys.SPACE + "ij")
         self.assertEqual("abcd fgh ij", element.get_property("value"))
-    """
 
     def testShouldTypeAnInteger(self):
         test_html = self.marionette.absolute_url("javascriptPage.html")
         self.marionette.navigate(test_html)
 
         element = self.marionette.find_element(By.ID, "keyReporter")
         element.send_keys(1234)
         self.assertEqual("1234", element.get_property("value"))
--- a/testing/marionette/harness/marionette_harness/tests/unit/unit-tests.ini
+++ b/testing/marionette/harness/marionette_harness/tests/unit/unit-tests.ini
@@ -2,16 +2,17 @@
 [test_geckoinstance.py]
 [test_data_driven.py]
 [test_session.py]
 [test_capabilities.py]
 [test_accessibility.py]
 [test_expectedfail.py]
 expected = fail
 [test_import_script.py]
+[test_certificates.py]
 [test_click.py]
 [test_click_chrome.py]
 skip-if = appname == 'fennec'
 [test_checkbox.py]
 [test_checkbox_chrome.py]
 skip-if = appname == 'fennec'
 [test_elementsize.py]
 [test_elementsize_chrome.py]