diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d5e306..550c210 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,24 @@ All notable changes to this project will be documented in this file. +## [2.0.0] + +### Breaking Changes + +We had to change the way how the integration is registered. +The new way allows to read additional Cypress events and gather information about browsers, versions and more. +Please see the UPGRADE.md file for more about this topic. + +### Added + +- Add collected data to TestRail result such as Cypress version, browser, baseURL, system and Spec file. +- Add option to set a custom comment that is passed on to the result in TestRail. You can use this to describe your AUT version, commit hash or more. + +### Changed + +- Changed the way how the integration is registered. +- TestRail results are now sent at the end of a spec file, and not directly after a single test anymore. + ## [1.1.0] ### Added @@ -12,7 +30,7 @@ All notable changes to this project will be documented in this file. ### Changed - Result comment is now trimmed to keep it neat ;) -- Improved extraction of Case IDs in Cypress titles by adding a trim to the title. +- Improved extraction of Case IDs in Cypress titles by adding a trim to the title. ## [1.0.0] diff --git a/README.md b/README.md index aea7e72..b136363 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,6 @@ ![Build Status](https://github.com/boxblinkracer/cypress-testrail/actions/workflows/ci_pipe.yml/badge.svg) ![NPM Downloads](https://badgen.net/npm/dt/cypress-testrail) ![GitHub release (latest by date)](https://img.shields.io/github/v/release/boxblinkracer/cypress-testrail) ![NPM License](https://img.shields.io/npm/l/cypress-testrail) - This integration helps you to automatically send test results to TestRail. And yes, super easy and simple! Add your TestRail credentials in Cypress, decide which test results should be sent to TestRail and you're done! @@ -21,7 +20,6 @@ Define new test cases in TestRail, and add automation to it, when you are ready. npm i cypress-testrail --save-dev ``` - ### 2. Setup TestRail credentials Now configure your credentials for the TestRail API. @@ -29,7 +27,6 @@ Just add this snippet in your `Cypress.env.json` file and adjust the values. Please keep in mind, the `runId` is always the test run, that you want to send the results to. You can find the ID inside the test run in TestRail. It usually starts with an R, like "R68". - ```yaml { "testrail": { @@ -41,16 +38,29 @@ You can find the ID inside the test run in TestRail. It usually starts with an R } ``` - ### 3. Register Plugin -Just place this line in your `support/index.js` file. +Just place this line in your `plugins/index.js` file. There's nothing more that is required to register the TestRail reporter. ```javascript -import 'cypress-testrail'; +const TestRailReporter = require('cypress-testrail'); + +module.exports = (on, config) => { + new TestRailReporter(on, config).register(); + return config +} ``` +In addition to this, you can register the reporter with a **custom comment**. +That comment will then be sent to the TestRail result along with the other metadata, +such as Cypress version, browser, baseURL and more. + +```javascript +const customComment = 'AUT v' + Cypress.env('MY_APP_VERSION'); + +new TestRailReporter(on, config, customComment).register(); +``` ### 4. Map Test Cases @@ -74,7 +84,6 @@ it('C123: My Test for TestRail XYZ', () => { You can now start Cypress (restart after config changes), and all your results should be sent to TestRail as soon as your mapped tests pass or fail! - ### Copying / License This repository is distributed under the MIT License (MIT). You can find the whole license text in the [LICENSE](LICENSE) file. diff --git a/UPGRADE.md b/UPGRADE.md index 93fd0cd..f56c444 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -1,12 +1,11 @@ # UPGRADE -## vX -> .... +## 1. CHANGELOGS -### See changelog +First, please always (and also) look at the CHANGELOG.md. +It will tell you more about the changes made. -First have a look at the changes in the CHANGELOG.md - -### New way to register plugin +## Upgrade v1.x => v2.x There is a new way to register the plugin. @@ -17,17 +16,16 @@ import 'cypress-testrail'; ``` The new way requires the plugin to be registered in the `plugins/index.js` file. + This is required, because we need new events to read data about browsers and specs, and that is only available in that scope. ```javascript const TestRailReporter = require('cypress-testrail'); module.exports = (on, config) => { - - // create a new reporter with our variables - // and just use the register() function. new TestRailReporter(on, config).register(); - return config } ``` + +That's it, it should all work again! \ No newline at end of file diff --git a/makefile b/makefile index 625a33c..e2518a0 100644 --- a/makefile +++ b/makefile @@ -15,3 +15,9 @@ jest: ## Runs JS Unit Tests eslint: ## Starts the ESLinter ./node_modules/.bin/eslint --config ./.eslintrc.json ./src + +# --------------------------------------------------------------------------------------------- + +pr: ## Prepares a pull request + make jest -B + make eslint -B \ No newline at end of file diff --git a/package.json b/package.json index 00aa556..5f5b4c5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cypress-testrail", - "version": "1.1.0", + "version": "2.0.0", "description": "Easy and decoupled Cypress TestRail reporter", "main": "index.js", "private": false,