cypress-qase-reporter
v3.1.0
Published
Qase Cypress Reporter
Readme
Qase TMS Cypress reporter
Publish results simple and easy.
Installation
To install the latest release version, run:
npm install -D cypress-qase-reporterUpdating from v2.3.x to v3.0.x
To update an existing test project using Qase reporter from version 2.3.x to version 3.0.x, run the following steps:
Update reporter configuration in
cypress.config.jsfile.+ import { afterSpecHook } from 'cypress-qase-reporter/hooks'; ... reporter: 'cypress-multi-reporters', reporterOptions: { reporterEnabled: 'cypress-qase-reporter', cypressQaseReporterReporterOptions: { ... // other options framework: { cypress: { screenshotsFolder: 'cypress/screenshots', + videosFolder: 'cypress/videos', + uploadDelay: 10, // Delay in seconds before uploading video files (default: 10) }, }, }, }, video: true, e2e: { setupNodeEvents(on, config) { require('cypress-qase-reporter/plugin')(on, config) require('cypress-qase-reporter/metadata')(on) + on('after:spec', async (spec, results) => { + await afterSpecHook(spec, config); + }); } } ...
Updating from v2.1 to v2.2
To update an existing test project using Qase reporter from version 2.1 to version 2.2, run the following steps:
Add metadata in the
e2esection ofcypress.config.js... e2e: { setupNodeEvents(on, config) { require('cypress-qase-reporter/plugin')(on, config) + require('cypress-qase-reporter/metadata')(on) } } ...
Updating from v1 to v2.1
To update an existing test project using Qase reporter from version 1 to version 2.1, run the following steps:
Change import paths in your test files:
- import { qase } from 'cypress-qase-reporter/dist/mocha' + import { qase } from 'cypress-qase-reporter/mocha'Update reporter configuration in
cypress.config.jsand/or environment variables — see the configuration reference below.Add a hook in the
e2esection ofcypress.config.js:... e2e: { + setupNodeEvents(on, config) { + require('cypress-qase-reporter/plugin')(on, config) } } ...If you already override
before:runorafter:runhooks in yourcypress.config.js, use this instead:const { beforeRunHook, afterRunHook } = require('cypress-qase-reporter/hooks'); ... e2e: { setupNodeEvents(on, config) { + on('before:run', async () => { + console.log('override before:run'); + await beforeRunHook(config); + }); + on('after:run', async () => { + console.log('override after:run'); + await afterRunHook(config); + }); }, }, ...
Getting started
The Cypress reporter can auto-generate test cases and suites from your test data. Test results of subsequent test runs will match the same test cases as long as their names and file paths don't change.
You can also annotate the tests with the IDs of existing test cases from Qase.io before executing tests. It's a more reliable way to bind autotests to test cases, that persists when you rename, move, or parameterize your tests.
Metadata
qase.title- set the title of the test caseqase.fields- set the fields of the test caseqase.suite- set the suite of the test caseqase.comment- set the comment of the test caseqase.parameters- set the parameters of the test caseqase.groupParameters- set the group parameters of the test caseqase.ignore- ignore the test case in Qase. The test will be executed, but the results will not be sent to Qase.qase.step- create a step in the test caseqase.attach- attach a file or content to the test case
Cucumber-specific
addCucumberStep(stepName)- manually add a Cucumber step to Qase report (useful for@badeball/cypress-cucumber-preprocessor)
For detailed instructions on using annotations and methods, refer to Usage.
For example:
import { qase } from 'cypress-qase-reporter/mocha';
describe('My First Test', () => {
qase(1,
it('Several ids', () => {
qase.title('My title');
expect(true).to.equal(true);
})
);
// a test can check multiple test cases
qase([2, 3],
it('Correct test', () => {
expect(true).to.equal(true);
})
);
qase(4,
it.skip('Skipped test', () => {
expect(true).to.equal(true);
})
);
});To execute Cypress tests and report them to Qase.io, run the command:
QASE_MODE=testops npx cypress runor
npm testYou can try it with the example project at examples/cypress.
A test run will be performed and available at:
https://app.qase.io/run/QASE_PROJECT_CODEConfiguration
Qase Cypress reporter can be configured in multiple ways:
- by adding configuration block in
cypress.config.js, - using a separate config file
qase.config.json, - using environment variables (they override the values from the configuration files).
For a full list of configuration options, see the Configuration reference.
Example cypress.config.js config:
import cypress from 'cypress';
import { afterSpecHook } from 'cypress-qase-reporter/hooks';
module.exports = cypress.defineConfig({
reporter: 'cypress-multi-reporters',
reporterOptions: {
reporterEnabled: 'cypress-mochawesome-reporter, cypress-qase-reporter',
cypressMochawesomeReporterReporterOptions: {
charts: true,
},
cypressQaseReporterReporterOptions: {
debug: true,
testops: {
api: {
token: 'api_key',
},
project: 'project_code',
uploadAttachments: true,
run: {
complete: true,
},
},
framework: {
cypress: {
screenshotsFolder: 'cypress/screenshots',
videosFolder: 'cypress/videos',
uploadDelay: 10, // Delay in seconds before uploading video files (default: 10)
}
}
},
},
video: false,
e2e: {
setupNodeEvents(on, config) {
require('cypress-qase-reporter/plugin')(on, config)
require('cypress-qase-reporter/metadata')(on)
on('after:spec', async (spec, results) => {
await afterSpecHook(spec, config);
});
},
},
});Check out the example of configuration for multiple reporters in the demo project.
Cucumber/Gherkin Integration
If you use Cucumber with Gherkin feature files in your Cypress tests, Qase reporter provides full support for both the legacy cypress-cucumber-preprocessor and the modern @badeball/cypress-cucumber-preprocessor.
The reporter can automatically:
- Extract test cases from feature files
- Report individual Gherkin steps (Given/When/Then) with their execution status
- Link test results to Qase test cases using
@QaseIDtags - Attach screenshots and videos to test results
📚 For detailed instructions, configuration examples, and troubleshooting, see the Cucumber Integration Guide.
Quick links:
- Example project for @badeball/cypress-cucumber-preprocessor
- Example project for cypress-cucumber-preprocessor (legacy)
Requirements
We maintain the reporter on LTS versions of Node.
cypress >= 8.0.0
