From 92bbbffbc800cf3d8a586d01505a546052b3a0b1 Mon Sep 17 00:00:00 2001 From: Martin von Gagern Date: Fri, 29 Jul 2016 21:26:30 +0200 Subject: [PATCH] Add --wait option to screenshotter (#510) Sometimes a page might not be ready when the screenshot is taken, due to fonts still being loaded or some such. In --verify mode this is taken care of by repeated attempts. But when creating a screenshot for the first time, it might be desirable to wait a given number of seconds for things to settle down. So this commit introduces a --wait option to the screenshotter. --- dockers/Screenshotter/screenshotter.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dockers/Screenshotter/screenshotter.js b/dockers/Screenshotter/screenshotter.js index 8358348b8..d9e590a3f 100644 --- a/dockers/Screenshotter/screenshotter.js +++ b/dockers/Screenshotter/screenshotter.js @@ -69,6 +69,9 @@ var opts = require("nomnom") flag: true, help: "Check whether screenshot matches current file content", }) + .option("wait", { + help: "Wait this many seconds between page load and screenshot", + }) .parse(); var listOfCases; @@ -281,6 +284,9 @@ function takeScreenshot(key) { var url = katexURL + "test/screenshotter/test.html?" + itm.query; driver.get(url); + if (opts.wait) { + browserSideWait(1000 * opts.wait); + } driver.takeScreenshot().then(haveScreenshot).then(function() { if (--countdown === 0) { if (listOfFailed.length) {