Skip to content

Commit

Permalink
docs: update documentation for Cypress reporter
Browse files Browse the repository at this point in the history
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
  • Loading branch information
gibiw committed Apr 17, 2024
1 parent 1824d00 commit 6a8a78e
Showing 1 changed file with 95 additions and 43 deletions.
138 changes: 95 additions & 43 deletions qase-cypress/README.md
Original file line number Diff line number Diff line change
@@ -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
```

<p align="center">
<img width="65%" src="./screenshots/screenshot.png">
</p>
Expand All @@ -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
Expand All @@ -87,24 +79,84 @@ 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`
- `QASE_TESTOPS_PROJECT` - Same as `testops.project`
- `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`

Expand Down

0 comments on commit 6a8a78e

Please sign in to comment.