Responsive

End-to-end testing of your Kubernetes applications with Cypress

Apr 29, 2022
6 min
read
Abdallah Abedraba
Product Leader
Kusk
Manage and run end-to-end Cypress testing in Kubernetes and access Cypress recorded videos easily with Testkube!
Share on Twitter
Share on LinkedIn
Share on Reddit
Share on HackerNews
Copy URL

Table of Contents

Want to learn more about this topic? Check out our Office Hours sessions!

Get Started with Testkube Pro

## Cypress Test Runner

What is Cypress? [Cypress](https://www.cypress.io/) 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 that, for example, when a button in your UI is clicked the desired behavior is correctly executed. Cypress can then record the test execution and provide you with a video of what happened with the actual test.

Traditionally when working with Kubernetes, you would run your Cypress tests in your Continuous Integration pipeline, and if you wanted to extract the videos recorded by Cypress, you would need to set up a complicated system of saving those videos in an external storage service like S3, with all the authentication, authorization and networking setups needed just to extract the recorded videos. 

## Testkube: Solution to Cypress Testing in Kubernetes

What is Testkube? **[Testkube](https://testkube.io/), a test execution framework for Kubernetes, that solves issues by running tests from inside your Kubernetes clusters**, saving the generated videos and providing a simple way to access the videos without exposing to the public unnecessary parts of your Kubernetes cluster.

At the end of this post, you will know how to create a Cypress test, add it through Testkube to your Kubernetes cluster, execute the test and access the resulting video of your Cypress tests.

Testkube workflow explained

## Cypress Tutorial

### 1- Install Testkube

Sign up for your free [Testkube Cloud account](https://cloud.testkube.io).

### 2- Install Testkube in your cluster

-- CODE language-bash --
kubectl testkube install

### 3- Create a Cypress test

We have setup a repository with a simple Cypress test which you can find and clone [here](https://github.com/aabedraba/testkube-cypress). We will use that repository to create our Testkube tests from. 

Following the pattern of having your tests in a git repository allows you to reap the benefits of a GitOps-based testing environment.

For more GitOps-based testing environments in Testkube, check out the blog ["GitOps-Powered Kubernetes Testing Machine"](https://kubeshop.io/blog/a-gitops-powered-kubernetes-testing-machine-with-argocd-and-testkube).

Now let’s create the test. You can replace the <span style="background-color:#efecf4; font-family:Consolas,sans-serif; font-size:11pt; color:#585260; ">--git-uri</span> link to match your repository if you have cloned our example repository

-- CODE language-bash --
kubectl testkube create test --git-uri
https://github.com/aabedraba/testkube-cypress.git --git-branch main --name
cypress-example --type cypress/project

### 4- Open the Testkube dashboard

Let’s continue our walkthrough from the dashboard, although you can run all these steps from the CLI as well! 

-- CODE language-bash --
kubectl testkube dashboard

### 5- Run your Cypress test

From the dashboard, go to the *Tests* section, click on our newly created test cypress-example, and Run. 

cypress automation

Testkube will run the Cypress commands for you to trigger the tests, and… wait! It takes some minutes to run, depending on your machine. 

### 6- Check out the test result and extract the recorded video

Click on the test execution and go to *Artifacts* section where you will find the video recorded by Cypress to download!

video of executed test

And the resulting video looks like the following

Cypress test video creation

## More on End-to-End Testing

You could also [run your tests from your CI/CD pipelines](https://docs.testkube.io/articles/cicd-overview/) using the Testkube CLI or by triggering them manually. Testkube decouples your test execution from being strictly dependent on the CI/CD pipeline, allowing you to run tests both as part of your builds and for ad-hoc validation of your applications.

We support more [integration test frameworks](https://testkube.io/integrations) like [Postman](https://testkube.io/integrations/postman), [K6](https://testkube.io/integrations/k6), and many more. You can even incorporate your favorite testing tool by [creating your own Testkube executor](https://docs.testkube.io/test-types/container-executor). The Testkube team aims to include most testing tools to improve integration tests in the Kubernetes realm!

You can also make use of [Testkube webhooks](https://docs.testkube.io/articles/webhooks) to connect your test execution results to Slack or any notification service. 

Why not give it a go yourself? Sign up to Testkube and try one of our examples or head over to our documentation - if you get stuck or have questions, we’re here to help! Find an answer to your questions in the Testkube Knowledge Base or reach out to us on Slack. We’re eager to hear how you use our integrations!

Thank you!

Abdallah Abedraba
Product Leader
Kusk
Share on Twitter
Share on LinkedIn
Share on Reddit
Share on HackerNews
Copy URL
Responsive

End-to-end testing of your Kubernetes applications with Cypress

Apr 29, 2022
6 min
read
Manage and run end-to-end Cypress testing in Kubernetes and access Cypress recorded videos easily with Testkube!
Share on Twitter
Share on LinkedIn
Share on Reddit
Share on HackerNews
Copy URL

Table of Contents

Want to learn more about this topic? Check out our Office Hours sessions!

Get Started with Testkube Pro

## Cypress Test Runner

What is Cypress? [Cypress](https://www.cypress.io/) 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 that, for example, when a button in your UI is clicked the desired behavior is correctly executed. Cypress can then record the test execution and provide you with a video of what happened with the actual test.

Traditionally when working with Kubernetes, you would run your Cypress tests in your Continuous Integration pipeline, and if you wanted to extract the videos recorded by Cypress, you would need to set up a complicated system of saving those videos in an external storage service like S3, with all the authentication, authorization and networking setups needed just to extract the recorded videos. 

## Testkube: Solution to Cypress Testing in Kubernetes

What is Testkube? **[Testkube](https://testkube.io/), a test execution framework for Kubernetes, that solves issues by running tests from inside your Kubernetes clusters**, saving the generated videos and providing a simple way to access the videos without exposing to the public unnecessary parts of your Kubernetes cluster.

At the end of this post, you will know how to create a Cypress test, add it through Testkube to your Kubernetes cluster, execute the test and access the resulting video of your Cypress tests.

Testkube workflow explained

## Cypress Tutorial

### 1- Install Testkube

Sign up for your free [Testkube Cloud account](https://cloud.testkube.io).

### 2- Install Testkube in your cluster

-- CODE language-bash --
kubectl testkube install

### 3- Create a Cypress test

We have setup a repository with a simple Cypress test which you can find and clone [here](https://github.com/aabedraba/testkube-cypress). We will use that repository to create our Testkube tests from. 

Following the pattern of having your tests in a git repository allows you to reap the benefits of a GitOps-based testing environment.

For more GitOps-based testing environments in Testkube, check out the blog ["GitOps-Powered Kubernetes Testing Machine"](https://kubeshop.io/blog/a-gitops-powered-kubernetes-testing-machine-with-argocd-and-testkube).

Now let’s create the test. You can replace the <span style="background-color:#efecf4; font-family:Consolas,sans-serif; font-size:11pt; color:#585260; ">--git-uri</span> link to match your repository if you have cloned our example repository

-- CODE language-bash --
kubectl testkube create test --git-uri
https://github.com/aabedraba/testkube-cypress.git --git-branch main --name
cypress-example --type cypress/project

### 4- Open the Testkube dashboard

Let’s continue our walkthrough from the dashboard, although you can run all these steps from the CLI as well! 

-- CODE language-bash --
kubectl testkube dashboard

### 5- Run your Cypress test

From the dashboard, go to the *Tests* section, click on our newly created test cypress-example, and Run. 

cypress automation

Testkube will run the Cypress commands for you to trigger the tests, and… wait! It takes some minutes to run, depending on your machine. 

### 6- Check out the test result and extract the recorded video

Click on the test execution and go to *Artifacts* section where you will find the video recorded by Cypress to download!

video of executed test

And the resulting video looks like the following

Cypress test video creation

## More on End-to-End Testing

You could also [run your tests from your CI/CD pipelines](https://docs.testkube.io/articles/cicd-overview/) using the Testkube CLI or by triggering them manually. Testkube decouples your test execution from being strictly dependent on the CI/CD pipeline, allowing you to run tests both as part of your builds and for ad-hoc validation of your applications.

We support more [integration test frameworks](https://testkube.io/integrations) like [Postman](https://testkube.io/integrations/postman), [K6](https://testkube.io/integrations/k6), and many more. You can even incorporate your favorite testing tool by [creating your own Testkube executor](https://docs.testkube.io/test-types/container-executor). The Testkube team aims to include most testing tools to improve integration tests in the Kubernetes realm!

You can also make use of [Testkube webhooks](https://docs.testkube.io/articles/webhooks) to connect your test execution results to Slack or any notification service. 

Why not give it a go yourself? Sign up to Testkube and try one of our examples or head over to our documentation - if you get stuck or have questions, we’re here to help! Find an answer to your questions in the Testkube Knowledge Base or reach out to us on Slack. We’re eager to hear how you use our integrations!

Thank you!