UI Testing with Puppeteer
Write fail-safe automation tests, device emulation, and browser automation using Puppeteer’s API powered by Google
What you will learn
- Understand browser automation fundamentals
- Explore end-to-end testing with Puppeteer and its best practices
- Apply CSS Selectors and XPath expressions to web automation
- Discover how you can leverage the power of web automation as a developer
- Emulate different use cases of Puppeteer such as network speed tests and geolocation
- Get to grips with techniques and best practices for web scraping and web content generation
“UI testing with Puppeteer has everything you need to get started with UI testing. It's the book the community was waiting for”
Rodrigo Díaz Concha, Microsoft Regional Director
Full Chapter Overview
Chapter 1, Getting started with Puppeteer
Chapter 2, Automated Testing and Test runners
It covers end-to-end testing fundamentals and the difference between different types of tests. In the latter part of the chapter, we will cover creating and organizing a test project and getting started with test runners.
Chapter 3, Navigating through a website
This chapter allows you to start coding your tests. You will learn how to launch a browser, navigate to a page and make some assertions. Then you will see how to publish your tests to the cloud to be tested.
Chapter 4, Interacting with a page
It's about interaction. Once you get to a page, how do you test it? How do you simulate user interaction? This chapter takes you through the most common ways of interacting with a page. This chapter also covers some basic HTML concepts, so you can take advantage of all the tools Puppeteer provides.
Chapter 5, Waiting for elements and network calls
Learn how to wait for the different scenarios on the page you are testing—waiting for the page to load, and to be ready, waiting for a button to be enabled, waiting for an Ajax call to be completed. This chapter covers all the tools that puppeteer offers to accomplish these scenarios.
Chapter 7, Generating Content with Puppeteer
It expands the usage of Puppeteer and shows you how we can create content using Puppeteer. We’ll start by learning how screenshots are created and how they can be used for regression tests. Then we will cover PDF generation, and finally, we will learn to create pages on the fly.
Chapter 8, Environments emulation
This chapter explains all the tools Puppeteer provides to emulate different scenarios. It will show you how to emulate mobile devices, different screen resolutions, various network speeds, geolocation, and even things like vision deficiency.
Chapter 9, Scraping tools
Chapter 9 demystifies web scraping - showing how it can be implemented for good purposes. You will learn how to create scrapers and run tasks in parallel using Puppeteer Cluster
Chapter 10, Evaluating and improving the performance of a website
This last chapter shows you how puppeteer can help developers to evaluate and improve the performance of their sites. We will see how all the metrics you can see inside dev tools can be extracted and analyzed using Puppeteer. This chapter also has a great introduction to Google Lighthouse and how to automate its reports and integrate them into your test.
Who Should Read This Book?
Quality Assurance professionals
If you are a quality assurance professional looking for a better and more modern tool to do your job, this is the book for you.
Web developers who want to learn how to use Puppeteer for generating content, scraping websites, and evaluating website performance will find this book useful.