Testing interfaces with Puppeteer
In this section, you'll learn how to write integration and end-to-end tests using Puppeteer and the Headless Chrome browser.
Puppeteer is a Node library to control the Chrome, Chromium, or Firefox browser over the DevTools protocol (or remote protocol for Firefox), which makes it an excellent tool for simulating real scenarios during tests.
When we launch a new browser instance, Puppeteer will default to using Chrome's headless mode. Chrome's headless mode only includes the browser engine, with no user interface. Puppeteer uses the Chrome DevTools protocol to control the browser.
With Puppeteer, we can take screenshots of the page, test responsiveness by simulating numerous mobile devices, such as tablets and smartphones, and more.
You can learn more about Puppeteer on the document page available at https://developers.google.com/web/tools/puppeteer.
We'll write an integration test and an end-to-end test to demonstrate...