- Python 3 is required (expected executable to be called
python3) - Pip 3 is required (expected executable to be called
pip3) - Node is required
- NPM is required
npm install
pip3 install termtables
pip3 install requests
pip3 install yattag
pip3 install six
pip3 install lorem
pip3 install pillow
pip3 install selenium
pip3 install numpy- Define website to capture in
config.yml.- Define testing viewports to capture.
- Define url(s) to capture.
- Define delay between captures.
scripts/capture-mutate.jsis executed before capture of website, allowing you to modify the website before capture.- Run
scripts/capture.sh CoffeeIO-1.2.0to perform capture.- First param is optional. It is just tag metadata to make it easier to identity later.
- Each capture produces 2 files in
/captures.- A PNG screenshot of the website at the specific viewport.
- A JSON file containing.
- The whole DOM tree and styles at capture.
- Some meta information about the capture.
- In
/capture-summariesa file is produced that describe all the captures and meta information.-
{ "files": [ /* Captures */ { "file": "captures/2021-08-07--11-10-43--1--innovationsfonden.dk--1600", "viewport": 1600, "url": "https://innovationsfonden.dk/" },... ], "tag": "CoffeeIO-1.2.0", /* Optional tag for searching */ "domain": "innovationsfonden.dk", "id": "77ugJzaV0J", /* UUID of capture */ "datetime": "2021-08-07--11-10-43", /* Datetime of capture */ "execution": "85s", /* Total execution time of all captures */ "config": { /* Copy of config file at time of capture */ "viewports": [ 1600, 1200, ... ], "urls": [ "https://innovationsfonden.dk/", "https://innovationsfonden.dk/da/om-innovationsfonden", ... ], "delay": 3000 }, "key": -783019585 /* Hash key for disallowing invalid comparisons in compare.sh */ }
-
scripts/list.shto list all capturesscripts/list.sh "1.2"orscripts/list.sh "coffeeio.com"to list captures containing specific tag- From the list, the unique ids will be shown, these are used for the compare command.
- Note: only captures with identical hashes can be compared.
scripts/compare.sh {id} {id}- First id defines the before state of website, second id is the after state of the website.
- This produces a folder in
comparisons/test{number}containing:- Each comparision in this folder is numbered and has two folders
before{number}andafter{number}to represent files relating to before or after state.- In each folder there is 4 files:
image.pngThe original screenshot.image-diff.pngThe screenshot with diff highlights.image-diff-highlight.pngThe diff highlights without the screenshot.output.jsonA JSON description of all detected differences.
- Red : Removed element
- Yellow : Modified element
- Green : Added element
- json describes exactly which dom elements are affected
/ChromeExtension- Chrome extension code/src- Source code of JavaScript module for capturing website data./dist- Compiled files of the JavaScript module/TreeDistance/domvrt- Source code of the Python module for comparison./zss- Source code of ZSS library with custom modifications
/captures- Data input files for VRT tests/capture-summaries- Data output files for VRT tests/comparisons- Data input for distance correctness tests
Go to Chrome, settings, 'more tools', 'extensions', 'load unpacked' and select the 'ChromeExtension' folder.
In the top right corner there is an icon for the Chrome extension, press this to extract a snapshot of the DOM.
To use the abstraction layer to create the set of expected changes; open the console, switch the JavaScript context to use the Chrome extension. Now call the module functions under DomVRT.Differ.
node resembleAll.js
Run a single test in comparisions folder.
node resembleTest.js {somefolder}
--- example
node resembleTest.js test0012

