html-snapshots 1.3.2 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (253) hide show
  1. package/lib/common/index.js +57 -3
  2. package/lib/common/sitemap/sitemap-collection.js +3 -2
  3. package/lib/common/sitemap/sitemap-index.js +1 -4
  4. package/lib/common/sitemap/sitemap.js +15 -13
  5. package/lib/html-snapshots.js +5 -6
  6. package/lib/input-generators/_base.js +5 -5
  7. package/package.json +5 -6
  8. package/.c8rc.json +0 -5
  9. package/.eslintignore +0 -5
  10. package/.eslintrc.json +0 -16
  11. package/.github/issue_template.md +0 -16
  12. package/.github/workflows/verify.yml +0 -32
  13. package/docs/example-heroku-redis.md +0 -43
  14. package/docs/notes.md +0 -42
  15. package/examples/README.md +0 -149
  16. package/examples/custom/README.md +0 -22
  17. package/examples/custom/myFilter.js +0 -22
  18. package/examples/custom/package-lock.json +0 -2804
  19. package/examples/custom/package.json +0 -12
  20. package/examples/custom/snapshot.js +0 -28
  21. package/examples/debug-phantomjs/README.md +0 -38
  22. package/examples/debug-phantomjs/package-lock.json +0 -2922
  23. package/examples/debug-phantomjs/package.json +0 -12
  24. package/examples/debug-phantomjs/snapshot.js +0 -60
  25. package/examples/debug-puppeteer/README.md +0 -18
  26. package/examples/debug-puppeteer/package-lock.json +0 -2804
  27. package/examples/debug-puppeteer/package.json +0 -12
  28. package/examples/debug-puppeteer/snapshot.js +0 -30
  29. package/examples/html5rocks/README.md +0 -22
  30. package/examples/html5rocks/package-lock.json +0 -3218
  31. package/examples/html5rocks/package.json +0 -12
  32. package/examples/html5rocks/snapshot.js +0 -59
  33. package/examples/process-limit/README.md +0 -24
  34. package/examples/process-limit/package-lock.json +0 -2830
  35. package/examples/process-limit/package.json +0 -12
  36. package/examples/process-limit/snapshot.js +0 -30
  37. package/examples/simple-promise/README.md +0 -20
  38. package/examples/simple-promise/package-lock.json +0 -2830
  39. package/examples/simple-promise/package.json +0 -12
  40. package/examples/simple-promise/snapshot.js +0 -30
  41. package/examples/sitemap-index/README.md +0 -20
  42. package/examples/sitemap-index/package-lock.json +0 -2830
  43. package/examples/sitemap-index/package.json +0 -12
  44. package/examples/sitemap-index/snapshot.js +0 -34
  45. package/examples/verbose/README.md +0 -22
  46. package/examples/verbose/package-lock.json +0 -2805
  47. package/examples/verbose/package.json +0 -12
  48. package/examples/verbose/snapshot.js +0 -34
  49. package/test/helpers/options.js +0 -55
  50. package/test/helpers/result.js +0 -32
  51. package/test/helpers/sitemap.js +0 -130
  52. package/test/mocha/async/test.js +0 -416
  53. package/test/mocha/browsers/puppeteer.js +0 -129
  54. package/test/mocha/browsers/server/index.html +0 -9
  55. package/test/mocha/browsers/test.js +0 -11
  56. package/test/mocha/common/helpers.js +0 -87
  57. package/test/mocha/common/test.js +0 -188
  58. package/test/mocha/html-snapshots/basics.js +0 -88
  59. package/test/mocha/html-snapshots/myFilter.js +0 -10
  60. package/test/mocha/html-snapshots/phantomjs-options.js +0 -156
  61. package/test/mocha/html-snapshots/process-limit.js +0 -156
  62. package/test/mocha/html-snapshots/puppeteer.js +0 -47
  63. package/test/mocha/html-snapshots/robots.js +0 -194
  64. package/test/mocha/html-snapshots/server/contact/index.html +0 -57
  65. package/test/mocha/html-snapshots/server/favicon.ico +0 -0
  66. package/test/mocha/html-snapshots/server/fonts/facebolf-webfont.eot +0 -0
  67. package/test/mocha/html-snapshots/server/fonts/facebolf-webfont.svg +0 -220
  68. package/test/mocha/html-snapshots/server/fonts/facebolf-webfont.ttf +0 -0
  69. package/test/mocha/html-snapshots/server/fonts/facebolf-webfont.woff +0 -0
  70. package/test/mocha/html-snapshots/server/images/ajax-loader.gif +0 -0
  71. package/test/mocha/html-snapshots/server/images/art1.jpg +0 -0
  72. package/test/mocha/html-snapshots/server/images/carpet.jpg +0 -0
  73. package/test/mocha/html-snapshots/server/images/carpets/carpet1.jpg +0 -0
  74. package/test/mocha/html-snapshots/server/images/carpets/carpet1_th.jpg +0 -0
  75. package/test/mocha/html-snapshots/server/images/carpets/carpet2.jpg +0 -0
  76. package/test/mocha/html-snapshots/server/images/carpets/carpet2_th.jpg +0 -0
  77. package/test/mocha/html-snapshots/server/images/carpets/carpet3.jpg +0 -0
  78. package/test/mocha/html-snapshots/server/images/carpets/carpet3_th.jpg +0 -0
  79. package/test/mocha/html-snapshots/server/images/carpets/carpet4.jpg +0 -0
  80. package/test/mocha/html-snapshots/server/images/carpets/carpet4_th.jpg +0 -0
  81. package/test/mocha/html-snapshots/server/images/floor.jpg +0 -0
  82. package/test/mocha/html-snapshots/server/images/foundation/orbit/bullets.jpg +0 -0
  83. package/test/mocha/html-snapshots/server/images/foundation/orbit/left-arrow-small.png +0 -0
  84. package/test/mocha/html-snapshots/server/images/foundation/orbit/left-arrow.png +0 -0
  85. package/test/mocha/html-snapshots/server/images/foundation/orbit/loading.gif +0 -0
  86. package/test/mocha/html-snapshots/server/images/foundation/orbit/mask-black.png +0 -0
  87. package/test/mocha/html-snapshots/server/images/foundation/orbit/pause-black.png +0 -0
  88. package/test/mocha/html-snapshots/server/images/foundation/orbit/right-arrow-small.png +0 -0
  89. package/test/mocha/html-snapshots/server/images/foundation/orbit/right-arrow.png +0 -0
  90. package/test/mocha/html-snapshots/server/images/foundation/orbit/rotator-black.png +0 -0
  91. package/test/mocha/html-snapshots/server/images/foundation/orbit/timer-black.png +0 -0
  92. package/test/mocha/html-snapshots/server/images/home-sprite/certification.png +0 -0
  93. package/test/mocha/html-snapshots/server/images/home-sprite/cleantrust.png +0 -0
  94. package/test/mocha/html-snapshots/server/images/home-sprite/institute.png +0 -0
  95. package/test/mocha/html-snapshots/server/images/home-sprite-s1a48fdbd81.png +0 -0
  96. package/test/mocha/html-snapshots/server/images/logo-300.png +0 -0
  97. package/test/mocha/html-snapshots/server/images/slider1-lg.jpg +0 -0
  98. package/test/mocha/html-snapshots/server/images/slider1.jpg +0 -0
  99. package/test/mocha/html-snapshots/server/index.css +0 -1
  100. package/test/mocha/html-snapshots/server/index.html +0 -57
  101. package/test/mocha/html-snapshots/server/nojq/index.html +0 -46
  102. package/test/mocha/html-snapshots/server/pjsopts/index.html +0 -55
  103. package/test/mocha/html-snapshots/server/public/page-sitemap.xml +0 -16
  104. package/test/mocha/html-snapshots/server/public/wordpress/category-sitemap.xml +0 -13
  105. package/test/mocha/html-snapshots/server/public/wordpress/page-sitemap.xml +0 -16
  106. package/test/mocha/html-snapshots/server/public/wordpress/post-sitemap.xml +0 -27
  107. package/test/mocha/html-snapshots/server/public/wordpress/post_tag-sitemap.xml +0 -17
  108. package/test/mocha/html-snapshots/server/public/wordpress/product-sitemap.xml +0 -13
  109. package/test/mocha/html-snapshots/server/public/wordpress-2/category-sitemap.xml +0 -13
  110. package/test/mocha/html-snapshots/server/public/wordpress-2/page-sitemap.xml +0 -16
  111. package/test/mocha/html-snapshots/server/public/wordpress-2/post-sitemap.xml +0 -27
  112. package/test/mocha/html-snapshots/server/public/wordpress-2/post_tag-sitemap.xml +0 -17
  113. package/test/mocha/html-snapshots/server/public/wordpress-2/product-sitemap.xml +0 -13
  114. package/test/mocha/html-snapshots/server/require.js +0 -1
  115. package/test/mocha/html-snapshots/server/services/carpets/index.html +0 -57
  116. package/test/mocha/html-snapshots/server/test_robots.txt +0 -13
  117. package/test/mocha/html-snapshots/server/test_robots_sitemap.txt +0 -15
  118. package/test/mocha/html-snapshots/server/test_robots_sitemap.xml +0 -22
  119. package/test/mocha/html-snapshots/server/test_sitemap_index-2.xml +0 -25
  120. package/test/mocha/html-snapshots/server/test_sitemap_index-3.xml +0 -25
  121. package/test/mocha/html-snapshots/server/test_sitemap_index.xml +0 -25
  122. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/extras/custom-validity.js +0 -1
  123. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/extras/modernizr-custom.js +0 -1
  124. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/extras/mousepress.js +0 -1
  125. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/polyfiller.js +0 -1
  126. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/FlashCanvas/canvas2png.js +0 -1
  127. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/FlashCanvas/flashcanvas.js +0 -1
  128. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/FlashCanvas/flashcanvas.swf +0 -0
  129. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/FlashCanvas/proxy.php +0 -73
  130. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/FlashCanvas/save.php +0 -49
  131. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/FlashCanvasPro/canvas2png.js +0 -1
  132. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/FlashCanvasPro/flash10canvas.swf +0 -0
  133. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/FlashCanvasPro/flash9canvas.swf +0 -0
  134. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/FlashCanvasPro/flashcanvas.js +0 -1
  135. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/FlashCanvasPro/proxy.php +0 -73
  136. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/FlashCanvasPro/save.php +0 -49
  137. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/1.js +0 -1
  138. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/10.js +0 -1
  139. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/11.js +0 -1
  140. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/12.js +0 -1
  141. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/13.js +0 -1
  142. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/14.js +0 -1
  143. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/15.js +0 -1
  144. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/16.js +0 -1
  145. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/17.js +0 -1
  146. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/18.js +0 -1
  147. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/19.js +0 -1
  148. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/2.js +0 -1
  149. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/20.js +0 -1
  150. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/21.js +0 -1
  151. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/22.js +0 -1
  152. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/23.js +0 -1
  153. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/24.js +0 -1
  154. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/25.js +0 -1
  155. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/26.js +0 -1
  156. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/27.js +0 -1
  157. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/3.js +0 -1
  158. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/4.js +0 -1
  159. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/5.js +0 -1
  160. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/59.js +0 -1
  161. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/6.js +0 -1
  162. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/7.js +0 -1
  163. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/8.js +0 -1
  164. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/9.js +0 -1
  165. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/details.js +0 -1
  166. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/dom-extend.js +0 -1
  167. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/es5.js +0 -1
  168. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/excanvas.js +0 -1
  169. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/form-core.js +0 -1
  170. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/form-datalist.js +0 -1
  171. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/form-message.js +0 -1
  172. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/form-native-extend.js +0 -1
  173. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/form-number-date-api.js +0 -1
  174. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/form-number-date-ui.js +0 -1
  175. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/form-shim-extend.js +0 -1
  176. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/geolocation.js +0 -1
  177. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-ar.js +0 -1
  178. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-ch-ZN.js +0 -1
  179. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-de.txt +0 -33
  180. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-el.js +0 -1
  181. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-en.txt +0 -34
  182. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-es.js +0 -1
  183. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-fr.js +0 -1
  184. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-he.js +0 -1
  185. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-hi.js +0 -1
  186. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-hu.js +0 -1
  187. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-it.js +0 -1
  188. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-ja.js +0 -1
  189. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-nl.js +0 -1
  190. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-pt-PT.js +0 -1
  191. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-ru.js +0 -1
  192. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-sv.js +0 -1
  193. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/json-storage.js +0 -1
  194. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/jwplayer/license.txt +0 -1
  195. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/jwplayer/player.swf +0 -0
  196. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/jwplayer/readme.html +0 -87
  197. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/mediaelement-core.js +0 -1
  198. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/mediaelement-jaris.js +0 -1
  199. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/mediaelement-native-fix.js +0 -1
  200. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/mediaelement-swf.js +0 -1
  201. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/mediaelement-yt.js +0 -1
  202. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/styles/details-arrows.png +0 -0
  203. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/styles/forms.png +0 -0
  204. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/styles/polyfill-loader.gif +0 -0
  205. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/styles/shim.css +0 -1
  206. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/swf/JarisFLVPlayer.swf +0 -0
  207. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/swf/jwwebshims.swf +0 -0
  208. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/swf/localStorage.swf +0 -0
  209. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/track-ui.js +0 -1
  210. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/track.js +0 -1
  211. package/test/mocha/html-snapshots/server/vendor/js/plugins/cload.js +0 -49
  212. package/test/mocha/html-snapshots/server/vendor/js/plugins/modernizr.js +0 -4
  213. package/test/mocha/html-snapshots/server/vendor/js/plugins/oldie.js +0 -74
  214. package/test/mocha/html-snapshots/sitemap-index.js +0 -140
  215. package/test/mocha/html-snapshots/sitemap.js +0 -104
  216. package/test/mocha/html-snapshots/snapshot-scripts.js +0 -206
  217. package/test/mocha/html-snapshots/test.js +0 -105
  218. package/test/mocha/html-snapshots/test_robots.txt +0 -13
  219. package/test/mocha/html-snapshots/test_sitemap.xml +0 -22
  220. package/test/mocha/html-snapshots/use-jquery.js +0 -144
  221. package/test/mocha/html-snapshots/utils.js +0 -200
  222. package/test/mocha/input-generators/server/public/wordpress/category-sitemap.xml +0 -13
  223. package/test/mocha/input-generators/server/public/wordpress/page-sitemap.xml +0 -16
  224. package/test/mocha/input-generators/server/public/wordpress/post-sitemap.xml +0 -55
  225. package/test/mocha/input-generators/server/public/wordpress/post_tag-sitemap.xml +0 -25
  226. package/test/mocha/input-generators/server/public/wordpress/product-sitemap.xml +0 -13
  227. package/test/mocha/input-generators/server/test_robots.txt +0 -15
  228. package/test/mocha/input-generators/server/test_robots_bad.txt +0 -11
  229. package/test/mocha/input-generators/server/test_robots_sitemap.txt +0 -17
  230. package/test/mocha/input-generators/server/test_robots_sitemap_bad.txt +0 -17
  231. package/test/mocha/input-generators/server/test_robots_sitemap_multi.txt +0 -18
  232. package/test/mocha/input-generators/server/test_sitemap.xml +0 -34
  233. package/test/mocha/input-generators/server/test_sitemap.xml.gz +0 -0
  234. package/test/mocha/input-generators/server/test_sitemap_bad.xml.gz +0 -0
  235. package/test/mocha/input-generators/server/test_sitemap_index.xml +0 -25
  236. package/test/mocha/input-generators/server/test_sitemap_index.xml.gz +0 -0
  237. package/test/mocha/input-generators/server/test_sitemap_index_empty.xml +0 -3
  238. package/test/mocha/input-generators/server/test_sitemap_index_malformed.xml +0 -2
  239. package/test/mocha/input-generators/sitemap-index.js +0 -87
  240. package/test/mocha/input-generators/sitemap.js +0 -320
  241. package/test/mocha/input-generators/test.js +0 -1447
  242. package/test/mocha/input-generators/test_line.txt +0 -5
  243. package/test/mocha/input-generators/test_robots.txt +0 -15
  244. package/test/mocha/input-generators/test_robots_bad.txt +0 -11
  245. package/test/mocha/input-generators/test_robots_sitemap.txt +0 -17
  246. package/test/mocha/input-generators/test_robots_sitemap_bad.txt +0 -17
  247. package/test/mocha/input-generators/test_robots_sitemap_multi.txt +0 -18
  248. package/test/mocha/input-generators/test_sitemap.xml +0 -34
  249. package/test/mocha/input-generators/test_sitemap.xml.gz +0 -0
  250. package/test/mocha/input-generators/test_sitemap_bad.xml.gz +0 -0
  251. package/test/mocha/input-generators/test_sitemap_index.xml +0 -25
  252. package/test/mocha/input-generators/test_sitemap_index.xml.gz +0 -0
  253. package/test/server/index.js +0 -32
@@ -1,129 +0,0 @@
1
- /**
2
- * Tests that target the puppeteer script specifically.
3
- *
4
- * Copyright (c) 2013 - 2022, Alex Grant, LocalNerve, contributors
5
- */
6
- /* global before, it */
7
- const assert = require("assert");
8
- const path = require("path");
9
- const rimraf = require("rimraf").sync;
10
- const spawn = require("child_process").spawn;
11
- const server = require("../../server");
12
-
13
- const outputDir = path.join(__dirname, "tmp");
14
- const port = 9340;
15
-
16
- function puppeteerTests () {
17
- const snapshotScript = path.resolve(__dirname, '../../../lib/puppeteer/index.js');
18
- const outputFile = path.join(outputDir, "snapshot.html");
19
-
20
- /**
21
- * Launch the puppeteer script as a process.
22
- *
23
- * @param {Array} args - array of puppeteer args
24
- */
25
- function spawnPuppeteer (args, done) {
26
- const cp = spawn(
27
- snapshotScript,
28
- args
29
- , { cwd: process.cwd(), stdio: "inherit", detached: true }
30
- );
31
-
32
- cp.on("exit", code => {
33
- if (code !== 0) {
34
- return done(new Error(`error exit code: ${code}`));
35
- }
36
- done();
37
- });
38
- }
39
-
40
- return function () {
41
- before(function() {
42
- server.start(path.join(__dirname, "./server"), port);
43
- });
44
-
45
- it("should succeed with minimal args", function (done) {
46
- this.timeout(4000);
47
-
48
- rimraf(outputDir);
49
-
50
- spawnPuppeteer([
51
- outputFile,
52
- `http://localhost:${port}/`,
53
- "body"
54
- ], done);
55
- });
56
-
57
- it("should succeed with stringified puppeteerLaunchOptions", function (done) {
58
- this.timeout(4000);
59
- rimraf(outputDir);
60
-
61
- // override the debug options to prove stringified launch opts worked.
62
- const puppeteerLaunchOptions = {
63
- headless: true,
64
- devTools: false
65
- };
66
-
67
- spawnPuppeteer([
68
- outputFile,
69
- `http://localhost:${port}/`,
70
- "body",
71
- 4000,
72
- "false",
73
- "true",
74
- 10,
75
- JSON.stringify(puppeteerLaunchOptions)
76
- ], done);
77
- });
78
-
79
- it("should fail if insufficient input args", function (done) {
80
- rimraf(outputDir);
81
-
82
- spawnPuppeteer([
83
- outputFile,
84
- "http://someurl.domain/path/resource"
85
- ], e => {
86
- const msg = "expected process error";
87
- assert.ok(e, msg);
88
- done(e ? undefined : new Error(msg));
89
- });
90
- });
91
-
92
- it("should fail with bad url", function (done) {
93
- rimraf(outputDir);
94
-
95
- spawnPuppeteer([
96
- outputFile,
97
- "http://nonexistent.domain/path/resource",
98
- "body",
99
- 1000
100
- ], e => {
101
- const msg = "expected process error";
102
- assert.ok(e, msg);
103
- done(e ? undefined : new Error(msg));
104
- });
105
- });
106
-
107
- it("should launch debugging", function (done) {
108
- const timeout = 5000;
109
- this.timeout(timeout);
110
-
111
- rimraf(outputDir);
112
-
113
- spawnPuppeteer([
114
- outputFile,
115
- `http://localhost:${port}/`,
116
- "body",
117
- timeout - 1000,
118
- "false",
119
- "true",
120
- 10
121
- ], done);
122
- });
123
-
124
- };
125
- }
126
-
127
- module.exports = {
128
- testSuite: puppeteerTests
129
- };
@@ -1,9 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en-US">
3
- <body>
4
- <h1>Hello World</h1>
5
- <p>
6
- This is a simple test file, how do you do?
7
- </p>
8
- </body>
9
- </html>
@@ -1,11 +0,0 @@
1
- /**
2
- * browser process specific tests
3
- *
4
- * Copyright (c) 2013 - 2022, Alex Grant, LocalNerve, contributors
5
- */
6
- /* global describe */
7
- const puppeteer = require("./puppeteer");
8
-
9
- describe("browser process tests", function () {
10
- describe("puppeteer", puppeteer.testSuite());
11
- });
@@ -1,87 +0,0 @@
1
- /**
2
- * Helpers tests.
3
- *
4
- * Copyright (c) 2013 - 2022, Alex Grant, LocalNerve, contributors
5
- */
6
- /* global describe, it */
7
- var assert = require("assert");
8
- var resHelper = require("../../helpers/result");
9
-
10
- describe("helpers", function() {
11
-
12
- describe("result", function() {
13
-
14
- describe("mustBeError", function() {
15
-
16
- it("should succeed if get Error", function() {
17
- resHelper.mustBeError(new Error());
18
- });
19
-
20
- it("should succeed if get String", function() {
21
- resHelper.mustBeError("test error");
22
- });
23
-
24
- it("should fail if null string", function() {
25
- var err;
26
- try {
27
- resHelper.mustBeError("");
28
- } catch(e) {
29
- err = e;
30
- }
31
- assert.notStrictEqual(typeof err, "undefined");
32
- });
33
-
34
- it("should fail if false", function() {
35
- var err;
36
- try {
37
- resHelper.mustBeError(false);
38
- } catch(e) {
39
- err = e;
40
- }
41
- assert.notStrictEqual(typeof err, "undefined");
42
- });
43
-
44
- it("should fail if undefined", function() {
45
- var err;
46
- try {
47
- resHelper.mustBeError();
48
- } catch(e) {
49
- err = e;
50
- }
51
- assert.notStrictEqual(typeof err, "undefined");
52
- });
53
-
54
- it("should fail if NaN", function() {
55
- var err;
56
- try {
57
- resHelper.mustBeError(NaN);
58
- } catch(e) {
59
- err = e;
60
- }
61
- assert.notStrictEqual(typeof err, "undefined");
62
- });
63
-
64
- it("should fail if 0", function() {
65
- var err;
66
- try {
67
- resHelper.mustBeError(0);
68
- } catch(e) {
69
- err = e;
70
- }
71
- assert.notStrictEqual(typeof err, "undefined");
72
- });
73
-
74
- it("should fail if null", function() {
75
- var err;
76
- try {
77
- resHelper.mustBeError(null);
78
- } catch(e) {
79
- err = e;
80
- }
81
- assert.notStrictEqual(typeof err, "undefined");
82
- });
83
- });
84
-
85
- });
86
-
87
- });
@@ -1,188 +0,0 @@
1
- /**
2
- * Common module tests.
3
- *
4
- * Copyright (c) 2013 - 2022, Alex Grant, LocalNerve, contributors
5
- */
6
- /* global describe, it */
7
- var assert = require("assert");
8
- var path = require("path");
9
- var common = require("../../../lib/common");
10
-
11
- describe("common", function () {
12
-
13
- describe("ensure", function () {
14
-
15
- it("should return the options if no defaults specified", function () {
16
- var options = { one: "one", two: "two", three: "three" };
17
- var result = common.ensure(options);
18
- assert.equal(result.toString(), options.toString());
19
- });
20
-
21
- it("should return the result options", function () {
22
- var defaults = { one: "two", two: "three", three: "four" };
23
- var options = { one: "one", two: "two", three: "three" };
24
- var result = common.ensure(options, defaults);
25
- assert.equal(result.toString(), options.toString());
26
- });
27
-
28
- it("should not copy defaults when specified in options", function () {
29
- var defaults = { one: "two", two: "three", three: "four" };
30
- var options = { one: "one", two: "two", three: "three" };
31
- common.ensure(options, defaults);
32
- assert.equal("one", options.one);
33
- assert.equal("two", options.two);
34
- assert.equal("three", options.three);
35
- });
36
-
37
- it("should copy defaults when not specified in options", function () {
38
- var defaults = { one: "two", two: "three", three: "four" };
39
- var options = { one: "one", two: "two" };
40
- common.ensure(options, defaults);
41
- assert.equal("one", options.one);
42
- assert.equal("two", options.two);
43
- assert.equal("four", options.three);
44
- });
45
- });
46
-
47
- describe("isUrl", function () {
48
-
49
- it("should detect an http url", function () {
50
- var result = common.isUrl("http://whatever.com/");
51
- assert.equal(true, result);
52
- });
53
-
54
- it("should not detect a file", function () {
55
- var result = common.isUrl(path.join(__dirname, __filename));
56
- assert.equal(false, result);
57
- });
58
-
59
- it("should not detect an object", function () {
60
- var result = common.isUrl({ url: "bogus" });
61
- assert.equal(false, result);
62
- });
63
- });
64
-
65
- describe("prependMsgToErr", function () {
66
-
67
- it("should return undefined if given falsy error", function () {
68
- var result = common.prependMsgToErr(undefined, "message", true);
69
-
70
- assert.equal(result, undefined);
71
- });
72
-
73
- it("should return same error if given error and no message", function () {
74
- // These need to have the same message.
75
- var error = new Error("my test error");
76
- var input = new Error("my test error");
77
-
78
- var result = common.prependMsgToErr(input);
79
-
80
- assert.deepEqual(result, error);
81
- });
82
-
83
- it("should quote the message when asked", function () {
84
- var msg = "my message";
85
- var result = common.prependMsgToErr(new Error("my test error"), msg, true);
86
-
87
- assert.equal(result.message.indexOf("'"+msg+"'") > -1, true);
88
- });
89
-
90
- it("should not quote a message when asked", function () {
91
- var msg = "my message";
92
- var result = common.prependMsgToErr(new Error("my test error"), msg);
93
-
94
- assert.equal(result.message.indexOf("'"+msg+"'") === -1, true);
95
- assert.equal(result.message.indexOf(msg) > -1, true);
96
- });
97
-
98
- it("should make an error if string was given", function () {
99
- var input = "my test error";
100
- var msg = "my message";
101
- var result = common.prependMsgToErr(input, msg, true);
102
-
103
- assert.equal(result instanceof Error, true);
104
- assert.equal(result.message.indexOf("'"+msg+"'") > -1, true);
105
- });
106
-
107
- it("should prepend message to error", function () {
108
- var msg = "my message";
109
- var errMsg = "my test error";
110
- var result = common.prependMsgToErr(new Error(errMsg), msg);
111
-
112
- var resultMessage = result.message.split(": ");
113
-
114
- assert.equal(resultMessage.length > 1, true);
115
- assert.equal(resultMessage[0], msg);
116
- assert.equal(resultMessage[1], errMsg);
117
- });
118
- });
119
-
120
- describe("checkResponse", function () {
121
-
122
- it("should reject a non 200 response", function() {
123
- var result = common.checkResponse({ statusCode: 206 }, "doesntmatter");
124
- assert.notEqual(false, result);
125
- });
126
-
127
- it("should reject for missing content type", function() {
128
- var result = common.checkResponse({
129
- statusCode: 200,
130
- headers: {}
131
- }, "any");
132
- assert.notEqual(false, result);
133
- });
134
-
135
- it("should reject for bad content type, single", function() {
136
- var result = common.checkResponse({
137
- statusCode: 200,
138
- headers: {
139
- "content-type": "text/plain"
140
- }
141
- }, "text/xml");
142
- assert.notEqual(false, result);
143
- });
144
-
145
- it("should reject for bad content type, multiple", function() {
146
- var result = common.checkResponse({
147
- statusCode: 200,
148
- headers: {
149
- "content-type": "text/plain"
150
- }
151
- }, ["text/xml", "application/xml"]);
152
- assert.notEqual(false, result);
153
- });
154
-
155
- it("should accept for good content type, single", function() {
156
- var contentType = "text/plain";
157
- var result = common.checkResponse({
158
- statusCode: 200,
159
- headers: {
160
- "content-type": contentType
161
- }
162
- }, contentType);
163
- assert.equal(false, result);
164
- });
165
-
166
- it("should accept for good content type, multiple, first", function() {
167
- var contentType = "text/xml";
168
- var result = common.checkResponse({
169
- statusCode: 200,
170
- headers: {
171
- "content-type": contentType
172
- }
173
- }, [contentType, "application/xml"]);
174
- assert.equal(false, result);
175
- });
176
-
177
- it("should accept for good content type, multiple, last", function() {
178
- var contentType = "text/xml";
179
- var result = common.checkResponse({
180
- statusCode: 200,
181
- headers: {
182
- "content-type": contentType
183
- }
184
- }, ["application/xml", contentType]);
185
- assert.equal(false, result);
186
- });
187
- });
188
- });
@@ -1,88 +0,0 @@
1
- /**
2
- * Basic library tests.
3
- *
4
- * Copyright (c) 2013 - 2022, Alex Grant, LocalNerve, contributors
5
- */
6
- /* global it */
7
- const assert = require("assert");
8
- const _ = require("lodash");
9
- const fs = require("fs");
10
- const path = require("path");
11
- const ss = require("../../../lib/html-snapshots");
12
- const utils = require("./utils");
13
- const optHelp = require("../../helpers/options");
14
-
15
- // missing destructuring, will write postcard...
16
- const {
17
- bogusFile,
18
- cleanupError,
19
- unexpectedSuccess
20
- } = utils;
21
-
22
- function basicTests (options) {
23
- const {
24
- browsers
25
- } = options;
26
- return function () {
27
- browsers.forEach(browser => {
28
- it(`no arguments should fail - ${browser}`, function (done) {
29
- const twice = _.after(2, cleanupError.bind(null, done, 0));
30
-
31
- ss.run(optHelp.decorate({
32
- browser
33
- }), twice)
34
- .then(unexpectedSuccess.bind(null, done))
35
- .catch(twice);
36
- });
37
-
38
- it(`invalid source should fail - ${browser}`, function (done) {
39
- const twice = _.after(2, cleanupError.bind(null, done, 0));
40
-
41
- ss.run(optHelp.decorate({
42
- source: bogusFile,
43
- browser
44
- }), twice)
45
- .then(unexpectedSuccess.bind(null, done))
46
- .catch(twice);
47
- });
48
-
49
- it(`should clean the output directory when specified - ${browser}`, function (done) {
50
- const dir = path.join(__dirname, "./tmpdir");
51
- const file = path.join(dir, "somefile.txt");
52
- const twice = _.after(2, cleanupError.bind(null, done, 0));
53
-
54
- fs.mkdirSync(dir);
55
- fs.writeFileSync(file, "some data");
56
- assert.doesNotThrow(fs.accessSync.bind(null, dir));
57
-
58
- ss.run(optHelp.decorate({
59
- source: bogusFile,
60
- outputDir: dir,
61
- outputDirClean: true,
62
- browser
63
- }), twice)
64
- .then(unexpectedSuccess.bind(null, done))
65
- .catch(twice);
66
-
67
- assert.throws(fs.accessSync.bind(null, dir));
68
- });
69
-
70
- it(`default snapshot script should exist - ${browser}`, function (done) {
71
- const options = { source: "./bogus/file.txt", browser };
72
- const twice = _.after(2, cleanupError.bind(null, done, 0));
73
-
74
- const result = ss.run(optHelp.decorate(options), twice);
75
-
76
- assert.doesNotThrow(fs.accessSync.bind(null, options.snapshotScript));
77
-
78
- result
79
- .then(unexpectedSuccess.bind(null, done))
80
- .catch(twice);
81
- });
82
- });
83
- };
84
- }
85
-
86
- module.exports = {
87
- testSuite: basicTests
88
- };
@@ -1,10 +0,0 @@
1
- /**
2
- * In-test, custom filter script.
3
- * Adds a custom tag onto the body.
4
- *
5
- * Copyright (c) 2013 - 2022, Alex Grant, LocalNerve, contributors
6
- */
7
- module.exports = function(content) {
8
- console.log("IN THE CUSTOMFILTER");
9
- return content.replace(/<body\b\s*/i, "<body data-someattrZZQy=\"true\" ");
10
- };
@@ -1,156 +0,0 @@
1
- /**
2
- * Library tests focused on the phantomjsOptions option.
3
- *
4
- * Copyright (c) 2013 - 2022, Alex Grant, LocalNerve, contributors
5
- */
6
- /* global it */
7
- const path = require("path");
8
- const fs = require("fs");
9
- const rimraf = require("rimraf").sync;
10
- const utils = require("./utils");
11
- const optHelp = require("../../helpers/options");
12
- const resHelp = require("../../helpers/result");
13
- const ss = require("../../../lib/html-snapshots");
14
-
15
- const {
16
- timeout,
17
- outputDir,
18
- cleanup,
19
- unexpectedError,
20
- unexpectedSuccess,
21
- checkActualFiles
22
- } = utils;
23
-
24
- const outputBase = path.resolve(outputDir, "..");
25
- const cookiesFile = path.join(outputBase, "cookies.txt");
26
-
27
- function phantomjsOptionsTests (options) {
28
- const {
29
- port
30
- } = options;
31
-
32
- function createOptions (newOptions) {
33
- const defaultOptions = {
34
- input: "array",
35
- source: [ `http://localhost:${port}/pjsopts` ],
36
- outputDir,
37
- outputDirClean: false,
38
- selector: ".content-complete",
39
- timeout,
40
- browser: "phantomjs",
41
- phantomjsOptions: `--cookies-file=${cookiesFile}`
42
- }
43
- return {
44
- ...defaultOptions,
45
- ...newOptions
46
- };
47
- }
48
-
49
- return function () {
50
- it ("should work on first vanilla full invocation, no checks", function (done) {
51
- const options = createOptions({});
52
-
53
- rimraf(outputBase);
54
-
55
- ss.run(optHelp.decorate(options))
56
- .then(() => {
57
- cleanup(done);
58
- }).catch(e => {
59
- checkActualFiles(e.notCompleted)
60
- .then(() => {
61
- cleanup(done, e || unexpectedError);
62
- });
63
- });
64
- });
65
-
66
- it("should work with one string option", function (done) {
67
- const options = createOptions({});
68
-
69
- rimraf(outputBase);
70
-
71
- ss.run(optHelp.decorate(options), (err, completed) => {
72
- if (err) {
73
- console.log(`@@@ error = ${err}, completed=${completed.join(',')}`);
74
- }
75
- })
76
- .then(() => {
77
- let assertionError;
78
- try {
79
- fs.accessSync(cookiesFile);
80
- } catch (e) {
81
- assertionError = e;
82
- }
83
- cleanup(done, assertionError);
84
- })
85
- .catch(e => {
86
- checkActualFiles(e.notCompleted)
87
- .then(function () {
88
- cleanup(done, e || unexpectedError);
89
- });
90
- });
91
- });
92
-
93
- it("should work with multiple options, test one", function (done) {
94
- const options = createOptions({
95
- selector: "#inline-image",
96
- phantomjsOptions: [
97
- `--cookies-file=${cookiesFile}`,
98
- "--load-images=true"
99
- ]
100
- });
101
-
102
- rimraf(outputBase);
103
-
104
- ss.run(optHelp.decorate(options), (err, completed) => {
105
- if (err) {
106
- console.log(`@@@ error = ${err}, completed=${completed.join(',')}`);
107
- }
108
- })
109
- .then(() => {
110
- let assertionError;
111
- try {
112
- fs.accessSync(cookiesFile);
113
- } catch (e) {
114
- assertionError = e;
115
- }
116
- cleanup(done, assertionError);
117
- })
118
- .catch(e => {
119
- checkActualFiles(e.notCompleted)
120
- .then(() => {
121
- cleanup(done, e || unexpectedError);
122
- });
123
- });
124
- });
125
-
126
- it("should work with multiple options, test two", function (done) {
127
- const options = createOptions({
128
- selector: "#inline-image",
129
- timeout: 5000, // this should fail, so don't wait too long.
130
- phantomjsOptions: [
131
- `--cookies-file=${cookiesFile}`,
132
- "--load-images=false"
133
- ]
134
- });
135
-
136
- rimraf(outputBase);
137
-
138
- ss.run(optHelp.decorate(options))
139
- .then(unexpectedSuccess.bind(null, done))
140
- .catch(err => {
141
- let assertionError;
142
- try {
143
- resHelp.mustBeError(err);
144
- } catch (e) {
145
- assertionError = e;
146
- }
147
- cleanup(done, assertionError);
148
- });
149
- });
150
- // most of these tests use no options, so not testing that again here
151
- };
152
- }
153
-
154
- module.exports = {
155
- testSuite: phantomjsOptionsTests
156
- };