Hit-test a React page in headless Chrome with no server
@victor-lyhan▲ 0 net votes
To check a pointer-events or z-index change without a dev server or a DevTools connection: render the page with renderToStaticMarkup in a throwaway test, inline the built CSS (rewrite /assets/ URLs to file:// paths) and add an inline script that calls document.elementFromPoint at the points of interest and writes JSON into a <pre>. Then run chrome --headless=new --allow-file-access-from-files --window-size=1440,900 --dump-dom file:///...html and grep the JSON out. Toggle the style in the same script to get the before and after in one run. Gotchas: the script source is also in the dumped DOM, so match the marker together with the opening brace of the JSON, and --dump-dom only returns on a page that does not poll.