From 6a8a78eaadb9bd8870ae00de00482103c963f2d4 Mon Sep 17 00:00:00 2001 From: Dmitrii Gridnev Date: Wed, 17 Apr 2024 09:46:42 +0200 Subject: [PATCH] docs: update documentation for Cypress reporter Updated the following things: - fixed import in the example and remove the failed test - added new fields and example for the file config - added new ENV variable to the ENV config --- qase-cypress/README.md | 138 ++++++++++++++++++++++++++++------------- 1 file changed, 95 insertions(+), 43 deletions(-) diff --git a/qase-cypress/README.md b/qase-cypress/README.md index a2b16fe3..d4ac7328 100644 --- a/qase-cypress/README.md +++ b/qase-cypress/README.md @@ -1,65 +1,56 @@ -> # Qase TMS Cypress reporter -> -> Publish results simple and easy. +# Qase TMS Cypress reporter -## How to integrate +Publish results simple and easy. + +## How to install ``` -npm install cypress-qase-reporter +npm install cypress-qase-reporter@beta ``` ## Example of usage -If you want to decorate come test with Qase Case ID you could use qase function: +The Cypress reporter has the ability to auto-generate test cases +and suites from your test data. + +But if necessary, you can independently register the ID of already +existing test cases from TMS before the executing tests. For example: ```typescript -import { qase } from 'cypress-qase-reporter'; +import { qase } from 'cypress-qase-reporter/mocha'; describe('My First Test', () => { - qase([1,2], - it('Several ids', () => { - expect(true).to.equal(true); - }) - ); - qase(3, - it('Correct test', () => { - expect(true).to.equal(true); - }) - ); - qase(4, - it.skip('Skipped test', () => { - expect(true).to.equal(true); - }) - ); - qase(5, - it('Failed test', () => { - expect(true).to.equal(false); - }) - ); + qase([1, 2], + it('Several ids', () => { + expect(true).to.equal(true); + }) + ); + qase(3, + it('Correct test', () => { + expect(true).to.equal(true); + }) + ); + qase(4, + it.skip('Skipped test', () => { + expect(true).to.equal(true); + }) + ); }); -``` -If you are going to use several specifications for execution and you have in config -```json -"testops": { - "run": { - "complete": true - } -} -``` -then it is necessary to additionally set in the project settings -``` -Allow to add results for cases in closed runs. ``` To run tests and create a test run, execute the command (for example from folder examples): + ```bash QASE_MODE=testops npx cypress run ``` + or + ```bash npm test ``` +

@@ -74,9 +65,10 @@ https://app.qase.io/run/QASE_PROJECT_CODE Reporter options (* - required): -- `mode` - `testops`/`off` Enables reporter, default - `off` -- `debug` - Enables debug logging, defaule - `false` -- `environment` - To execute with the sending of the envinroment information +- `mode` - `testops`/`report`/`off` Enables reporter, default - `off` +- `fallback` - `testops`/`report`/`off` Enables fallback reporter, default - `off` +- `debug` - Enables debug logging, default - `false` +- `environment` - To execute with the sending of the environment information - *`testops.api.token` - Token for API access, you can find more information [here](https://developers.qase.io/#authentication) - *`testops.project` - Code of your project (can be extracted from main @@ -87,13 +79,66 @@ Reporter options (* - required): - `testops.run.title` - Set custom Run name, when new run is created - `testops.run.description` - Set custom Run description, when new run is created - `testops.run.complete` - Whether the run should be completed +- `testops.plan.id` - Pass Plan ID +- `testops.chunk` - Chunk size for test cases results, default - `200` +- `testops.defects` - Enable defects for failed test cases, default - `false` +- `report.driver` - `local` Driver for report, default - `local` +- `report.local.path` - Path to save report, default - `./build/qase-report` +- `report.local.format` - `json`/`jsonp` Format for report, default - `json` - `framework.cypress.screenshotFolder` - Folder for save screenshot cypress +Example `cypress.config.js` config: + +```js +import cypress from 'cypress'; + +import plugins from './cypress/plugins/index.js'; + +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) { + return plugins(on, config); + }, + }, +}); +``` + #### You can check example configuration with multiple reporters in [demo project](../examples/cypress/cypress.config.js). Supported ENV variables: - `QASE_MODE` - Same as `mode` +- `QASE_FALLBACK` - Same as `fallback - `QASE_DEBUG` - Same as `debug` - `QASE_ENVIRONMENT` - Same as `environment` - `QASE_TESTOPS_API_TOKEN` - Same as `testops.api.token` @@ -101,10 +146,17 @@ Supported ENV variables: - `QASE_TESTOPS_RUN_ID` - Pass Run ID from ENV and override reporter option `testops.run.id` - `QASE_TESTOPS_RUN_TITLE` - Same as `testops.run.title` - `QASE_TESTOPS_RUN_DESCRIPTION` - Same as `testops.run.description` +- `QASE_TESTOPS_PLAN_ID` - Same as `testops.plan.id` +- `QASE_TESTOPS_UPLOAD_ATTACHMENTS` - Same as `testops.uploadAttachments` +- `QASE_TESTOPS_CHUNK` - Same as `testops.chunk` +- `QASE_TESTOPS_DEFECTS` - Same as `testops.defects` +- `QASE_REPORT_CONNECTION_PATH` - Same as `report.local.path` +- `QASE_REPORT_CONNECTION_FORMAT` - Same as `report.local.format` ## Requirements -We maintain the reporter on LTS versions of Node. You can find the current versions by following the [link](https://nodejs.org/en/about/releases/) +We maintain the reporter on LTS versions of Node. You can find the current versions by following +the [link](https://nodejs.org/en/about/releases/) `cypress >= 8.0.0`