Jenkins with Cypress
You can use the NodeJS plugin as part of a Jenkins CI job. Learn how to integrate your Cypress framework with Jenkins, including the option to utilize another parameterization while triggering.
On this page:
Prerequisites
To integrate Cypress with Jenkins, make sure that:
-
The Perfecto Cypress SDK has been configured with the cloud name and security token in the
perfecto-config.json
file.For details, see the initial setup instructions for Cypress.
-
In the
package.json
file, edit, add, or modify thescripts
section according to your requirements:Copy{
"name": "cypressdemo",
"version": "1.0.0",
"description": "Perfecto Cypress Jenkins demo",
"main": "index.js",
"scripts": {
"test": "./node_modules/.bin/cypress run --config pageLoadTimeout=60000",
"cy:run": "npm run test"
},
"author": "rk@perforce.com",
license": "ISC",
"devDependencies": {
"cypress": "^7.5.0",
"perfecto-cypress-reporter": "0.0.12",
"perfecto-cypress-sdk": "0.0.52"
}
}
Step-by-step instructions
Follow the steps in this section to integrate an existing Perfecto-Cypress SDK project with Jenkins.
To integrate an existing Perfecto-Cypress SDK project with Jenkins:
-
In Jenkins, open the Plugin Manager. Then download and configure NodeJS.
-
Open the Configuration Manager and configure and point to the correct shell or bash executable.
-
Open the Global Tool Configuration and configure NodeJS to the latest version.
-
Create a new Jenkins job.
-
Add a build step, as follows. You can run trigger job configuration by using the following commands locally or in the Perfecto cloud.
-
For local triggering:
Copynpm run cy:run
-
For Perfecto configuration and triggering report generation:
Copynpx perfecto-cypress run --config=./perfecto-config.json
You can use:
-
pack
,upload
, andrun
commands to modify your CI/CD process depending on your needs. -
Command permutations and combinations to trigger test cases (scenarios/JS scrips) according to For a quick execution, perform the following steps:.
-
-
- Run the job and get the Cypress output in the console logs.
- In the Perfecto UI, open the individual report.
- Download the Cypress logs by clicking the download option .
For additional help, contact Perfecto Support.