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
End-to-End Web Testing with Cypress

You're reading from   End-to-End Web Testing with Cypress Explore techniques for automated frontend web testing with Cypress and JavaScript

Arrow left icon
Product type Paperback
Published in Jan 2021
Publisher Packt
ISBN-13 9781839213854
Length 240 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Waweru Mwaura Waweru Mwaura
Author Profile Icon Waweru Mwaura
Waweru Mwaura
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. Section 1: Cypress as an End-to-End Testing Solution for Frontend Applications
2. Chapter 1: Installing and Setting Up Cypress FREE CHAPTER 3. Chapter 2: Differences between Selenium WebDriver and Cypress 4. Chapter 3: Working with Cypress Command-Line Tools 5. Chapter 4: Writing Your First Test 6. Chapter 5: Debugging Cypress Tests 7. Section 2: Automated Tests with the TDD Approach
8. Chapter 6: Writing Cypress Tests Using the TDD approach 9. Chapter 7: Understanding Element Interaction in Cypress 10. Chapter 8: Understanding Variables and Aliases in Cypress 11. Chapter 9: Advanced Uses of Cypress Test Runner 12. Section 3: Automated Testing for Your Web Application
13. Chapter 10: Exercise – Navigation and Network Requests 14. Chapter 11: Exercise – Stubbing and Spying XHR Requests 15. Chapter 12: Visual Testing in Cypress 16. Other Books You May Enjoy

What this book covers

Chapter 1, Installing and Setting Up Cypress, takes you through the essentials of getting started with Cypress, including the installation of the Cypress package, the default configurations, and the customization of settings. In this chapter, you will learn about how Cypress works, what modules it requires to run, the test file naming recommendations, and how to get started with using Cypress. Understanding how Cypress works will ensure that you are able to grasp the internal workings of Cypress and will be able to install and set up the subsequent projects on your own with a full understanding of the Cypress framework's structure.

Chapter 2, Differences between Selenium WebDriver and Cypress, is where we will explore how Cypress is different from the Selenium WebDriver and highlight some of the pros and the cons of choosing Cypress to run end-to-end tests. In this chapter, we will also explore elements that make Cypress more suitable to testing than Selenium and how users can extend its functionality.

Chapter 3, Working with Cypress Command-Line Tools, exposes you to the different Cypress commands that you can use to execute Cypress commands. The chapter will explain how to run the commands and also how to debug the application using Cypress commands.

Chapter 4, Writing Your First Test, will see you write your first test using Cypress. We will start with a passing test to check that everything works correctly, then move on to a failing test, and then we'll see how Cypress behaves and how the auto-reload feature works. In the second section of this chapter, we will focus on more advanced scenarios of getting you up to speed with how to properly write Cypress tests.

Chapter 5, Debugging Cypress Tests, dives into the different kinds of tools that Cypress includes to aid in debugging applications. Using Cypress' debugging tools, you will learn how to travel back to the snapshot of each command, see different page events that happened during execution, and visualize different commands and the times when elements were hidden and found. You will also learn how you can step forward and backward between command snapshots and pause and step through command snapshots in an iterative manner.

Chapter 6, Writing Cypress Tests Using TDD Approach, introduces you to Test-Driven Development (TDD) concepts and how you can apply them to writing Cypress tests. You will learn how to write tests using a TDD approach and also dive deep into how you can practically apply TDD in an application that is yet to be developed.

Chapter 7, Understanding Element Interaction in Cypress, covers how to interact with various elements of the DOM. The chapter will also teach you how to interact with animations, how to hover over elements, and how to check whether elements are disabled. By the end of this chapter, you will be comfortable with navigating through the DOM elements and writing meaningful tests for elements. 

Chapter 8, Understanding Variables and Aliases in Cypress, explores how to deal with asynchronous commands through the use of aliases. We will also identify ways in which we can simplify our tests by using aliases. Finally, we will identify how to use aliases with routes and requests.

Chapter 9, Advanced Uses of Cypress Test Runner, looks at how to utilize the Cypress test runner to write better tests. Our focus will be on the instrument panel and the selector playground. We will learn how to use the instrument panel to understand the concepts of spying and stubbing and how Cypress interprets them.

Chapter 10, Exercise – Navigation and Network Requests, exposes you to practical examples and exercises aimed at practicing how to use and make navigation of network requests. The exercise will also combine concepts such as aliasing and use of variables to ensure that you are able to chain the different concepts learned about in the second section of the book.

Chapter 11, Exercise – Stubbing and Spying XHR Requests, looks at understanding what XHR requests are and how Cypress can assist in stubbing requests that take too long or that are complicated to receive responses from. Cypress stubbing will be important to ensuring that implemented tests are not flaky and that we can have custom responses instead of waiting for server responses from a request.

Chapter 12, Visual Testing in Cypress, covers how visual testing works in Cypress. We will explore what visual testing is, different types of testing, and how critical visual testing is to the modern web. We will also look at viewports and how they influence the process of visual testing and finally look at visual testing automated tools such as Applitools and Percy that we can use to carry out visual validation.

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 $19.99/month. Cancel anytime