Bug 1323185 - Skip unit tests which should not be run with Fennec. draft
authorHenrik Skupin <mail@hskupin.info>
Tue, 17 Jan 2017 16:35:22 +0100
changeset 462487 1e23bfc2974c4ee14e233e7429932449fc438149
parent 460673 de67fccc4c64a49f261aea29141357b94c7b3b9c
child 462488 6bdbf0804139ef8cf0f81d8faee7d6d0ca7cc7bd
child 462506 5c92b0a5440f996b8d7a9bc400a15cf3c1ec9762
push id41772
push userbmo:hskupin@gmail.com
push dateTue, 17 Jan 2017 15:39:53 +0000
bugs1323185
milestone53.0a1
Bug 1323185 - Skip unit tests which should not be run with Fennec. MozReview-Commit-ID: 5aiuT7vlm3f
testing/marionette/harness/marionette_harness/tests/unit/test_key_actions.py
testing/marionette/harness/marionette_harness/tests/unit/test_screenshot.py
testing/marionette/harness/marionette_harness/tests/unit/test_window_close_content.py
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_key_actions.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_key_actions.py
@@ -1,17 +1,17 @@
 # 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_driver.keys import Keys
 from marionette_driver.marionette import Actions
 
-from marionette_harness import MarionetteTestCase, WindowManagerMixin
+from marionette_harness import MarionetteTestCase, skip_if_mobile, WindowManagerMixin
 
 
 class TestKeyActions(WindowManagerMixin, MarionetteTestCase):
 
     def setUp(self):
         super(TestKeyActions, self).setUp()
         if self.marionette.session_capabilities["platformName"] == "darwin":
             self.mod_key = Keys.META
@@ -65,16 +65,17 @@ class TestKeyActions(WindowManagerMixin,
         self.key_action.key_down("a").key_down("b").key_down("c").perform()
         (self.key_action.key_down(self.mod_key)
                         .key_down("a")
                         .wait(.5)
                         .key_down("x")
                         .perform())
         self.assertEqual(self.key_reporter_value, "")
 
+    @skip_if_mobile("Fennec doesn't support other chrome windows")
     def test_open_in_new_window_shortcut(self):
         def open_window_with_action():
             el = self.marionette.find_element(By.ID, "updatediv")
             # Ensure that the element is in the current view port because press() doesn't
             # handle that inside the action chain (bug 1295538).
             self.marionette.execute_script('arguments[0].scrollIntoView()', script_args=[el])
             (self.key_action.key_down(Keys.SHIFT)
                             .press(el)
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_screenshot.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_screenshot.py
@@ -165,16 +165,17 @@ class TestScreenCaptureChrome(WindowMana
 
         # Ensure we do not capture the full window
         screenshot_dialog = self.marionette.screenshot()
         self.assertNotEqual(screenshot_dialog, screenshot_element)
 
         self.marionette.close_chrome_window()
         self.marionette.switch_to_window(self.start_window)
 
+    @skip_if_mobile("Fennec doesn't support other chrome windows")
     def test_capture_flags(self):
         dialog = self.open_dialog()
         self.marionette.switch_to_window(dialog)
 
         textbox = self.marionette.find_element(By.ID, "text-box")
         textbox.send_keys("")
         screenshot_focus = self.marionette.screenshot()
 
@@ -193,16 +194,17 @@ class TestScreenCaptureChrome(WindowMana
         screenshot_root = self.marionette.screenshot(element=self.document_element)
 
         self.assert_png(screenshot_full)
         self.assert_png(screenshot_root)
         self.assertEqual(screenshot_root, screenshot_full)
         self.assertEqual(self.scale(self.get_element_dimensions(self.document_element)),
                          self.get_image_dimensions(screenshot_full))
 
+    @skip_if_mobile("Fennec doesn't support other chrome windows")
     def test_capture_viewport(self):
         # Load a HTML test page into the chrome window to get scrollbars
         test_page = self.marionette.absolute_url("test.html")
         dialog = self.open_dialog(url=test_page, width=50, height=50)
         self.marionette.switch_to_window(dialog)
 
         # Size of screenshot has to match viewport size
         screenshot = self.marionette.screenshot(full=False)
@@ -210,24 +212,26 @@ class TestScreenCaptureChrome(WindowMana
         self.assertEqual(self.scale(self.viewport_dimensions),
                          self.get_image_dimensions(screenshot))
         self.assertNotEqual(self.scale(self.window_dimensions),
                             self.get_image_dimensions(screenshot))
 
         self.marionette.close_chrome_window()
         self.marionette.switch_to_window(self.start_window)
 
+    @skip_if_mobile("Fennec doesn't support other chrome windows")
     def test_capture_window_already_closed(self):
         dialog = self.open_dialog()
         self.marionette.switch_to_window(dialog)
         self.marionette.close_chrome_window()
 
         self.assertRaises(NoSuchWindowException, self.marionette.screenshot)
         self.marionette.switch_to_window(self.start_window)
 
+    @skip_if_mobile("Fennec doesn't support other chrome windows")
     def test_formats(self):
         dialog = self.open_dialog()
         self.marionette.switch_to_window(dialog)
 
         self.assert_formats()
 
         self.marionette.close_chrome_window()
         self.marionette.switch_to_window(self.start_window)
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_window_close_content.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_window_close_content.py
@@ -56,16 +56,17 @@ class TestCloseWindow(WindowManagerMixin
     def test_close_window_for_browser_tab(self):
         tab = self.open_tab()
         self.marionette.switch_to_window(tab)
 
         window_handles = self.marionette.close()
         self.assertNotIn(tab, window_handles)
         self.assertListEqual(self.start_tabs, window_handles)
 
+    @skip_if_mobile("Interacting with chrome windows not available for Fennec")
     def test_close_window_for_browser_window_with_single_tab(self):
         win = self.open_window()
         self.marionette.switch_to_window(win)
 
         self.assertEqual(len(self.start_tabs) + 1, len(self.marionette.window_handles))
         window_handles = self.marionette.close()
         self.assertNotIn(win, window_handles)
         self.assertListEqual(self.start_tabs, window_handles)