What is an E2E Test?

In this lesson, you will explore the E2E test.

We'll cover the following

An E2E test runs the whole web app in a headless browser. The front-end application interacts with the back-end and database, and checks everything works as expected. The E2E checks everything from the user interactions (the front end) to the business data (the back end).

E2E tests are typically slow because:

  • They need a working back-end application. You can not launch an E2E test without a server. So you, as a front-end developer, depend on the back-end developers and infrastructure to work.

    The back-end can:
    • Be launched alongside the front-end application. A mirror of the back-end runs typically in a docker container and you seed the empty database with data needed to replicate various scenarios.

    • Exist externally from the container where the tests are run. While the data can already exist in the database, they must be cleaned before every test, as the tests require the same data to be consistently effective.

  • They depend on the resources leveraged by the back-end. Although, it is common to have limited back-end resources for the non-production environment.

  • They depend on the network. Everything that could affect the network is going to affect the tests too.

  • The tests must be deterministic because they require a lot of reliable and same data as discussed in testing rules.

An important note: the front-end application is not deployed in advance and then tested. Instead, it needs to be built on the fly, launched (usually with Docker) and then, if the tests pass, the new front-end app will be deployed. That’s how the CI/CDA CI/CD pipeline is a series of steps that must be performed in order to deliver a new version of the software. pipelines work.

What flows should be tested in/with E2E?

  • The Happy Path flows: The users must be able to complete basic operations.

  • Everything valuable for your business: Happy Path or not, test whatever your business prioritizes.

  • Everything that breaks often: weak areas of the system must be checked too.

In the next examples, we are going to write some E2E tests to learn why they are not feasible as the only/main test type. E2E tests are important because they can test both the front-end and the back-end, but they must be used carefully to avoid fragile and hour-long test suites.

Get hands-on with 1200+ tech skills courses.