cypress-testrail
Advanced tools
Comparing version 2.1.1 to 2.2.0
@@ -5,2 +5,16 @@ # Changelog | ||
## [2.2.0] | ||
### Changed | ||
- RunIDs can now also be provided with a leading "R" and spaces. The integration will automatically remove it. | ||
- ProjectIDs can now also be provided with a leading "P" and spaces. The integration will automatically remove it. | ||
- MilestoneIDs can now also be provided with a leading "M" and spaces. The integration will automatically remove it. | ||
### Fixed | ||
- Fixed problem with missing axio package when doing an installation from scratch | ||
## [2.1.1] | ||
@@ -7,0 +21,0 @@ |
{ | ||
"name": "cypress-testrail", | ||
"version": "2.1.1", | ||
"version": "2.2.0", | ||
"description": "Easy and decoupled Cypress TestRail reporter", | ||
@@ -19,6 +19,8 @@ "main": "index.js", | ||
}, | ||
"dependencies": { | ||
"axios": "^0.27.2" | ||
}, | ||
"devDependencies": { | ||
"@babel/eslint-parser": "^7.18.2", | ||
"@babel/preset-env": "^7.18.2", | ||
"axios": "^0.27.2", | ||
"babel-jest": "^28.1.1", | ||
@@ -25,0 +27,0 @@ "eslint": "^8.18.0", |
@@ -120,17 +120,22 @@ class ConfigService { | ||
let projectId = ''; | ||
// CYPRESS_TESTRAIL_PROJECT_ID | ||
if (this.config.TESTRAIL_PROJECT_ID !== undefined && this.config.TESTRAIL_PROJECT_ID !== '') { | ||
return this.config.TESTRAIL_PROJECT_ID; | ||
} | ||
projectId = this.config.TESTRAIL_PROJECT_ID; | ||
} else { | ||
if (this.config.testrail === undefined || this.config.testrail === null) { | ||
return ''; | ||
} | ||
if (this.config.testrail === undefined || this.config.testrail === null) { | ||
return ''; | ||
projectId = this.config.testrail.projectId; | ||
if (projectId === undefined || projectId === null) { | ||
return ''; | ||
} | ||
} | ||
const projectId = this.config.testrail.projectId; | ||
projectId = projectId.replace('P', ''); | ||
projectId = projectId.trim(); | ||
if (projectId === undefined || projectId === null) { | ||
return ''; | ||
} | ||
return projectId; | ||
@@ -148,17 +153,22 @@ } | ||
let milestoneId = ''; | ||
// CYPRESS_TESTRAIL_MILESTONE_ID | ||
if (this.config.TESTRAIL_MILESTONE_ID !== undefined && this.config.TESTRAIL_MILESTONE_ID !== '') { | ||
return this.config.TESTRAIL_MILESTONE_ID; | ||
} | ||
milestoneId = this.config.TESTRAIL_MILESTONE_ID; | ||
} else { | ||
if (this.config.testrail === undefined || this.config.testrail === null) { | ||
return ''; | ||
} | ||
if (this.config.testrail === undefined || this.config.testrail === null) { | ||
return ''; | ||
milestoneId = this.config.testrail.milestoneId; | ||
if (milestoneId === undefined || milestoneId === null) { | ||
return ''; | ||
} | ||
} | ||
const milestoneId = this.config.testrail.milestoneId; | ||
milestoneId = milestoneId.replace('M', ''); | ||
milestoneId = milestoneId.trim(); | ||
if (milestoneId === undefined || milestoneId === null) { | ||
return ''; | ||
} | ||
return milestoneId; | ||
@@ -176,17 +186,21 @@ } | ||
let runId = ''; | ||
// CYPRESS_TESTRAIL_RUN_ID | ||
if (this.config.TESTRAIL_RUN_ID !== undefined && this.config.TESTRAIL_RUN_ID !== '') { | ||
return this.config.TESTRAIL_RUN_ID; | ||
} | ||
runId = this.config.TESTRAIL_RUN_ID; | ||
} else { | ||
if (this.config.testrail === undefined || this.config.testrail === null) { | ||
return ''; | ||
} | ||
runId = this.config.testrail.runId; | ||
if (this.config.testrail === undefined || this.config.testrail === null) { | ||
return ''; | ||
if (runId === undefined || runId === null) { | ||
return ''; | ||
} | ||
} | ||
const runId = this.config.testrail.runId; | ||
runId = runId.replace('R', ''); | ||
runId = runId.trim(); | ||
if (runId === undefined || runId === null) { | ||
return ''; | ||
} | ||
return runId; | ||
@@ -193,0 +207,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import ConfigService from "../../../src/services/ConfigService"; | ||
import ConfigService from '../../../src/services/ConfigService'; | ||
@@ -22,8 +22,27 @@ | ||
'testrail': { | ||
'runId': '123', | ||
} | ||
}); | ||
expect(config.getRunId()).toBe('123'); | ||
}); | ||
test('leading R from Run ID is correctly removed', () => { | ||
const config = new ConfigService({ | ||
'testrail': { | ||
'runId': 'R123', | ||
} | ||
}); | ||
expect(config.getRunId()).toBe('R123'); | ||
expect(config.getRunId()).toBe('123'); | ||
}); | ||
test('runId with whitespace is correctly trimmed', () => { | ||
const config = new ConfigService({ | ||
'testrail': { | ||
'runId': ' 123 ', | ||
} | ||
}); | ||
expect(config.getRunId()).toBe('123'); | ||
}); | ||
test('domain is correctly read', () => { | ||
@@ -59,8 +78,26 @@ const config = new ConfigService({ | ||
'testrail': { | ||
'projectId': '123', | ||
} | ||
}); | ||
expect(config.getProjectId()).toBe('123'); | ||
}); | ||
test('leading P from Project ID is correctly removed', () => { | ||
const config = new ConfigService({ | ||
'testrail': { | ||
'projectId': 'P123', | ||
} | ||
}); | ||
expect(config.getProjectId()).toBe('P123'); | ||
expect(config.getProjectId()).toBe('123'); | ||
}); | ||
test('projectId with whitespace is correctly trimmed', () => { | ||
const config = new ConfigService({ | ||
'testrail': { | ||
'projectId': ' 123 ', | ||
} | ||
}); | ||
expect(config.getProjectId()).toBe('123'); | ||
}); | ||
test('milestoneId is correctly read', () => { | ||
@@ -75,2 +112,20 @@ const config = new ConfigService({ | ||
test('leading M from Milestone ID is correctly removed', () => { | ||
const config = new ConfigService({ | ||
'testrail': { | ||
'milestoneId': 'M123', | ||
} | ||
}); | ||
expect(config.getMilestoneId()).toBe('123'); | ||
}); | ||
test('milestoneId with whitespace is correctly trimmed', () => { | ||
const config = new ConfigService({ | ||
'testrail': { | ||
'milestoneId': ' 123 ', | ||
} | ||
}); | ||
expect(config.getMilestoneId()).toBe('123'); | ||
}); | ||
test('runName is correctly read', () => { | ||
@@ -77,0 +132,0 @@ const config = new ConfigService({ |
56406
6
943
1
+ Addedaxios@^0.27.2
+ Addedasynckit@0.4.0(transitive)
+ Addedaxios@0.27.2(transitive)
+ Addedcall-bind-apply-helpers@1.0.2(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addeddunder-proto@1.0.1(transitive)
+ Addedes-define-property@1.0.1(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedes-object-atoms@1.1.1(transitive)
+ Addedes-set-tostringtag@2.1.0(transitive)
+ Addedfollow-redirects@1.15.9(transitive)
+ Addedform-data@4.0.2(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-intrinsic@1.3.0(transitive)
+ Addedget-proto@1.0.1(transitive)
+ Addedgopd@1.2.0(transitive)
+ Addedhas-symbols@1.1.0(transitive)
+ Addedhas-tostringtag@1.0.2(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedmath-intrinsics@1.1.0(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)