diff options
author | Thomas Steur <thomas.steur@gmail.com> | 2015-06-23 05:04:09 +0300 |
---|---|---|
committer | Thomas Steur <thomas.steur@gmail.com> | 2015-06-23 05:04:09 +0300 |
commit | 66d624384fbe40b590c5fc62bd87cf57922af874 (patch) | |
tree | 7ddb585bda36b2e3baa57e577845497ceb215ab0 /tests/lib | |
parent | b6b7f731be5883d477935c71851f5a756c54afdb (diff) |
set correct viewport size was missing
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/screenshot-testing/support/page-renderer.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/lib/screenshot-testing/support/page-renderer.js b/tests/lib/screenshot-testing/support/page-renderer.js index 16a1f0d167..ccba69a5a1 100644 --- a/tests/lib/screenshot-testing/support/page-renderer.js +++ b/tests/lib/screenshot-testing/support/page-renderer.js @@ -382,18 +382,23 @@ PageRenderer.prototype.capture = function (outputPath, callback, selector) { try { if (outputPath) { - var previousClipRect = self.webpage.clipRect; - setClipRect(self.webpage, selector); + self._setCorrectViewportSize(); // _setCorrectViewportSize might cause a re-render. We should wait for a while for the re-render to // finish before capturing a screenshot to avoid possible random failures. var timeInMsToWaitForReRenderToFinish = 400; setTimeout(function () { + var previousClipRect = self.webpage.clipRect; + + setClipRect(self.webpage, selector); + self.webpage.render(outputPath); self._viewportSizeOverride = null; self.webpage.clipRect = previousClipRect; + callback(); + }, timeInMsToWaitForReRenderToFinish); } else { |