Bug 1508435 - Wait for one second between each screenshot test;r=pbro
authorJulian Descottes <jdescottes@mozilla.com>
Mon, 07 Jan 2019 09:23:21 +0000
changeset 509789 ed6cbd03dbc20866e472a587cf3275d78b01adcc
parent 509788 fc3e620149eced94848e3a548616addb0fd6833e
child 509790 df193b44f65ab8fe8b249d1690b95c752bf93bde
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspbro
bugs1508435
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1508435 - Wait for one second between each screenshot test;r=pbro Differential Revision: https://phabricator.services.mozilla.com/D15512
devtools/client/inspector/markup/test/helper_screenshot_node.js
--- a/devtools/client/inspector/markup/test/helper_screenshot_node.js
+++ b/devtools/client/inspector/markup/test/helper_screenshot_node.js
@@ -61,16 +61,23 @@ async function takeNodeScreenshot(inspec
   info("Create an image using the downloaded fileas source");
   const image = new Image();
   image.src = OS.Path.toFileURI(filePath);
   await once(image, "load");
 
   info("Remove the downloaded screenshot file");
   await OS.File.remove(filePath);
 
+  // See intermittent Bug 1508435. Even after removing the file, tests still manage to
+  // reuse files from the previous test if they have the same name. Since our file name
+  // is based on a timestamp that has "second" precision, wait for one second to make sure
+  // screenshots will have different names.
+  info("Wait for one second to make sure future screenshots will use a different name");
+  await new Promise(r => setTimeout(r, 1000));
+
   return image;
 }
 /* exported takeNodeScreenshot */
 
 /**
  * Check that the provided image has the expected width, height, and color.
  * NOTE: This test assumes that the image is only made of a single color and will only
  * check one pixel.