Webotest is an npm package - automated web test, used to compare two website page screenshots - local (unpublished) un public (published). Focusing developement on multipage CMS websites (like
EPiServer CMS, where CMS pages are part of website's navigation
.
Webotest repository available on GitHub and Webotest package available on npm.
You need to have installed npm and Node.js on your machine.
Website navigation structure has to be identical to run successful test - otherwise there is no use to run tests, as they won't bring up the necessary and proper results.
Only publicly available pages will be read in website navigation to create comparement.
NOTE: Using hyperlink `<a></a>` href data to get hierachical structure of website.
If none of the hyperlinks are detected, test won't return expected results.
NOTE: Internet connection failures can cause screenshot making issues.
npm install webotest
Package's current version works only with npm2.
Working to support it on npm3.
Run tests in console from webotest directory, for example: C:\Users\elinale\node_modules\webotest
... This directory also is, where all test results are saved
.
There is only one command to run webotest:
node web-tester.js --localUrl=http://local_website --publicUrl=http://public_website
as in
node web-tester.js --localUrl=http://site.localtest.me --publicUrl=http://www.site.com
node web-tester.js --localUrl=http://site.localtest.me --publicUrl=http://test.site.com
node web-tester.js --localUrl=http://site.localtest.me --publicUrl=http://staging.site.com
etc.
!
Always write down the protocol as shown in example, otherwise tests won't be run.
!
Remember to keep in sync content between local and public websites and identical navigation structure (links), as webotest relies on that. Again, great and developed to work with websites created on EPiServer CMS basis, as it allows to import/export website contents.
To prevent unwanted changes in website design, ease job with bug reports - just check localhost:8082 after you get notification "Listening to localhost" in console.
!
Note, that html files can be overviewed in browser while local server is running, as they are created dynamically and get data from server side.
Main directory (created based on test date) with four subdirectories:
- for local site;
- for published site;
- dynamically created html files (for local server);
- image results (.png files).
Local site and public site subdirectories contain:
- image directory with site's hierarchical page structure screenshots;
- .json file with a list of site's hierarchical structure (URL addresses).
Elina Lenova
This project is licensed under the MIT License.
Other npm packages also were used, to make things happen, check the package.json
file to see the list of dependencies and under other_resources
directory.