Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Browse all series

Cypress and Laravel Integration

Cypress is a fantastic end-to-end testing framework. In this series, we'll learn, not just the ins and outs of Cypress, but also how it can be leveraged within a Laravel application to allow for everything from logging in, to seeding a database, to swapping environments.

Progress

Series Info

Episodes
7
Run Time
1h 28m
Difficulty
Intermediate
Last Updated
Aug 27, 2020
Version
Latest

Series Episodes

  1. Setup (2)
    1. The Basics

      Let's begin by using TDD to drive the creation of a blog posts landing page. This will give us the opportunity to review and discuss a basic workflow you can expect to follow.
  2. Examples (5)
    1. Let's Test the Laracasts Login Modal

      Often in this series, we'll use BDD to drive our applications. However, the reality is that you'll often find yourself filling in tests after the fact. With that in mind, let's work with the actual Laracasts codebase and fill in a series of end-to-end tests for the site's login modal.
    2. Command and Assertion Essentials

      Let's take a few moments to discuss the difference between commands and assertions, while also reviewing the underlying Chai assertion library that Cypress makes use of.
    3. Stubbing Network Requests with Fixtures

      A true end-to-end test will span your entire system. This means no swapping things in the container, no faking third party APIs, and no stubbing endpoints. However, once you have at least one test that hits all necessary endpoints, the remaining tests are free to swap in fake data. This way, for example, you don't need to hit Stripe's server every time you test a portion of your registration form.
    4. Testing Billable Registration

      Let's review another example using the Laracasts codebase. How would we go about testing registration that hits a third-party billing API, like Stripe?
    5. Reaching into Iframes

      Iframes can be a little tricky when using Cypress. In this episode, we'll leverage retry-ability to wait until an iframe has loaded before continuing with the necessary queries and assertions.

Continue Learning