cypress-qase-reporter
TypeScript icon, indicating that this package has built-in type declarations

2.2.0 • Public • Published

Qase TMS Cypress reporter

Publish results simple and easy.

Installation

To install the latest release version (2.2.x), run:

npm install -D cypress-qase-reporter

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:

  1. Change import paths in your test files:

    - import { qase } from 'cypress-qase-reporter/dist/mocha'
    + import { qase } from 'cypress-qase-reporter/mocha'
  2. Update reporter configuration in cypress.config.js and/or environment variables — see the configuration reference below.

  3. Add a hook in the e2e section of cypress.config.js:

      ...
      e2e: {
    +   setupNodeEvents(on, config) { 
    +     require('cypress-qase-reporter/plugin')(on, config)
        }
      }
      ...

    If you already override before:run or after:run hooks in your cypress.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);
    +     });
        },
      },
      ...

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:

  1. Add a metadata in the e2e section of cypress.config.js

      ...
      e2e: {
       setupNodeEvents(on, config) { 
         require('cypress-qase-reporter/plugin')(on, config)
    +    require('cypress-qase-reporter/metadata')(on)
        }
      }
      ...
    

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 case
  • qase.fields - set the fields of the test case
  • qase.suite - set the suite of the test case
  • qase.comment - set the comment of the test case
  • qase.parameters - set the parameters of the test case
  • qase.groupParameters - set the group parameters of the test case
  • qase.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 case

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 run

or

npm test

You 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_CODE

Configuration

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';

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',
        }
      }
    },
  },
  video: false,
  e2e: {
    setupNodeEvents(on, config) {
      require('cypress-qase-reporter/plugin')(on, config)
      require('cypress-qase-reporter/metadata')(on)
    },
  },
});

Check out the example of configuration for multiple reporters in the demo project.

Requirements

We maintain the reporter on LTS versions of Node.

cypress >= 8.0.0

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
2.2.0420latest
2.2.0-beta.36beta

Version History

VersionDownloads (Last 7 Days)Published
2.2.0420
2.2.0-beta.36
2.2.0-beta.22
2.2.0-beta.12
2.1.12,389
2.1.090
2.1.0-beta.381
2.1.0-beta.21
2.1.0-beta.11
2.0.3830
2.0.2766
2.0.18
2.0.01
2.0.0-beta.41
2.0.0-beta.31
2.0.0-beta.21
2.0.0-beta.12
2.0.0-beta.01
1.4.32,734
1.4.2-alpha.3225
1.4.2-alpha.2144
1.4.1410
1.4.01
1.3.31
1.3.11
1.3.01
1.2.043
1.1.23
1.1.11
1.1.01
1.0.31
1.0.11
1.0.01
1.0.0-alpha21
1.0.0-alpha11

Package Sidebar

Install

npm i cypress-qase-reporter

Weekly Downloads

8,173

Version

2.2.0

License

Apache-2.0

Unpacked Size

848 kB

Total Files

33

Last publish

Collaborators

  • qaseio
  • zeburek