commit 92bbbffbc800cf3d8a586d01505a546052b3a0b1
parent 725524a214eb0abc88ead69f8c3e4339da0b6968
Author: Martin von Gagern <Martin.vGagern@gmx.net>
Date: Fri, 29 Jul 2016 21:26:30 +0200
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.
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git 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) {