Back to results for “Testing with Jasmine & Karma”
Angular › End to End Testing with Cypress & Playwright

What is end to end testing and how is it different from the unit tests Angular sets up by default?

Beginner

Answer

End to end testing runs your actual app in a real browser and simulates a real user's actions, like clicking buttons and filling out forms, checking that entire flows work correctly from start to finish. Unit tests, which Angular sets up by default using Jasmine and Karma, instead check small, isolated pieces of code in complete isolation.
// A simplified Cypress end to end test
cy.visit('/login');
cy.get('input[name=email]').type('user@example.com');
cy.get('button[type=submit]').click();
cy.url().should('include', '/dashboard');
Real-world example A team writes an end to end test simulating a customer logging in and reaching their dashboard, catching a real bug where a recent change accidentally broke the redirect after a successful login, something a smaller unit test would not have caught.

Common follow-ups: Why do end to end tests usually run slower than unit tests?;How many end to end tests should a typical project have compared to unit tests?