From 8711d20e93fdfff3a05800b250d6abaa4a136e3b Mon Sep 17 00:00:00 2001 From: Christian Beyer Date: Wed, 9 Dec 2020 14:33:35 +0100 Subject: [PATCH 1/6] add configuration to toggle video recording #11 --- vars/withZalenium.groovy | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/vars/withZalenium.groovy b/vars/withZalenium.groovy index c087053..6ecae40 100644 --- a/vars/withZalenium.groovy +++ b/vars/withZalenium.groovy @@ -18,13 +18,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 +59,7 @@ void call(Map config = [:], String zaleniumNetwork, Closure closure) { "-v ${WORKSPACE}/${config.zaleniumVideoDir}:/home/seluser/videos", 'start ' + "--seleniumImageName ${config.seleniumImage} " + + "${config.videoRecordingEnabled ? '' : '--videoRecordingEnabled false'} " + "${config.debugZalenium ? '--debugEnabled true' : ''} " + // switch off analytic gathering "${config.sendGoogleAnalytics ? '--sendAnonymousUsageInfo false' : ''} " From 652e3d08880b9268239e072427abc9d838a51553 Mon Sep 17 00:00:00 2001 From: Christian Beyer Date: Wed, 9 Dec 2020 15:42:07 +0100 Subject: [PATCH 2/6] update video config evaluation #11 --- vars/withZalenium.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vars/withZalenium.groovy b/vars/withZalenium.groovy index 6ecae40..f5fd877 100644 --- a/vars/withZalenium.groovy +++ b/vars/withZalenium.groovy @@ -59,7 +59,7 @@ void call(Map config = [:], String zaleniumNetwork, Closure closure) { "-v ${WORKSPACE}/${config.zaleniumVideoDir}:/home/seluser/videos", 'start ' + "--seleniumImageName ${config.seleniumImage} " + - "${config.videoRecordingEnabled ? '' : '--videoRecordingEnabled false'} " + + "--videoRecordingEnabled ${config.videoRecordingEnabled} " + "${config.debugZalenium ? '--debugEnabled true' : ''} " + // switch off analytic gathering "${config.sendGoogleAnalytics ? '--sendAnonymousUsageInfo false' : ''} " From e8fb17d8c4041c98f438d44e305dc5ca1b7a4921 Mon Sep 17 00:00:00 2001 From: Christian Beyer Date: Thu, 10 Dec 2020 08:18:46 +0100 Subject: [PATCH 3/6] update changelog #11 --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee8085c..c56851a 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 + ## [v2.0.0](https://github.com/cloudogu/zalenium-build-lib/releases/tag/v2.0.0) - 2020-02-21 Heads-up: Breaking change ahead! From b36093112158c893878d8f4f301c965bedc5f172 Mon Sep 17 00:00:00 2001 From: Joshua Sprey Date: Thu, 10 Dec 2020 09:29:32 +0100 Subject: [PATCH 4/6] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c56851a..c709040 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added -- config parameter for controlling the video recording during test execution +- 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 From 403a693aab0ef97e540884e69c6d38bdf446b202 Mon Sep 17 00:00:00 2001 From: Christian Beyer Date: Thu, 10 Dec 2020 11:09:00 +0100 Subject: [PATCH 5/6] archive videos only if recording is enabled #11 --- vars/withZalenium.groovy | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/vars/withZalenium.groovy b/vars/withZalenium.groovy index f5fd877..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. @@ -79,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}" From c79cc91caff001166d4fc868b372f8cf9a4e9f20 Mon Sep 17 00:00:00 2001 From: Christian Beyer Date: Thu, 10 Dec 2020 11:10:12 +0100 Subject: [PATCH 6/6] update zalenium documentation --- vars/withZalenium.txt | 1 + 1 file changed, 1 insertion(+) 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: