DEV Community

Milan Nicic
Milan Nicic

Posted on

Cypress-Qase integration

As I introduced myself in previous blogs, I will skip that part in this one. As you already saw in the title, theme for this blog will be connecting Cypress to test management tool called Qase. So that on run in Cypress, we create a test run in Qase too!

I will do it from freshly installed cypress project. After installing Cypress, we need to install dependencies cypress-multi-reporters and cypress-qase-reporter.

Now we are ready to add the configuration in order to be able to create test runs in Qase too! In cypress.config.js we need to configuration for cypress-multi-reporters that we installed and for cypress-qase-reporter. Really important part here on the photo below is cypressQaseReporterReporterOptions because you need to setup your API token which you generate in your QASE account, you need to put your projectCode which you can see in the QASE too, basePath is always the same and rootSuiteTitle is in which suite your test cases are located.
Configuration

So when we setup all this, we are ready to assign values to variables QASE_REPORT to equal 1 and QASE_RUN_NAME to equal whatever we want. In this case I am using Windows and I will do it in Cypress CLI as on photo below
Setting variables
In this example test run will be created in Qase app with the name Cypress-automation-run

So the configuration is done, now we need to go to spec file in Cypress and import qase function as on photo below
import qase into specs
Then in our test we call it like this
calling qase in test
So the test case with the ID-1 in QASE will be displayed in the Test run when cypress finishes the run, cases that don't have ID in Qase will be created under root rootSuiteTitle > describe section in test > test cases created here
Created run
Useful links:
https://app.qase.io/user/api/token
https://github.com/qase-tms/qase-javascript/tree/master/qase-cypress

Top comments (5)

Collapse
 
matheusfonsecamagazord profile image
Matheus-Fonseca

Hello, No matter what I do, I set everything up correctly and it keeps giving me an error.

Image description

Image description

What am i doing wrong ? i've checked the API token and the project ID

Collapse
 
milan_nicic profile image
Milan Nicic

Hello, I can't really tell your POV, but I can see in the terminal error "$env:QUASE_REPORT=1" it should be $env:QASE_REPORT=1 and I am not sure that your "npm run test" is set correctly too, so try to fix that part and maybe run tests with npx cypress run if your script doesn't run tests at all.

Collapse
 
matheusfonsecamagazord profile image
Matheus-Fonseca

you are right, i did it, but i need to use the specific road to the archive to run the test, it works but don't release to QASE the test, didn't send anything to QASE.

Image description

Thread Thread
 
matheusfonsecamagazord profile image
Matheus-Fonseca

and when i set this test to $env:QASE_REPORT=1 and press npx cypress run, he run all the archives and not only this exclusive

Image description

Thread Thread
 
milan_nicic profile image
Milan Nicic

From what I see here

Image description
Its recognizing your qase test cases and your PID, so it should create a run there, check it there, if you have already 2 of them created, you need to delete them before creating another one for FREE version of QASE