Skip to content

Commit

Permalink
add a Jenkinsfile for nightly end-to-end tests
Browse files Browse the repository at this point in the history
also add error handling for TestRail

Signed-off-by: Jakub Sokołowski <jakub@status.im>
  • Loading branch information
jakubgs committed Jul 1, 2019
1 parent 2fd3fb9 commit 37dc51a
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 2 deletions.
64 changes: 64 additions & 0 deletions ci/Jenkinsfile.nightly-end-to-end
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
pipeline {

agent { label 'linux1' }

parameters {
string(
name: 'NETWORK',
description: 'Name of test network to use.',
defaultValue: 'ropsten',
)
string(
name: 'APK_NAME',
description: 'Filename of APK uploaded to SauceLabs.',
)
}

options {
disableConcurrentBuilds()
}


stages {
stage('Test') {
steps {
withCredentials([
usernamePassword(
credentialsId: 'test-rail-api',
usernameVariable: 'TESTRAIL_USER',
passwordVariable: 'TESTRAIL_PASS'
),
usernamePassword(
credentialsId: 'sauce-labs-api',
usernameVariable: 'SAUCE_USERNAME',
passwordVariable: 'SAUCE_ACCESS_KEY'
),
]) {
dir('test/appium/tests') {
sh """
python3 -m pytest -m testrail_id \
-n24 --rerun_count=2 \
--testrail_report=True \
--network=${params.NETWORK} \
--apk=${params.APK_NAME}
"""
}
}
}
}
}

post {
always {
script {
sauce('12e007ad-48cf-4c20-92f3-b923bb5641bd') {
saucePublisher()
}
junit(
testDataPublishers: [[$class: 'SauceOnDemandReportPublisher', jobVisibility: 'public']],
testResults: 'test/appium/tests/*.xml'
)
}
}
}
}
1 change: 0 additions & 1 deletion ci/android.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ def uploadToSauceLabs() {
}

def uploadToDiawi() {
env.SAUCE_LABS_NAME = "im.status.ethereum-e2e-${GIT_COMMIT.take(6)}.apk"
withCredentials([
string(credentialsId: 'diawi-token', variable: 'DIAWI_TOKEN'),
]) {
Expand Down
5 changes: 4 additions & 1 deletion test/appium/support/testrail_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ def __init__(self):
self.api_url = self.url + 'api/v2/'

def get(self, method):
return requests.get(self.api_url + method, headers=self.headers).json()
rval = requests.get(self.api_url + method, headers=self.headers).json()
if 'error' in rval:
raise Exception('Failed request: %s' % rval['error'])
return rval

def post(self, method, data):
data = bytes(json.dumps(data), 'utf-8')
Expand Down

0 comments on commit 37dc51a

Please sign in to comment.