|
| 1 | +#!/usr/bin/env groovy |
| 2 | +import groovy.json.JsonSlurper |
| 3 | + |
| 4 | +properties([parameters([ \ |
| 5 | + choice(choices: "DEV\nALPHA\nBETA\n", description: 'Environment where to run this job.', name: 'ENVIRONMENT'), \ |
| 6 | + choice(choices: "browsers/chrome/CHROME59.json\nbrowsers/chrome/CHROME.json\nbrowsers/edge/EDGE.json\nbrowsers/firefox/FIREFOX53.json\nbrowsers/firefox/FIREFOX.json\nbrowsers/ie/IE.json", description: 'Choose the browser', name: 'BROWSER'), \ |
| 7 | + choice(choices: "os/WIN10.json", description: 'Choose the OS', name: 'OS'), \ |
| 8 | + choice(choices: "resolutions/1280x1024.json", description: 'Choose the resolution', name: 'RESOLUTION'), \ |
| 9 | + string(defaultValue: '', description: '', name: 'KEYWORDS'), \ |
| 10 | + string(defaultValue: '', description: '', name: 'MARKERS'), \ |
| 11 | + booleanParam(defaultValue: false, description: 'Report test execution on Testrail', name: 'TESTRAIL_ENABLE'), \ |
| 12 | + booleanParam(defaultValue: false, description: 'Enable browserstack debug (it might slow down test executions)', name: 'DEBUG'), \ |
| 13 | + booleanParam(defaultValue: false, description: 'Block on first failure', name: 'BLOCK_FIRST_FAILURE'), \ |
| 14 | + string(defaultValue: '', description: 'Number of parallel executions. Leave empty if want a sequential test execution or set the desired number of parallelism (eg: 2)', name: 'PARALLEL_SESSIONS'), \ |
| 15 | + string(defaultValue: '', description: 'You can specify an alternative selenium grid url', name: 'SELENIUM_GRID_URL') \ |
| 16 | +]), pipelineTriggers([])]) |
| 17 | + |
| 18 | +node('browserstack') { |
| 19 | + // notifyMessage("start"); |
| 20 | + |
| 21 | + stage('Checkout') { |
| 22 | + checkout scm |
| 23 | + } |
| 24 | + |
| 25 | + try { |
| 26 | + stage('Run Test'){ |
| 27 | + env.ENVIRONMENT = params.ENVIRONMENT |
| 28 | + env.MARKERS = params.MARKERS |
| 29 | + env.KEYWORDS = params.KEYWORDS |
| 30 | + env.OS = params.OS |
| 31 | + env.BROWSER = params.BROWSER |
| 32 | + env.PARALLEL_SESSIONS = params.PARALLEL_SESSIONS |
| 33 | + env.BUILD_ID = params.BUILD_ID |
| 34 | + env.RESOLUTION = params.RESOLUTION |
| 35 | + env.DEBUG = params.DEBUG |
| 36 | + env.TESTRAIL_ENABLE = params.TESTRAIL_ENABLE |
| 37 | + env.BLOCK_FIRST_FAILURE = params.BLOCK_FIRST_FAILURE |
| 38 | + env.SELENIUM_GRID_URL = params.SELENIUM_GRID_URL |
| 39 | + |
| 40 | + sh "./ci.py" |
| 41 | + } |
| 42 | + |
| 43 | + // notifyMessage("success") |
| 44 | + } |
| 45 | + catch (exception) { |
| 46 | + notifyMessage("error") |
| 47 | + throw exception |
| 48 | + } |
| 49 | +} |
| 50 | + |
| 51 | +/* |
| 52 | +def notifyMessage(String status) { |
| 53 | + def colorSet = ["start": "warning", "success": "good", "error": "danger"] |
| 54 | + def message = "${status} - Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})" |
| 55 | +
|
| 56 | + slackSend(color: "${colorSet[status]}", |
| 57 | + channel: '#deployments', |
| 58 | + message: "${message}", |
| 59 | + teamDomain: 'team-domain', |
| 60 | + token: 'TOKEN') |
| 61 | +} |
| 62 | +*/ |
0 commit comments