HerokuJulián DuqueTutorial
Testing a React App in Chrome with Heroku CI
Summary
The article presents a walkthrough for automating end-to-end browser tests for a React application in Heroku CI rather than relying on manual local testing. The sample app uses Jest and Puppeteer to check navigation to Puppeteer Documentation, retention of text entered into a form, and the greeting shown after submission, with headless Chrome supplied by the Chrome for Testing Heroku Buildpack. Local execution initially exposes a mismatch between the expected and received greeting, then passes after the application is fixed; a streamlined command starts the server and runs the suite. Heroku CI is configured with an app.json file containing Chrome for Testing and Node.js buildpacks, plus a test script that runs start-server-and-test and the Jest/Puppeteer tests. Pushes to the connected GitHub repository trigger the suite.
Context
Manual browser testing can be helpful locally but is described as inefficient and unreliable as an application becomes more complex. The goal is to automate end-to-end checks of the user experience and integrate them into a CI pipeline so code changes receive immediate test feedback.
Approach / What changed
The walkthrough uses Jest and Puppeteer with headless Chrome to test a React app’s link navigation, text input, and form submission. Heroku CI is configured through app.json with the Chrome for Testing and Node.js buildpacks, and its test command runs start-server-and-test followed by the Jest/Puppeteer suite.
Takeaways
Puppeteer tests verify external-link navigation, retained input values, and the greeting rendered after form submission.
The local suite first fails because the expected greeting differs from the received text, then passes after the application is fixed.
Heroku CI installs Chrome through the Chrome for Testing buildpack and runs the React end-to-end suite when changes are pushed to the connected GitHub repository.
Source and freshness
- Source
- heroku.com
- Published
- Added to Yomu
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.