Next-Gen App & Browser Testing Cloud
Trusted by 2 Mn+ QAs & Devs to accelerate their release cycles

In this step-by-step Cypress tutorial, you will learn how to perform E2E testing using Cypress CLI and Test Runner.

Kailash Pathak
January 13, 2026
End-to-End (E2E) testing is a software testing methodology that focuses on testing an application’s workflow from start to finish, simulating real user interactions, and verifying that all components of the system work together correctly.
To illustrate E2E testing, let’s consider a live scenario involving an eCommerce website. The goal is to test the entire purchasing process, from when a user adds items to the shopping cart until the order is successfully placed. We usually follow the below approach.
By performing E2E testing in a live scenario like this, you can gain confidence in the reliability and functionality of the eCommerce website’s purchasing process.
Running E2E tests using Cypress CLI helps you configure test runs, generate reports, and integrate with other tools and services to streamline your testing process. It provides a command-line interface to manage and execute E2E tests efficiently. The Cypress CLI provides a comprehensive set of commands and features that empower developers and testers to perform robust and efficient E2E testing.
The other way to run E2E tests is using Cypress Test Runner, which provides an interactive graphical interface that allows developers and testers to run their tests, monitor their progress, and analyze the results in real-time. When using the Cypress Test Runner, you can select specific test files or test suites to execute and then observe the test execution step by step.
You will learn more about different ways of running tests in Cypress, i.e., using Cypress CLI and Test Runner in the later sections of this Cypress tutorial.
What is E2E Testing?
End-to-End (E2E) Testing validates the entire workflow of an application by testing user interactions from start to finish, ensuring all components function correctly together.
Why Cypress for End-to-End Testing?
Cypress offers a fast, reliable, and developer-friendly framework for E2E testing. It runs directly in the browser, providing real-time reloading, automatic waits, and powerful debugging tools.
What is the Cypress CLI (Command Line Interface)?
The Cypress CLI provides a powerful way to execute and control tests directly from the terminal, making it essential for automation workflows and continuous integration environments.
What is the Cypress Test Runner?
The Cypress Test Runner is an interactive environment that allows you to execute, debug, and visually inspect tests in real time. It offers live reloading, detailed command logs, and clear visibility into application behavior during each test run.
End-to-End (E2E) testing is a software testing strategy that focuses on verifying the complete flow of an application from start to finish. It aims to ensure that all system components, including user interfaces, APIs, databases, and integrations, work together properly and meet the desired functionality.
It is often performed after unit testing and integration testing, which test individual components and their interactions, respectively. By conducting E2E testing, the entire system is evaluated as a whole, simulating real-world user scenarios and ensuring that the application behaves as expected in a production-like environment.
The primary goal of E2E testing is to validate the application’s functionality, reliability, and performance from end to end. It helps uncover any defects or issues arising from the interactions between different components. By thoroughly testing the application’s complete flow, E2E testing provides confidence that the system works as intended and meets the requirements of the end-users or business.
Let’s take an example of a simple E2E test scenario where you login into TestMu AI’s eCommerce Playground with valid credentials. After login subscribe to the newsletter and verify whether the subscription was successful.

Note: Run Cypress tests across 40+ browser versions on cloud. Try TestMu AI Today!
E2E testing is a type of software testing that verifies the entire application from start to finish. This means that E2E tests simulate real user interactions with the application, ensuring that all of the application’s features work together as expected. Cypress is the best fit for E2E testing for several reasons:
To understand Cypress E2E testing, let’s take a closer look at the test automation pyramid. We routinely do each level of testing listed in this pyramid while performing Cypress testing.
Subscribe to the TestMu AI YouTube Channel to get the latest updates on tutorials around Selenium testing, Cypress e2e testing, Appium, and more.
Cypress team introduced component testing with Cypress 10 that allows developers to test individual components quickly, regardless of their complexity. Component tests differ from E2E tests in that instead of visiting a URL to pull up an entire app; a component can be “mounted” and tested on its own.
In the context of Cypress, here’s how the testing pyramid can be applied:

Unit Tests
These tests focus on testing individual components or functions in isolation. In Cypress, you can use frameworks like Mocha or Jest to write unit tests for your JavaScript functions.
These tests are typically executed quickly and frequently, ensuring that each component of your application works as expected.
Component Tests
These tests verify the behavior of individual components or UI elements in your application. In Cypress, you can write component tests that interact with specific UI elements and verify their functionality.
These tests ensure that each component functions correctly within the application’s context.
Integration Tests
Integration tests focus on testing the interactions between different components or modules in your application. In Cypress, you can write integration tests that simulate user interactions and verify the integration of various components.
These tests ensure that the different parts of your application work together seamlessly.
End-to-End (E2E) Tests
These tests span the entirety of the application’s process, validating its behavior holistically. Within Cypress, E2E tests can be authored to replicate user actions, engage with the UI, and authenticate anticipated results.
Although these tests often demand more time for execution, they deliver a sense of assurance in the comprehensive functionality of your application.
To know more about component testing, let’s see the difference between end-to-end testing and component testing
End-to-end testing and component testing are two different levels of testing in the Software Development Life Cycle. Here are the key differences between them:
| Parameters | End-to-End Testing | Component Testing |
|---|---|---|
| Scope | End-to-end testing focuses on testing the entire system or application from end to end, including all integrated components and subsystems. It ensures that all the components work together correctly and that the system behaves as expected from a user’s perspective. | Component testing, on the other hand, concentrates on testing individual components or units in isolation, verifying their functionality, and ensuring that they work as intended. |
| Levels of integration | End-to-end testing involves testing the interactions and integration between different components, subsystems, and external systems. It covers the flow of data and controls across the entire system. | Component testing, on the other hand, is concerned with testing the functionality and behavior of individual components in isolation without considering their interactions with other components or subsystems. |
| Test environment | End-to-end testing often requires a complete or near-complete system setup, including all required components, databases, servers, and external services. It aims to replicate the production environment as closely as possible. | Component testing, on the other hand, can be performed in isolation, often using a test environment that simulates or mocks other components or dependencies. |
| Test Speed and Complexity | End-to-end tests can be slower to execute since they cover a broader scope and may involve waiting for various interactions and elements to load and respond. | Component tests are generally faster and less complex because they deal with smaller units of code and avoid interactions with external dependencies, which reduces test setup time. |
Here is an example of Cypress E2E test scenario:
Test Scenario
Implementation
In the following scenario, we will navigate to the website and perform searches using both valid and invalid data.
describe('Search with valid and Invalid data' , () => {
beforeEach(() => {
cy.visit('https://ecommerce-playground.lambdatest.io/index.php?route=account/login')
})
it('Searches for the valid text "Apple" and verify the results', () => {
// Enter the search data and submit the form
cy.get('[name="search"]').eq(0).type('Apple')
cy.get('.type-text').click()
// Verify the search results
cy.url().should('include', 'search=Apple')
cy.contains('Search - Apple').should('be.visible')
cy.get('.product-layout').should('have.length.gt', 0)
})
it('Displays message with no search results for invalid search term', () => {
// Enter search term and verify returns no results and submit form
cy.get('[name="search"]').eq(0).type('xyz')
cy.get('.type-text').click()
// Verify message for no search results
cy.contains('There is no product that matches the search criteria.').should('be.visible')
})
})

Let’s execute the test cases in Searchwith_validAndinvalid_data.cy.js.
Execution

CLI stands for Command-Line Interface. It is a text-based interface used to interact with a computer operating system or software by typing commands instead of using a graphical user interface (GUI).
Typically, CLI commands consist of a command followed by optional parameters or arguments. The user enters the command, and the system responds with the requested action or provides feedback on the command’s execution. CLI is popular among developers and system administrators due to its efficiency, flexibility, and ability to automate tasks through scripts or batch files.
Some well-known examples of CLI interfaces include the Windows Command Prompt (cmd.exe), PowerShell (for Windows), the Unix/Linux shell (such as Bash), and the macOS Terminal (based on the Unix shell).
The Cypress CLI provides a set of commands that enable developers and testers to interact with the WebElements and control the Cypress testing framework from the command line. It allows you to initialize new Cypress projects, run tests, open the Cypress Test Runner, and perform various other testing-related tasks.
With the Cypress CLI, you can perform various tasks, including:
Here are some common commands we can run using Cypress CLI:
| Cypress CLI Commands | Description |
|---|---|
| cypress open | Launches the Cypress Test Runner, which provides a graphical interface for running and interacting with Cypress tests. |
| cypress run | Executes Cypress tests in headless mode, without the graphical interface. This command is useful for running tests in a continuous integration (CI) environment or as part of an automated testing pipeline. |
| cypress install | Installs the necessary dependencies and sets up Cypress for a project. It ensures that the required binaries are downloaded and configured correctly. |
| cypress init | Initializes a new Cypress project by creating the necessary files and directories. |
| cypress version | Displays the current version of Cypress CLI and the installed Cypress package. |
| cypress help | Provides help documentation and information about available commands and options. |
| cypress run –headed | By default, test cases run headless by passing –headed will force the browser to be shown. |
| cypress run –record –parallel | Run recorded test cases across multiple machines. |
| cypress run –browser chrome | The “browser” argument is used to run the test cases in a particular browser. |
| cypress run –spec ‘cypress/e2e/examples/actions.cy.js’ | To run the particular .spec file. |
| cypress run –config pageLoadTimeout=10000 | The values mentioned here will override the value set in the configuration file. |
| cypress run –group admin-tests –spec ‘cypress/e2e/admin/**/*’ | Command will run all of the Cypress tests in the cypress/e2e/admin directory and its subdirectories. The –group flag specifies the name of the group to which the tests belong. |
Cypress also comes with a built-in Test Runner GUI that provides an interactive interface for running and debugging tests. To launch the Test Runner, you can use the Cypress open command. This opens a Test Runner window where you can select and run individual tests, view test results, and debug your code.
The Cypress Test Runner operates directly in the browser and runs tests within it, enabling real-time visibility into the application under test. It offers a built-in time-traveling feature that allows developers to inspect and debug the application’s state at any point during the test execution. This makes it easier to troubleshoot and identify the causes of test failures.
Some key features of Cypress Test Runner include:
Below is the screenshot of Cypress Runner, which opens when the user runs the command ‘yarn cypress open’.

Note: Run Cypress tests in parallel and reduce developer feedback. Try TestMu AI Today!
When it comes to running Cypress test cases, there are different approaches you can take depending on your specific requirements and testing environment.
Here we will be discussing how you can run Cypress test cases using:
The Cypress CLI provides a straightforward way to run Cypress automation from the command line. You can use the cypress run command to run your tests in headless mode or cypress open to run them in interactive mode. The Cypress CLI also offers various options and flags to customize the test run, such as specifying specific test files, setting environment variables, and generating test reports.
Now let’s take some examples to execute the test cases in Cypress CLI.
Test Scenario
Implementation
Let’s create a new folder under the e2e folder named “demoCypressCLIRunner” to perform Cypress UI testing.
Create the first test spec to check the login feature for the site with the name subscriptionScenario..cy.js under the folder ‘demoCypressCLIRunner’.
For demo purposes, we are using the TestMu AI eCommerce Playground site.
Use Case
Login into the application and update the newsletter subscription.
describe('Login and Subscribe', () => {
it('Logs in and subscribes to newsletter', () => {
// Visit the web site
cy.visit('https://ecommerce-playground.lambdatest.io/index.php?route=account/login')
// Click on login button
cy.get('[value="Login"]').click()
// Enter the valid email and password
cy.get('#input-email').type('[email protected]')
cy.get('#input-password').type('Lambda123')
// Click on login button
cy.get('[value="Login"]').click()
// Verify user logged in successfully
cy.url().should('include', 'index.php?route=account/account')
cy.contains('My Account').should('be.visible')
// Subscribe the newsletter
cy.contains('Newsletter').click()
cy.get('#input-newsletter-yes').click({force:true})
cy.get('[value="Continue"]').click()
// Verify the subscription success message
cy.get('.alert-success').should('contain', 'Success: Your newsletter subscription has been successfully updated!')
})
})
There are different ways to run the Cypress test cases in CLI.
Command 1:
Run all Cypress tests using Cypress CLI in the Electron default headless browser.

Output
All the tests are in headless mode in the default browser Electron. The Cypress command ran successfully, and our tests got executed.
Now, let’s understand some important aspects of this execution marked by the numbered tickets:


Command 2:
Run the particular test in headless mode in the default browser Electron.
To run specific spec files from the list of test cases under the e2e folder, we can mention the path using “–spec” along with the “cypress run” command.


Output
In the output, we can see the test case execution report of a particular .spec.
Command 3:
Run all the tests in Cypress CLI to run tests in Chrome (Headless Mode).

Output
In the output, we can see the test case execution report of all test cases in the Chrome browser.

Command 4:
Run a particular test case in Cypress CLI to run tests in (Headless Mode).

Output
In the output, we can see the test case execution report of a particular .spec in the Chrome browser.

Let’s take one more scenario.
Test Scenario
Implementation
Create the second test case with the name “Searchwith_validAndinvalid_data.cy.js” under the TestMu AI folder.
In the below test case, we are covering the search with valid and invalid data and verifying the search result.
Use Case
Open the site and search with valid and invalid data.
describe('Search with valid and Invalid data' , () => {
beforeEach(() => {
cy.visit('https://ecommerce-playground.lambdatest.io/index.php?route=account/login')
})
it('Searches for the valid text "Apple" and verify the results', () => {
// Enter the search data and submit the form
cy.get('[name="search"]').eq(0).type('Apple')
cy.get('.type-text').click()
// Verify the search results
cy.url().should('include', 'search=Apple')
cy.contains('Search - Apple').should('be.visible')
cy.get('.product-layout').should('have.length.gt', 0)
})
it('Displays message with no search results for invalid search term', () => {
// Enter search term and verify returns no results and submit form
cy.get('[name="search"]').eq(0).type('xyz')
cy.get('.type-text').click()
// Verify message for no search results
cy.contains('There is no product that matches the search criteria.').should('be.visible')
})
})
Command 1:
Run all the tests in Cypress CLI in default browser Electron (Headless Mode).
yarn cypress run
Output

Command 2:
Run a particular test in Cypress CLI to run tests in Chrome (Headless Mode).
yarn cypress run --spec cypress/e2e/demoCypressCLIRunner/Searchwith_validAndinvalid_data.cy.js
Chrome
Output

Command 3:
Run all test cases in Cypress CLI to run tests in Chrome (Headless Mode).
yarn cypress run --headless --browser chrome
Output

Command 4:
Run particular test in headless mode in Chrome browser.
yarn cypress run --spec cypress/e2e/demoCypressCLIRunner/Searchwith_validAndinvalid_data.cy.js
Chrome
Output

Cypress Test Runner provides a user interface (UI) that allows you to interact with and run your Cypress tests. After executing the appropriate command to start the Test Runner, the UI will be launched. From there, you have several options for running your tests.
By default, Cypress will launch the Test Runner UI with its default browser, which is typically Electron. However, you can switch to a different browser by selecting it from the available options in the browser drop-down menu.
To run a single test, just enter the particular .spec name and execute the test case.

Another way to run a single test is to click on a specific test case, and it will start executing.

If you want to run the test case, run the command ‘yarn cypress open’, which will open the Cypress Test Runner from where you can execute the test cases.
Execution
Let’s execute both test cases Searchwith_validAndinvalid_data.cy.js and subscriptionScenario.cy.js in non headless mode using UI by passing –ui in command.


You can also leverage the potential of Cypress E2E testing on the cloud and run Cypress test cases over real browsers and OS combinations. AI-powered test orchestration and execution platforms like TestMu AI offer a scalable Cypress cloud to perform automation testing across 40+ real desktop browsers.
To get started, check out the documentation: Getting Started With Cypress Testing.
Ready to elevate your Cypress automation skills? Join our specialized Cypress 101 certification program tailored for developers and testers seeking to expand their proficiency in Cypress test automation. Gain advanced insights, hone your abilities, and unlock a world of opportunities on your journey in test automation.
Note: Now you can perform online cross browser testing on macOS Browsers online to make sure your websites and web apps are compatible with all versions.
With Cypress CLI, you can run tests from the command line, which helps integrate tests into your CI/CD pipelines or run them in headless environments.
On the other hand, Cypress Test Runner offers a range of features that enhance the testing experience. It provides a real-time view of your application as tests run, allowing you to see each step executed and the application’s response. This helps in debugging and understanding the test flow.
Did you find this page helpful?
More Related Hubs
TestMu AI forEnterprise
Get access to solutions built on Enterprise
grade security, privacy, & compliance