testrail-jest-reporter
Advanced tools
Comparing version 1.1.7 to 1.2.0
@@ -0,1 +1,7 @@ | ||
v1.2.0 / 2024-04-09 | ||
================== | ||
* Added support for new TestRail Milestone if the specified Milestone not present in the Project. | ||
* Added support for Milestone description | ||
v1.1.7 / 2024-04-08 | ||
@@ -2,0 +8,0 @@ ================== |
@@ -5,3 +5,3 @@ 'use strict'; | ||
const utils = new Utils(); | ||
const post_methods = ['add_result_for_case', 'add_results_for_cases', 'add_run', 'update_run']; | ||
const post_methods = ['add_result_for_case', 'add_results_for_cases', 'add_run', 'update_run', 'add_milestone']; | ||
const get_methods = ['get_project', 'get_milestones', 'get_plans', 'get_plan', 'get_runs', 'get_run', | ||
@@ -104,2 +104,3 @@ 'get_test', 'get_tests', 'get_case', 'get_suite'] | ||
* @property {function} get_milestones | ||
* @property {function} add_milestone | ||
* @property {function} get_plans | ||
@@ -106,0 +107,0 @@ * @property {function} get_plan |
@@ -111,2 +111,29 @@ const add_result_for_case = { | ||
}; | ||
const add_milestone = { | ||
"type": "object", | ||
"required": [ | ||
"name", | ||
"description" | ||
], | ||
"properties": { | ||
"name": { | ||
"type": "string" | ||
}, | ||
"description": { | ||
"oneOf": [{ "type": ["null", "string"] }] | ||
}, | ||
"due_on": { | ||
"oneOf": [{ "type": ["null", "string"] }] | ||
}, | ||
"parent_id": { | ||
"oneOf": [{ "type": ["null", "integer"] }] | ||
}, | ||
"refs": { | ||
"oneOf": [{ "type": ["null", "string"] }] | ||
}, | ||
"start_on": { | ||
"oneOf": [{ "type": ["null", "string"] }] | ||
} | ||
}, | ||
}; | ||
@@ -117,3 +144,4 @@ module.exports = { | ||
add_run, | ||
update_run: add_run | ||
update_run: add_run, | ||
add_milestone | ||
}; |
@@ -969,3 +969,4 @@ const get_project = { | ||
add_run: get_run, | ||
update_run: get_run | ||
update_run: get_run, | ||
add_milestone: get_milestone | ||
}; |
{ | ||
"name": "testrail-jest-reporter", | ||
"version": "1.1.7", | ||
"version": "1.2.0", | ||
"description": "Custom Jest reporter for Testrail synchronization", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -21,3 +21,3 @@ [![TestRail v6.7](https://img.shields.io/badge/TestRail%20API-v2-green.svg)](http://docs.gurock.com/testrail-api2/start) [![NPM](https://img.shields.io/npm/l/testrail-jest-reporter)](https://github.com/AntonChaukin/testrail-jest-reporter/blob/main/LICENSE) [![NPM](https://img.shields.io/node/v/testrail-jest-reporter)](https://github.com/AntonChaukin/testrail-jest-reporter/blob/main/package.json) | ||
- Specify the TestRail server url as parameter 'baseUrl' _(recommended)_. | ||
- Specify the TestRail Milestone name as parameter 'milestone' _(recommended)_. | ||
- Specify the TestRail Milestones name and description as parameter 'milestone' _(recommended)_. | ||
- Specify the TestRail **`suite mode`** id as parameter 'suite_mode' _(recommended)_. If that parameter is not specified, the Reporter will get this automatically. | ||
@@ -41,3 +41,3 @@ >single repository for all cases - `suite_mode:1`<br> | ||
baseUrl: 'http://localhost', | ||
milestone: '<milestone_name>', | ||
milestone: {name:'<milestone_name>', description:'<milestone_description>'}, | ||
suite_mode: 3, | ||
@@ -62,3 +62,3 @@ statuses: {pending: 7} | ||
"baseUrl": 'http://localhost', | ||
"milestone": '<milestone_name>', | ||
"milestone": {"name":'<milestone_name>', "description":'<milestone_description>'}, | ||
"suite_mode": "3", | ||
@@ -84,3 +84,3 @@ "statuses": {"pending": "7"} | ||
- Use TestRail Milestone to versioning your tests. | ||
- **testrail.conf.js** file needs to have Milestone name filled. Or <br>it can be specified in | ||
- **testrail.conf.js** file needs to have Milestones name and description filled. Or <br>it can be specified in | ||
[Jest configuration](https://github.com/AntonChaukin/testrail-jest-reporter#jest-configurations) | ||
@@ -94,6 +94,7 @@ | ||
'pass': 'some-password', | ||
'milestone': '<milestone_name>', | ||
'milestone': {'name':'<milestone_name>', 'description':'<milestone_description>'}, | ||
'regex': /[C][?\d]{3,6}/gm | ||
} | ||
``` | ||
Or you can use previous variant ```'milestone': '<milestone_name>'``` | ||
@@ -147,3 +148,3 @@ ##### **Important:** If you use a public repository, please, secure your sensitive data. | ||
- Add new test Runs if the Milestone not specified. | ||
- Add new TestRail Milestone if the specified Milestone not present in the Project. | ||
- ~~Add new TestRail Milestone if the specified Milestone not present in the Project.~~ >> **Done in 1.2.0** | ||
- ~~Also need to write more tests.~~ >> **Done in 1.0.4** | ||
@@ -150,0 +151,0 @@ - ~~Added ability to specify several case_ids in one test description~~ >> **Done in 1.0.6** |
@@ -21,3 +21,3 @@ 'use strict'; | ||
this._baseUrl = _options.baseUrl ; | ||
this._milestone_name = _options.milestone; | ||
this._milestone = utils.isPlainObject(_options.milestone) ? _options.milestone : {name: _options.milestone}; | ||
this._project_id = _options.project_id; | ||
@@ -69,11 +69,11 @@ this._suite_mode = _options.suite_mode; | ||
.then(res => { | ||
const _milestone = res.milestones.filter((milestone) => milestone.name === this._milestone_name); | ||
const _milestone = res.milestones.filter((milestone) => milestone.name === this._milestone.name); | ||
if (_milestone && !!_milestone.length) { | ||
this._milestone_id = _milestone[0].id; | ||
return _milestone[0]; | ||
} else { | ||
throw new ReporterError(`Can not find milestone with name ${this._milestone_name}! | ||
\nNo one tests results will be reported. | ||
\nPlease, check the "milestone" param you specified in congif and try again`) | ||
return tr_api.add_milestone(this._project_id, | ||
{name: this._milestone.name, description: this._milestone.description || 'Automated generated milestone'}); | ||
} | ||
}) | ||
.then(milestone => {this._milestone_id = milestone.id;}) | ||
.catch(e => { | ||
@@ -80,0 +80,0 @@ console.log(error(e.stack)); |
@@ -13,3 +13,4 @@ const baseUrl = process.env.URL; | ||
//'milestone': '<milestone_name>' | ||
//'milestone': {name:'<milestone_name>', description:'<milestone_description>'} | ||
//'suite_mode': '<suite_mode>' | ||
} |
@@ -6,2 +6,4 @@ const chalk = require('chalk'); | ||
tr_milestone, tr_plan, tr_run, tr_test, tr_result} = require('./sample'); | ||
const api = require("../lib/interface"); | ||
const caller = require("../src/caller"); | ||
@@ -148,4 +150,5 @@ describe('Caller tests', function () { | ||
const api = require('../lib/interface'); | ||
const milestone = tr_milestone(); | ||
caller.init({milestone: 'Sprint 1', project_id: 1, suite_mode: 2}); | ||
caller.init({milestone: milestone, project_id: 1, suite_mode: 2}); | ||
const log_spy = jest.spyOn(global.console, 'log') | ||
@@ -155,2 +158,4 @@ .mockResolvedValueOnce(true); | ||
.mockResolvedValueOnce(get_milestones_resp); | ||
const add_milestone_spy = jest.spyOn(api, 'add_milestone') | ||
.mockResolvedValueOnce(milestone); | ||
@@ -160,5 +165,6 @@ await caller.get_milestone_id(); | ||
expect(log_spy).toHaveBeenCalledTimes(1); | ||
log_spy.mockRestore(); | ||
expect(caller._milestone_id).toBeFalsy(); | ||
expect(add_milestone_spy).toHaveBeenCalledTimes(1); | ||
expect(add_milestone_spy).toHaveBeenCalledWith(1, {name: milestone.name, description: milestone.description}); | ||
add_milestone_spy.mockRestore(); | ||
expect(caller._milestone_id).toEqual(milestone.id); | ||
}); | ||
@@ -165,0 +171,0 @@ |
@@ -324,5 +324,6 @@ const faker = require('faker'), Utils = require('../src/utils'); | ||
const _name = options && options.name || faker.random.words(); | ||
const _description = faker.random.words(); | ||
return { | ||
"completed_on": null, | ||
"description": "...", | ||
"description": _description, | ||
"due_on": 1391968184, | ||
@@ -329,0 +330,0 @@ "id": _id, |
Sorry, the diff of this file is not supported yet
AI detected potential malware
Supply chain riskAI has identified this package as malware. This is a strong signal that the package may be malicious.
Found 1 instance in 1 package
152923
3498
165
1