At LexBlog, my team is responsible for keeping a lot of sites up and running. We help manage the reputation of lawyers and law firms, where each pixel matters. As a result, our product team performs a host of functional tests before launching updates, and we lean on test driven development practices to catch things that functional tests cannot.
An unfortunate blind spot is that humans aren’t machines. We’re prone to miss simple things, and after staring at a screen for hours on end, our brains and eyes get tired. To help catch things that we may gloss over, we use an internal application built using Node.js, React, and Selenium that integrates with the WordPress REST API and an external service, Applitools.
As an aside, I cannot recommend Applitools enough. If you need to perform a lot of in-browser tests and want to offload the heavy lifting of visual regression testing to another service, Applitools is fantastic. There are a host of other tools out there, but Applitools is our go-to at LexBlog.
Back to the application!
Prior to working on this, our team was responsible for visual regression testing using a series of command line scripts and CSVs. While the scripts functioned, setting up a computer to get running required a lot of dependency management steps. Complicating matters, each test relied on CSV files to know what websites were included in the scope of testing. This meant that each time someone wanted to perform a test on an update they were responsible for, they had to use a separate tool to determine what sites would be impacted, get those URLs, and save them to a CSV. There were tools to speed this process up, but any fat in your testing/deploying process is a slippery slope toward never deploying.
It became obvious to everyone on the team that we needed better tools if we were going to make updates to our codebase on a consistent basis. There were three primary issues:
- The current automated testing suite was written in Python (I’m the only one on the team with Python experience)
- The scripts had to be run in the command line and new team members had to manually install dependencies
- The CSVs that determined what URLs the test suite would visit were manually generated and often required writing another script just to know what sites to test
We managed to address each of these issues by building a small application that:
- Used the WordPress REST API to provide us with data about a site to see if it needed to be tested based on the update we were performing
Overall, a pretty fun project that owes a lot to Applitools, the WordPress REST API team, LexBlog’s own Dylan Moberg for most of the React/Node work, and Dave Haeffner (whose work on Selenium documentation and guides made a lot of my work possible).