lozad.js icon indicating copy to clipboard operation
lozad.js copied to clipboard

Test coverage, first working example

Open 0gust1 opened this issue 6 years ago • 1 comments

A working prototype of test coverage using Jest and Puppeteer.

How to :

  • launch the dev server (npm run serve) in a shell
  • launch the test runner (node_modules/.bin/jest) in another shell

ATM, only the basic responsive scenario is covered (we test the currentSrc atttribute after page load + some scrolling, for one browser resolution). A lot of things can and should be improved, I just wanted to show a POC on how we can do that.

Todo :

  • launch a small server (no browsersync ?) and the test runner in same command (Travis will be happier, too)
  • some code cleaning and eventually discussion with @ApoorvSaxena on what to test, how to test and how to organize files
  • cover all the functionnalities of the library (including the coverage from js-dom code)
  • Suppress all existing js-dom based test references.

Note : I updated the babel configuration, to better use the babel-env plugin. there is maybe some things to adjust.

0gust1 avatar Apr 23 '18 07:04 0gust1

note for later (travis error about puppeteer) : https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#chrome-headless-fails-due-to-sandbox-issues

0gust1 avatar May 07 '18 14:05 0gust1