End to end tests in WordPress using Cypress

As web sites and web applications get bigger and more complex, we end up investing more and more time to test all its features while developing or updating our production environment. These tasks may be repetitive and a bit boring, particularly if you need to test a large site, such as an online store or a big custom development. End to end (or browser based) automated tests are not something new, but sometimes they are hard to include in our development process, due to the possible need of new tools, new languages and even the infrastructure to run them, plus the extra burden of keeping your tests updated and healthy. Enter Cypress, a Javascript based tool that will help you write solid tests faster and with less code, so you can focus more time on implementing new feature on your site than maintaining your tests. Why Cypress? – Javascript based tool. You only need Node to run it, so no extra tools to worry about. – Easy to set up in common tools, like Webstorm or Visual Studio Code. – Cross platform: will run on Mac, Windows and Linux – Easy to run locally – Has out-of-the-box handling of page load, ajax loading and other things that could cause flakiness in other automated test platforms – Includes a lot of extra goodies, like screenshots, video recording and even a dashboard that you can plug into your Continuous Integration pipeline (free package available!) – Easy to plug into CI/CD vendors like CircleCI or Jenkins By using tools like Cypress, you can be confident that every code change you perform will leave your site stable and it will help you catch bugs before your client notifies you.

Speaker

Categories ,

About Chris Reynolds

I am a Senior Software Engineer on the CMS Platform team at Pantheon and have been working with WordPress since my first foray as a freelance web designer and developer specializing in 2007. I'm the author of a bunch of WordPress-centric online training courses for Pluralsight and when I'm not writing code, I run and play Dungeons & Dragons, occasionally make electronic music and cheer for Utah Royals FC.