Skip to content

Instantly share code, notes, and snippets.

@nikoly
Last active March 29, 2021 16:20
Show Gist options
  • Save nikoly/511bf1a8a1431824ae72531388c043c0 to your computer and use it in GitHub Desktop.
Save nikoly/511bf1a8a1431824ae72531388c043c0 to your computer and use it in GitHub Desktop.
Complete Jenkins Pipeline to run selenium tests
#!groovy
node {
wrap([$class: 'AnsiColorBuildWrapper', colorMapName: 'xterm']) {
stage("Checkout") {
checkout scm
}
stage("Cleaning and preparing") {
sh '''#!/bin/bash -e
git clean -dfx
mkdir reports
'''
}
stage('Build an image with App') {
sh """
docker-compose build app:{BUILD_NUMBER}
"""
}
stage('Build an image with Tests') {
sh """
docker-compose build robottests:{BUILD_NUMBER}
"""
}
stage('Run Docker Compose') {
sh """#!/bin/bash -e
docker-compose run --rm robottests:{BUILD_NUMBER} ./wait-for-it.sh -t 15 chromenode:5555 -- robot -d reports --variablefile variables/config.py --variable BROWSER:chrome tests/
"""
}
stage('Stop all containers') {
sh """
docker-compose down
"""
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment