
Cypress is a popular browser Test Automation tool and tests can be run against multiple browsers(Chrome, Firefox, Electron, Edge etc..)
When we run our tests in Local machine or in CI, the browser version could be different and also might have enabled with Auto Update. This is good but sometimes we might need a specific browser version and also have the control to choose the browser version while running our tests.
In order to have control on which cypress version and against which browser tests can be executed, Cypress provides three types of Docker images.
- Factory
- Base
- Browsers
- Included
In this article i will be covering on Included type. This docker image comes with preinstalled node.js, Cypress and Browsers.
To start clone this git repo https://github.com/gurudattgd04/cypress-example
Ensure you have docker installed in local machine and its running.
Open the cloned repo in the Visual studio code.
Below is the docker command
docker run -it -v $PWD:/cypress -w /cypress — entrypoint=cypress cypress/included:12.6.0 run — browser chrome — spec “cypress/e2e/**/*.spec.js”
let’s break down the command

Now we understand the command, we can execute this command.
As we run the command, first it downloads the image and then run the container and tests

All our tests are executed inside the container using specified cypress version and browser. We didn’t install anything on the local machine as the Included type docker image has everything needed inside it.
Also, if we need to know what all the browser installed in the image we can execute below docker command
docker run -it -v $PWD:/cypress/./ -w /cypress/./ — entrypoint=cypress cypress/included:12.6.0 info
The command displays below details in the console.
Detected 3 browsers installed:
1. Chrome
— Name: chrome
— Channel: stable
— Version: 110.0.5481.96
— Executable: google-chrome
2. Edge
— Name: edge
— Channel: stable
— Version: 110.0.1587.41
— Executable: edge
3. Firefox
— Name: firefox
— Channel: stable
— Version: 109.0
— Executable: firefox
Note: to run these browsers, pass <name>:<channel> to the ‘ — browser’ field
Examples:
– cypress run — browser edge
– cypress run — browser firefox
Learn More: https://on.cypress.io/launching-browsers
Proxy Settings: none detected
Environment Variables:
CYPRESS_CACHE_FOLDER: /root/.cache/Cypress
CYPRESS_DEFAULT_NODE_VERSION: 16.18.1
Application Data: /root/.config/cypress/cy/development
Browser Profiles: /root/.config/cypress/cy/development/browsers
Binary Caches: /root/.cache/Cypress
Cypress Version: 12.6.0 (stable)
System Platform: linux (Debian — 11.6)
System Memory: 2.08 GB free 1.38 GB
Running cypress tests within cypress image/container is easy isn’t it.
In the next article i will explain how to create custom image using cypress base and browser image.
If you like this article, please share and 👏

Leave a comment