Bug 1322383 - Hardening screenshot tests by forcing about:blank to be loaded by default. r=automatedtester a=test-only
authorHenrik Skupin <mail@hskupin.info>
Wed, 22 Mar 2017 16:11:16 +0100
changeset 395345 1156fbdde40cd633b6a8fb4311de963d42af396e
parent 395344 d55e513a842605d34e77a332a68c5ddc07f43a62
child 395346 1d5124bd2bcb9d7fb5012c45b13312bc9f20a211
push id1468
push userasasaki@mozilla.com
push dateMon, 05 Jun 2017 19:31:07 +0000
treeherdermozilla-release@0641fc6ee9d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersautomatedtester, test-only
bugs1322383
milestone54.0a2
Bug 1322383 - Hardening screenshot tests by forcing about:blank to be loaded by default. r=automatedtester a=test-only If no default page is set it can be that former tests loaded a page which still shows the load status at the lower left corner of Firefox. This can lead to intermittent test failures. MozReview-Commit-ID: 77MDIRtjA4j
testing/marionette/harness/marionette_harness/tests/unit/test_screenshot.py
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_screenshot.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_screenshot.py
@@ -35,16 +35,20 @@ svg = inline("""
 
 class ScreenCaptureTestCase(MarionetteTestCase):
 
     def setUp(self):
         super(ScreenCaptureTestCase, self).setUp()
 
         self._device_pixel_ratio = None
 
+        # Ensure that each screenshot test runs on a blank page to avoid left
+        # over elements or focus which could interfer with taking screenshots
+        self.marionette.navigate("about:blank")
+
     @property
     def device_pixel_ratio(self):
         if self._device_pixel_ratio is None:
             self._device_pixel_ratio = self.marionette.execute_script("""
                 return window.devicePixelRatio
                 """)
         return self._device_pixel_ratio