From 37dc51a93d542135e67fe4f26767ebd0c2d114ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Mon, 17 Jun 2019 12:36:28 -0400 Subject: [PATCH] add a Jenkinsfile for nightly end-to-end tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit also add error handling for TestRail Signed-off-by: Jakub SokoĊ‚owski --- ci/Jenkinsfile.nightly-end-to-end | 64 ++++++++++++++++++++++++++ ci/android.groovy | 1 - test/appium/support/testrail_report.py | 5 +- 3 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 ci/Jenkinsfile.nightly-end-to-end diff --git a/ci/Jenkinsfile.nightly-end-to-end b/ci/Jenkinsfile.nightly-end-to-end new file mode 100644 index 0000000000..dd17a4949c --- /dev/null +++ b/ci/Jenkinsfile.nightly-end-to-end @@ -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' + ) + } + } + } +} diff --git a/ci/android.groovy b/ci/android.groovy index bd8a877b04..e4071d5088 100644 --- a/ci/android.groovy +++ b/ci/android.groovy @@ -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'), ]) { diff --git a/test/appium/support/testrail_report.py b/test/appium/support/testrail_report.py index cfa01042e6..b6c1b24f01 100644 --- a/test/appium/support/testrail_report.py +++ b/test/appium/support/testrail_report.py @@ -31,7 +31,10 @@ class TestrailReport(BaseTestReport): 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')