Given scenario:
-You have a 500-page website, and have made improvements to 10 of the pages with style changes.
-All of the 500 pages share the same set of css-files.
How can you be certain that only the 10 pages were affected by your changes?
One solution could be
1) Take screenshots of all the pages. This is how it looks now.
2) Write and commit the change. Potentially your change should only have changed what you intended to change.
3) finally take another set of screenshots. Compare the screenshots with the original screenshots. The difference should only be visible on the 10 of the screenshots.
Warning : The code is meant for pages without too much dynamic content. Elements like for instance a clock (something that changes all the time) will trigger a difference between two screenshots. It's also nice if the pages load quickly. If not maybe all of the elements haven't loaded in time for the screenshots (which will produce different pictures).
The code to take screenshots
Notes on the code:
-In this example I read each line of a file with one url on each line.
Note:
-The first argument is the "before" screenshots directory. The second is the "after" screenshots directory.
- I wrote this because I found that you can't use regular linux diff as it is too strict. You need to account for atleast 100 bytes in difference
-The code is crude, please just use it as an example :)