Skip to content

Commit 8573109

Browse files
Yakov Feldmanyakov-feldman
authored andcommitted
DHFPROD-7527: Optionally run the UI tests on BE PRs
1 parent ff696cc commit 8573109

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- [ ] Squashed all commits into a single commit
1414
- [ ] Code passes ESLint tests
1515
- [ ] Added Tests
16+
- [ ] Run UI tests
1617

1718

1819
- ##### Reviewer:

Jenkinsfile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ def getReviewState(){
140140
return reviewState
141141
}
142142
def PRDraftCheck(){
143-
def type;
144143
withCredentials([usernameColonPassword(credentialsId: '550650ab-ee92-4d31-a3f4-91a11d5388a3', variable: 'Credentials')]) {
145144
PrObj= sh (returnStdout: true, script:'''
146145
curl -u $Credentials -X GET '''+githubAPIUrl+'''/pulls/$CHANGE_ID
@@ -150,6 +149,16 @@ def PRDraftCheck(){
150149
return jsonObj.draft
151150
}
152151

152+
def isPRUITest(){
153+
withCredentials([usernameColonPassword(credentialsId: '550650ab-ee92-4d31-a3f4-91a11d5388a3', variable: 'Credentials')]) {
154+
PrObj= sh (returnStdout: true, script:'''
155+
curl -u $Credentials -X GET '''+githubAPIUrl+'''/pulls/$CHANGE_ID
156+
''')
157+
}
158+
def jsonObj = new JsonSlurperClassic().parseText(PrObj.toString().trim())
159+
return jsonObj.body.contains('[x] Run UI tests')
160+
}
161+
153162
def runCypressE2e(){
154163
script{
155164
copyRPM 'Release','10.0-6'
@@ -199,6 +208,7 @@ def runCypressE2e(){
199208
def output=readFile 'data-hub/marklogic-data-hub-central/ui/e2e/e2e_err.log'
200209
if(output.contains("npm ERR!")){
201210
// currentBuild.result='UNSTABLE';
211+
error 'cypress test failed. Tests might run succesfully or with some failures.'
202212
}
203213

204214
junit '**/e2e/**/*.xml'
@@ -234,7 +244,7 @@ void PreBuildCheck() {
234244
sh 'exit 1'
235245
}
236246

237-
if(!isChangeInUI()){env.NO_UI_TESTS=true}
247+
if(!isChangeInUI() && !isPRUITest()){env.NO_UI_TESTS=true}
238248

239249
}
240250
def obj=new abortPrevBuilds();

0 commit comments

Comments
 (0)