How can you simply Configure Cypress on Jenkins?

How can you simply Configure Cypress on Jenkins?

Cypress has become one of the fast-growing modern test automation framework in the software industry. As you learn cypress you would probably come across the need to integrate your cypress tests with your CI environment. So let’s see how we can do using Jenkins.

Step 1: Add NodeJs plugin

As you know, we need Node.js to run cypress. So as the first step, we will install Nodejs in our Jenkins environment. In Jenkins, go to

Manage Jenkins > Manage Plugins > Available Plugins and search for NodeJS Plugin and add it.

Step 2: Add NodeJs Installation

After you successfully add the NodeJs Plugin, you need to add a NodeJs installation to it. To do that go to

Manage Jenkins > Global Tool Configuration and click Add NodeJS. Then,

  • Give a name for your NodeJS installation Eg: Node12
  • Tick the Install automatically Install automatically
  • Select a cypress compatible NodeJS version Eg: NodeJs 12.16.3
  • Add cypress for Global npm packages to install
  • You can keep the other configurations as it is

NodeJS Global Tool Config

Step 3: Create your Jenkins project

Now you need to create your Jenkins project. To keep things simple let’s create a freestyle project. In Jenkins click New Item, give a project name and select Freestyle project

I assume you have your project in git. So, In Source Code Management add your git URL and credentials for the cypress project. If you do not use git I recommend you to move to git as it’s going to help you a lot in managing your code.

Jenkins git config

Step 5: Add external dependencies (linux / CenOS)

If your Jenkins server OS is windows, you are all set. If not for Linux uses you need to add the following configurations

$ apt-get install libgtk2.0–0 libgtk-3–0 libnotify-dev libgconf-2–4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb

If you are on centOS

$ yum install -y xorg-x11-server-Xvfb gtk2-devel gtk3-devel libnotify-devel GConf2 nss libXScrnSaver alsa-lib

Find more details on, cypress CI

Step 6: Final step — BUILD !!

Now you are all set. You just need to add your cypress command to execute your script.

Jenkins build

Now you can build it by clicking Build Now

Jenkins console

Let’s talk about cross-browser testing and reporting in another article.

Thank you

#linkedin #qualityassurance #qa #sqaengineer #softwaretesting #jenkins

要查看或添加评论,请登录

MD. Abdullah Al Fahad的更多文章

社区洞察

其他会员也浏览了