Selenium Screen Master
Install
Dependencies
This needed only for nodeJs canvas, see more here - https://www.npmjs.com/package/canvas
Ubuntu: sudo apt-get install libcairo2-dev libjpeg8-dev libpango1.0-dev libgif-dev build-essential g++
OS X: brew install pkg-config cairo libpng jpeg giflib
How to use
Take screenshot of element
const Ssm = ; const SERVER_URL = 'http://statlex.github.io/';const WEB_DRIVER_SERVER_URL = 'http://localhost:4444/wd/hub'; const WebDriver = ;const byCss = WebDriverBycss;const driver = ; driver; const ssm = ; ssm;ssm;ssm; ssm ; // OR ssm ; // OR ssm ; driver;
Save screenshot of element
const Ssm = ; const SERVER_URL = 'http://statlex.github.io/';const WEB_DRIVER_SERVER_URL = 'http://localhost:4444/wd/hub'; const WebDriver = ;const byCss = WebDriverBycss;const driver = ; driver; const ssm = ; ssm;ssm;ssm; ssm; ssm ; // OR ssm ; // OR ssm ; driver;
Compare images
const Ssm = ; const SERVER_URL = 'http://statlex.github.io/';const WEB_DRIVER_SERVER_URL = 'http://localhost:4444/wd/hub'; const WebDriver = ;const byCss = WebDriverBycss;const driver = ; driver; const ssm = ; ssm;ssm;// WARNING// to COLLECT screenshots use MODE = MODE.COLLECT// to TEST screenshots use MODE = MODE.TESTconst MODE = ssmMODE;ssm; ssm; ssm ; // OR ssm ; // OR ssm ; driver;
Helpers
// set screen sizessm; // reset propertiesssm;
Test
1 - Install all dependencies for selenium-screen-master
2 - Install mocha globally
$ npm i && sudo npm i -g mocha
Run test
$ npm test
Recommendations
Use for test mocha + mochawesome + mochawesome/addContext + chai.
See ./test/test.js and ./test/test.sh as example to create beautiful test report.
To see my solution run tests for this projects.