https://github.com/subbuss/parsoid_visual_diffs
I've pushed a bunch of updates over the last week which should now make
this usable for comparing HTML files from different sources (not
restricted to PHP parser and Parsoid). I did this so that this could be
used to compare the rendering of Tidy and HTML5depurate HTML (T89331).
You can now provide options in a config file (example config file
included in bin/settings.js.example).
You can provide DOM-post-processing scripts to inject (in the context of
a browser window) and process the HTML before it is screenshotted. This
is useful in the PHP and Parsoid cases where we need to make sure all
the closed-by-default tabs / tables / etc. are opened, custom CSS is
injected (to use Parsoid styling), chrome is removed, etc. PHP parser
and Parsoid HTML injectable scripts are in lib/*postprocess.js. Similar
scripts can be provided for other use cases.
You can run a visualdiffing node service (which is currently still
targeted at visual diffing PHP parser and Parsoid output, but could
potentially be extended to not be hardcoded for those use cases). The
codebase also provides a testreduce client for use with Parsoid's
testreduce service for running these kind of tests on a set of pages in
an automated fashion.
This codebase is not pretty or polished but it does the job for the use
cases it is targeted for. I wanted to spend only as much time on it as
required to get the job done rather than overengineer it for multiple
use cases.
As part of the RFC discussion on T89331, there was some interest in
using this outside of Parsoid's visual diffing usecase. That is the
motivation for this more wider update.
This first pass of cleanup, refactoring, and generalization is primarily
to support work being done as part of T89331. More testing to be done.
But, ideas for using this in other scenarios welcome. More generally,
other feedback and pull requests welcome.
Subbu.