Bug 1691096 - [devtools] Fix intermittent on browser_jsterm_screenshot_command_clipboard.js. r=bomsy
authorNicolas Chevobbe <nchevobbe@mozilla.com>
Wed, 10 Feb 2021 09:43:52 +0000
changeset 566794 9363c9d95f6c9c36fd88ebc5c630c0a0eada2c8b
parent 566793 373160bb04a5ba02d06c6c09468fe4fe4696eef8
child 566795 9ce8fc97afa5a65d4799296bd3184608f8a53160
push id38189
push usernbeleuzu@mozilla.com
push dateWed, 10 Feb 2021 16:04:18 +0000
treeherdermozilla-central@375bea508a03 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbomsy
bugs1691096
milestone87.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 1691096 - [devtools] Fix intermittent on browser_jsterm_screenshot_command_clipboard.js. r=bomsy We wait for a tick after triggering the overflow so the scrollbars have the time to be rendered. Differential Revision: https://phabricator.services.mozilla.com/D104410
devtools/client/webconsole/test/browser/browser_jsterm_screenshot_command_clipboard.js
--- a/devtools/client/webconsole/test/browser/browser_jsterm_screenshot_command_clipboard.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_screenshot_command_clipboard.js
@@ -15,19 +15,16 @@ const dpr = "--dpr 1";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
   ok(hud, "web console opened");
 
   await testClipboard(hud);
   await testFullpageClipboard(hud);
   await testSelectorClipboard(hud);
-
-  // overflow
-  await createScrollbarOverflow();
   await testFullpageClipboardScrollbar(hud);
 });
 
 async function testClipboard(hud) {
   const command = `:screenshot --clipboard ${dpr}`;
   await executeScreenshotClipboardCommand(hud, command);
   const contentSize = await getContentSize();
   const imgSize = await getImageSizeFromClipboard();
@@ -80,16 +77,19 @@ async function testSelectorClipboard(hud
       imgSize.height,
       img.clientHeight,
       "Selector Clipboard: Image height matches element size"
     );
   });
 }
 
 async function testFullpageClipboardScrollbar(hud) {
+  info("Test taking a fullpage image that overflows");
+  await createScrollbarOverflow();
+
   const command = `:screenshot --fullpage --clipboard ${dpr}`;
   await executeScreenshotClipboardCommand(hud, command);
   const contentSize = await getContentSize();
   const scrollbarSize = await getScrollbarSize();
   const imgSize = await getImageSizeFromClipboard();
 
   is(
     imgSize.width,
@@ -128,16 +128,19 @@ async function createScrollbarOverflow()
   // Trigger scrollbars by forcing document to overflow
   // This only affects results on OSes with scrollbars that reduce document size
   // (non-floating scrollbars).  With default OS settings, this means Windows
   // and Linux are affected, but Mac is not.  For Mac to exhibit this behavior,
   // change System Preferences -> General -> Show scroll bars to Always.
   await SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() {
     content.document.body.classList.add("overflow");
   });
+
+  // Let's wait for next tick so scrollbars have the time to be rendered
+  await waitForTick();
 }
 
 async function getScrollbarSize() {
   const scrollbarSize = await SpecialPowers.spawn(
     gBrowser.selectedBrowser,
     [],
     function() {
       const winUtils = content.windowUtils;