One of my least favorite tasks at work is testing new production servers. The team that provisions them doesn’t use any automated tools and manually sets up each one by hand. Unfortunately, this usually leads to missed settings and configurations, so we have to manually test several of our important systems on each server before signing off on them.
While I was working on it this time, I started thinking about ways that I could automate the process on our end. It basically is just browsing to a specific list of web pages we maintain on multiple servers and verifying everything looks the same on our current in-use production servers. Thinking about it, it sounded awfully similar to visual regression testing.
So I wrote up a quick node.js program that takes an array of servers to compare, an array of pages you want to compare, and the server you want to compare against. First, it generated screenshots for each page on the “baseline” server. Then, it generates a screenshot of each page on every other server and compares them to the baseline using the Pixelmatch library. If it finds more than 10 pixels of difference in the screenshot, it will report out to the console and generate a “Diff” screenshot that highlights the differences.
Here is what it looks like when searching for “tea” on both google.com and google.de.
For GVSU, I can now use this to verify all the servers in a few seconds instead of a few minutes. I can check our homepage, pages from the cms we manage, and some custom pages I created just for this. For example, there often are issues with a charting library we use, so I created a page that is just a static chart that I can now hit with the automated tool to verify they are working.
I spent last week outside Washington D.C. at php[world] 2019. It was the first PHP specific conference I have been to and it was great. I attended the whole day workshop on testing in PHP and learned a ton. If you get a chance to attend one of Steve Grunwell’s presentations it’s definitely worth your time. He mentioned he will be presenting a similar talk at WordCamp US later this week. If you are attending, be sure to check it out: https://2019.us.wordcamp.org/session/confidently-testing-wordpress/.
The next two days were the standard hour-long presentations on various topics. Some of my favorites:
(Note: I will add links to the videos when they become publicly available.)
It is also the 25th anniversary of PHP as a language and there was a lot of talk about why and how PHP got where it is. There was a shared proudness that PHP came about not as a well-planned exercise in computer science. Instead, it was as a community of people just trying to get things done. That is why you will find things like mismatched naming conventions and duplicated functionality. While PHP gets complaints about those things today, it also is the defining reason it is so popular. It was a really interesting perspective on the evolution of a programming language over time.
I do have to say that the area where I stayed was a bit disappointing. Just a lot of chain restaurants and not much to do nearby. Having said that, I stopped by the Steven F. Udvar-Hazy Center by the airport before I flew out and it was amazing! I had never heard of it before, but it is a hangar by the Dulles airport that is part of the National Air and Space Museum. I left myself an hour and wish I had more time there. It was huge, there were over 200 planes including an SR-71 Blackbird and a Concorde. Oh yeah, and you could walk right up to the Discovery shuttle! (See header image) It was free and definitely worth your time if you are nearby.
Overall, it was a really good conference. I also learned that there is a similar conference in February called SunshinePHP held in Florida. As one of the Michiganders looking outside my window today and seeing the first snowfall, I kind of wish I had chosen that one instead…
It’s Homecoming at GVSU this weekend and the theme is “Where’s Louie” (Louie is our mascot). A while back a few of us talked about creating a game to promote it, and it’s out!
I’ve helped with some similar projects, but this was the first one where I have done the vast majority of the programming. It was a fun challenge! The biggest issues were rendering tens of thousands of randomly generated sprites quickly, and also adding “lava” to the maps via SVG paths so that characters wouldn’t appear in odd places. (Get it? Don’t touch the lava!)
I just finished up a bit of a fun site at work: https://www.gvsu.edu/destination. It’s the first time GVSU has built a dedicated web version of this report. Since a lot of the work I have been doing lately has been heavily into back-end application development, it was nice to get a break and make something where I could focus more on the design.
I also got to create an interactive React component to look up major-specific data about degrees. This was cool both because it makes it easier for students and potential students to see what they can do with a degree, and I also got to use Victory Charts, a React graphing library I had been wanting to play with. It turned out pretty nice, easy to use and make accessible:
It proved a little tricky to integrate into the rest of the site. Mostly because I set it up using create-react-app and really didn’t want to eject it out of that. I ended up creating it as a sort of sub-project whose base HTML file then gets included in the larger project via the back end language. It worked really well, I would definitely use this method if you come across a similar situation.
Well, maybe that’s a stretch, but I was listed as one of the contributors to WordPress 5.0 in the official release post. It has been really fun to be able to contribute to Gutenberg lately. Even though I only made one or two small contributions, it’s exciting thinking about the sheer number of people who will be using the code I wrote. It’s also fun to think about the fact that 450+ other people worked together to make it happen. Most of them probably just like me, contributing purely because they are able to.
Hopefully, I can keep setting aside some time to work on it. Both because it’s fun and because it’s really helped me learn a lot. I think one thing that people don’t talk about enough when discussing open source is how much it helps you grow as a developer. I’ve learned a lot of things I wouldn’t have in my normal day-to-day work, most of which has helped me get better at my real job.