Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
UI Testing with Puppeteer

You're reading from   UI Testing with Puppeteer Implement end-to-end testing and browser automation using JavaScript and Node.js

Arrow left icon
Product type Paperback
Published in Mar 2021
Publisher Packt
ISBN-13 9781800206786
Length 316 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Dario Kondratiuk Dario Kondratiuk
Author Profile Icon Dario Kondratiuk
Dario Kondratiuk
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Chapter 1: Getting started with Puppeteer 2. Chapter 2: Automated Testing and Test runners FREE CHAPTER 3. Chapter 3: Navigating through a website 4. Chapter 4: Interacting with a page 5. Chapter 5: Waiting for elements and network calls 6. Chapter 6: Executing and Injecting JavaScript 7. Chapter 7: Generating Content with Puppeteer 8. Chapter 8: Environments emulation 9. Chapter 9: Scraping tools 10. Chapter 10: Evaluating and Improving the Performance of a Website 11. Other Books You May Enjoy

Waiting for network calls

In Chapter 3, Navigating through a website, we talked about requests and responses. Every page navigation begins with a request to a page. The server then processes that request and sends a response. That response generally is an HTML page, which has resources declared that need to be requested. The server will process each of those requests again and send many responses.

But that's not all. Modern apps will send requests to the server based on user actions. Take Google Maps: the user moves the mouse, and the page will need to request a new picture of the map without reloading the entire page.

We don't work on the Google Maps teams, but many users have reported that the home page sometimes doesn't load the product image after login. So, we could write a test to check that it should load an image. Oh… you thought we were going to test Google Maps? Not this time, sorry.

In this case, we can use waitForResponse(urlOrPredicate, ...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime