Skip to main content
New to Testkube? Unleash the power of cloud native testing in Kubernetes with Testkube. Get Started >


Our dedicated Cypress executor allows running Cypress tests with Testkube - directly from your Git repository.

  • Default command for this executor: ./node_modules/cypress/bin/cypress
  • Default arguments for this executor command: run --reporter junit --reporter-options mochaFile=<reportFile>,toConsole=false --project <projectPath> --env <envVars>

Parameters in <> are calculated at test execution:

  • <reportFile> - path to the generated JUnit report xml file
  • <projectPath> - path to where the project was placed
  • <envVars> - list of environment variable keys and values, separated by comma

See more at "Redefining the Prebuilt Executor Command and Arguments" on the Creating Test page.

🎓What is Cypress?
  • Cypress is a framework for making end-to-end tests of your applications, mostly used for front-end testing.
  • When you run your Cypress tests, a browser is spun up so you can assert against it in an automatic way.
  • With Cypress you can, for example, check that you get the expected behaviour when a button in your UI is clicked. Cypress can then record the test execution and provide you with a video of what happened with the actual test.

Check out our blog post to follow tutorial steps for end-to-end testing of your Kubernetes applications with Cypress.

Example Cypress Project

If you haven't created the Cypress project yet, please follow the Cypress documentation for details:

In this example we will use the following Cypress project: contains three it steps:

describe("Testkube website", () => {
it("Open Testkube website", () => {
it(`Validate CYPRESS_CUSTOM_ENV ENV (${Cypress.env("CUSTOM_ENV")})`, () => {
expect("CYPRESS_CUSTOM_ENV_value").to.equal(Cypress.env("CUSTOM_ENV")); //CYPRESS_CUSTOM_ENV - "cypress" prefix - auto-loaded from global ENVs
it(`Validate NON_CYPRESS_ENV ENV (${Cypress.env("NON_CYPRESS_ENV")})`, () => {
expect("NON_CYPRESS_ENV_value").to.equal(Cypress.env("NON_CYPRESS_ENV")); //NON_CYPRESS_ENV - need to be loaded with --env parameter

The test opens the Testkube website and validates 2 methods of loading ENV variables.

Creating and Running Tests

Cypress projects consist of multiple files, so the Test can only be created using a Git Directory as the test source. The Git Directory checkouts the whole Cypress project directory from your repository.

If you prefer to use the Dashboard, just go to Tests and click the Add a new test button. Then you need to fill in the Test Name, choose the Test Type (cypress/project), and choose the Test Source (Git Directory). Then, you need to fill in the repository details - Git repository URI (in this case, branch (main), and path to the Cypress project directory in your repository (test/cypress/executor-tests/cypress-11). In this example, the repository is public, but in the case of private ones, you would need to additionally fill in the Git credentials.

Cypress test - creation dialog

When the test is created, you can run it. But, in this example, the test checks ENV variables, which aren't set yet. In order for this test to pass:

  • CYPRESS_CUSTOM_ENV ENV needs to be set to CYPRESS_CUSTOM_ENV_value.
  • NON_CYPRESS_ENV ENV needs to be set to NON_CYPRESS_ENV_value.

Setting ENV variables

In order to set ENV variables, or arguments, you need to open the test you created, and then go to Settings, and Variables & Secrets.

Cypress auto-loads ENV variables with CYPRESS_ prefix, which are available in the tests without this prefix. So, if you set CYPRESS_CUSTOM_ENV ENV, it will be available as CUSTOM_ENV. Choose Add a new variable, leave the default type (Basic), and fill in the variable name CYPRESS_CUSTOM_ENV, and its value CYPRESS_CUSTOM_ENV_value. Then, click Save.

Cypress test - setting ENV variable

Another way of setting ENVs in Cypress is by the --env argument. That's something you can also do at the Variables & Secrets settings - just go to the Arguments section. Cypress test - setting arguments

Using Non-default Cypress Images

In the Cypress world, there are instances when you want to have control over your Runtime environment. Testkube can easily handle that for you! We're building several Cypress images to handle features that different versions of Cypress can support.

To use a different executor you can use one of our pre-built ones (for Cypress 8, 9, 10 and Custom Testkube images) or build your own Docker image based on a Cypress executor.

Let's assume we need official Cypress 10 version for our test runs. To handle that issue, create a new Cypress executor:

content of cypress-v10-executor.yaml

kind: Executor
name: cypress-v10-executor
namespace: testkube
image: kubeshop/testkube-cypress-executor:1.1.7-cypress10 # <-- we're buidling cypress versions
- cypress:v10/test # <-- just create different test type with naming convention "framework:version/type"

Tip: Look for recent executor versions here:

And add it to your cluster:

kubectl apply -f cypress-v10-executor.yaml

Now, create a new test with a type which our new executor can handle e.g.: cypress:v10/test

# create test
testkube create test --git-uri --git-path examples --type cypress:v10/test --name cypress-v10-example-test --git-branch main

# and run it
testkube run test cypress-v10-example-test -f