From 7346feaa9c9e2110e5b4a33925c69954e3b98235 Mon Sep 17 00:00:00 2001 From: Henrik Skupin Date: Wed, 21 Dec 2016 17:34:59 +0100 Subject: [PATCH] Bug 1323770 - Fix inappropriatelly skipped/disabled tests. r=maja_zf 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 --HG-- extra : rebase_source : 4c50596a6477e2afa0926b5dd787466d2b6ce89a --- .../tests/unit/test_certificates.py | 8 +++--- .../tests/unit/test_element_state_chrome.py | 7 ++--- .../tests/unit/test_navigation.py | 14 +++++----- .../tests/unit/test_single_finger_desktop.py | 26 ++++++++++--------- .../tests/unit/test_text_chrome.py | 5 ++-- .../tests/unit/test_typing.py | 18 +++++-------- .../tests/unit/unit-tests.ini | 1 + 7 files changed, 39 insertions(+), 40 deletions(-) diff --git a/testing/marionette/harness/marionette_harness/tests/unit/test_certificates.py b/testing/marionette/harness/marionette_harness/tests/unit/test_certificates.py index a19a433d3469..fb4c5c38b4d0 100644 --- a/testing/marionette/harness/marionette_harness/tests/unit/test_certificates.py +++ b/testing/marionette/harness/marionette_harness/tests/unit/test_certificates.py @@ -4,10 +4,12 @@ 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() @@ -17,16 +19,16 @@ class TestCertificates(MarionetteTestCase): 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 diff --git 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 index e2433dc6c6d7..01ed355c48a2 100644 --- 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 @@ -4,7 +4,7 @@ from marionette_driver.by import By -from marionette_harness import MarionetteTestCase +from marionette_harness import MarionetteTestCase, skip class TestIsElementEnabledChrome(MarionetteTestCase): @@ -36,9 +36,7 @@ class TestIsElementEnabledChrome(MarionetteTestCase): 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") @@ -46,7 +44,6 @@ class TestIsElementDisplayed(MarionetteTestCase): 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): diff --git a/testing/marionette/harness/marionette_harness/tests/unit/test_navigation.py b/testing/marionette/harness/marionette_harness/tests/unit/test_navigation.py index 3d2821b46e3f..fdb18814b7be 100644 --- a/testing/marionette/harness/marionette_harness/tests/unit/test_navigation.py +++ b/testing/marionette/harness/marionette_harness/tests/unit/test_navigation.py @@ -2,15 +2,17 @@ # 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): @@ -112,7 +114,7 @@ class TestNavigate(WindowManagerMixin, MarionetteTestCase): 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://") @@ -150,7 +152,7 @@ class TestNavigate(WindowManagerMixin, MarionetteTestCase): 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 diff --git 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 index 019531efcfc3..8ac80c3c547c 100644 --- 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 @@ -6,9 +6,9 @@ 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__)) @@ -85,28 +85,30 @@ prefs.setIntPref("ui.click_hold_context_menus.delay", arguments[0]); 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") diff --git a/testing/marionette/harness/marionette_harness/tests/unit/test_text_chrome.py b/testing/marionette/harness/marionette_harness/tests/unit/test_text_chrome.py index 065e10c9729b..e0b63de16f58 100644 --- a/testing/marionette/harness/marionette_harness/tests/unit/test_text_chrome.py +++ b/testing/marionette/harness/marionette_harness/tests/unit/test_text_chrome.py @@ -4,10 +4,10 @@ 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): @@ -42,4 +42,3 @@ class TestTextChrome(WindowManagerMixin, MarionetteTestCase): self.assertEqual("test", box.text) box.send_keys("at") self.assertEqual("attest", box.text) -''' diff --git a/testing/marionette/harness/marionette_harness/tests/unit/test_typing.py b/testing/marionette/harness/marionette_harness/tests/unit/test_typing.py index bb7b2ff41c31..53d2bb4f1d67 100644 --- a/testing/marionette/harness/marionette_harness/tests/unit/test_typing.py +++ b/testing/marionette/harness/marionette_harness/tests/unit/test_typing.py @@ -8,7 +8,7 @@ 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): @@ -32,7 +32,7 @@ class TestTypingChrome(TypingTestCase): 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") @@ -213,7 +213,7 @@ class TestTypingContent(TypingTestCase): # 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) @@ -241,7 +241,7 @@ class TestTypingContent(TypingTestCase): # 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) @@ -252,7 +252,6 @@ class TestTypingContent(TypingTestCase): 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") @@ -263,7 +262,7 @@ class TestTypingContent(TypingTestCase): 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) @@ -274,9 +273,8 @@ class TestTypingContent(TypingTestCase): 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) @@ -288,9 +286,8 @@ class TestTypingContent(TypingTestCase): 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) @@ -298,7 +295,6 @@ class TestTypingContent(TypingTestCase): 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") diff --git a/testing/marionette/harness/marionette_harness/tests/unit/unit-tests.ini b/testing/marionette/harness/marionette_harness/tests/unit/unit-tests.ini index bb4fe03ececd..868cab610984 100644 --- a/testing/marionette/harness/marionette_harness/tests/unit/unit-tests.ini +++ b/testing/marionette/harness/marionette_harness/tests/unit/unit-tests.ini @@ -7,6 +7,7 @@ [test_expectedfail.py] expected = fail [test_import_script.py] +[test_certificates.py] [test_click.py] [test_click_chrome.py] skip-if = appname == 'fennec'