diff --git a/CHANGELOG.md b/CHANGELOG.md index ee8085c..c709040 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Added + +- config parameter for controlling the video recording during test execution (#11) + ## [v2.0.0](https://github.com/cloudogu/zalenium-build-lib/releases/tag/v2.0.0) - 2020-02-21 Heads-up: Breaking change ahead! diff --git a/vars/withZalenium.groovy b/vars/withZalenium.groovy index c087053..b1a56af 100644 --- a/vars/withZalenium.groovy +++ b/vars/withZalenium.groovy @@ -4,13 +4,14 @@ * * @param config contains a map of settings that change the Zalenium behavior. Can be a partial map or even left out. * The defaults are: - * [seleniumVersion : '3.141.59-p8', - * seleniumImage : 'elgalu/selenium', - * zaleniumVersion : '3.141.59g', - * zaleniumImage : 'dosel/zalenium', - * zaleniumVideoDir : 'zalenium', - * sendGoogleAnalytics: false, - * debugZalenium : false] + * [seleniumVersion : '3.141.59-p8', + * seleniumImage : 'elgalu/selenium', + * zaleniumVersion : '3.141.59g', + * zaleniumImage : 'dosel/zalenium', + * zaleniumVideoDir : 'zalenium', + * debugZalenium : false, + * videoRecordingEnabled: false, + * sendGoogleAnalytics : false] * @param zaleniumNetwork The Zalenium container will be added to this docker network. This is useful if other containers * must communicate with Zalenium while being in a docker network. If empty or left out, Zalenium will stay in the * default network. @@ -18,13 +19,14 @@ */ void call(Map config = [:], String zaleniumNetwork, Closure closure) { - def defaultConfig = [seleniumVersion : '3.141.59-p8', - seleniumImage : 'elgalu/selenium', - zaleniumVersion : '3.141.59g', - zaleniumImage : 'dosel/zalenium', - zaleniumVideoDir : 'zalenium', - debugZalenium : false, - sendGoogleAnalytics: false] + def defaultConfig = [seleniumVersion : '3.141.59-p8', + seleniumImage : 'elgalu/selenium', + zaleniumVersion : '3.141.59g', + zaleniumImage : 'dosel/zalenium', + zaleniumVideoDir : 'zalenium', + debugZalenium : false, + videoRecordingEnabled: false, + sendGoogleAnalytics : false] // Merge default config with the one passed as parameter config = defaultConfig << config @@ -58,6 +60,7 @@ void call(Map config = [:], String zaleniumNetwork, Closure closure) { "-v ${WORKSPACE}/${config.zaleniumVideoDir}:/home/seluser/videos", 'start ' + "--seleniumImageName ${config.seleniumImage} " + + "--videoRecordingEnabled ${config.videoRecordingEnabled} " + "${config.debugZalenium ? '--debugEnabled true' : ''} " + // switch off analytic gathering "${config.sendGoogleAnalytics ? '--sendAnonymousUsageInfo false' : ''} " @@ -77,7 +80,9 @@ void call(Map config = [:], String zaleniumNetwork, Closure closure) { // Wait for Selenium sessions to end (i.e. videos to be copied) // Leaving the withRun() closure leads to "docker rm -f" being called, cancelling copying waitForSeleniumSessionsToEnd(zaleniumIp) - archiveArtifacts allowEmptyArchive: true, artifacts: "${config.zaleniumVideoDir}/*.mp4" + if(config.videoRecordingEnabled) { + archiveArtifacts allowEmptyArchive: true, artifacts: "${config.zaleniumVideoDir}/*.mp4" + } // Stop container gracefully and wait sh "docker stop ${zaleniumContainer.id}" diff --git a/vars/withZalenium.txt b/vars/withZalenium.txt index f51f198..62d267a 100644 --- a/vars/withZalenium.txt +++ b/vars/withZalenium.txt @@ -10,6 +10,7 @@ Requires Docker! - zaleniumVersion - version of the zalenium docker image - zaleniumVideoDir - path where the videos are stored, relative to the Jenkins workspace. - debugZalenium - makes the zalenium container write a lot more logs +- videoRecordingEnabled - enables the video recording during the test execution; defaults to false - sendGoogleAnalytics - if true this will send analytic data to Google/Zalando Exemplary calls: