Browse Source

add comments about puppeteer/browserless PNG generation (#670)

sschmid 5 years ago
parent
commit
d1bf85f63d

+ 11 - 5
test/Util/generateDiffImagesPuppeteerLocalhost.js

@@ -1,14 +1,20 @@
 /*
 /*
-  Render each OSMD sample, grab the generated images, and
+  Render each OSMD sample in a headless browser
+  (using puppeteer, requires ~100MB chromium download),
+  grab the generated images, and
   dump them into a local directory as PNG files.
   dump them into a local directory as PNG files.
 
 
+  You may have to install puppeteer as dev dependency to run this:
+  npm i puppeteer --save-dev
+  (will download ~100MB for Chromium)
+
+  This script is made obsolete by the ~2x faster generateImages_browserless.js,
+  but may be useful for comparison.
+
   inspired by Vexflow's generate_png_images and vexflow-tests.js
   inspired by Vexflow's generate_png_images and vexflow-tests.js
 
 
   This is meant to be used with the visual regression test system in
   This is meant to be used with the visual regression test system in
-  `tools/visual_regression.sh`. (TODO)
-
-  You may have to install puppeteer as dev dependency to run this:
-  npm i puppeteer --save-dev
+  `tools/visual_regression.sh`.
 */
 */
 
 
 function sleep (ms) {
 function sleep (ms) {

+ 3 - 0
test/Util/generateImages_browserless.js

@@ -11,6 +11,9 @@
   Note: this script needs to "fake" quite a few browser elements, like window, document, and a Canvas HTMLElement.
   Note: this script needs to "fake" quite a few browser elements, like window, document, and a Canvas HTMLElement.
   For that it needs the canvas package installed.
   For that it needs the canvas package installed.
   There are also some hacks needed to set the container size (offsetWidth) correctly.
   There are also some hacks needed to set the container size (offsetWidth) correctly.
+
+  Otherwise you'd need to run a headless browser, which is way slower,
+  see the semi-obsolete generateDiffImagesPuppeteerLocalhost.js
 */
 */
 
 
 function sleep (ms) {
 function sleep (ms) {