Skip to content

Commit eca752a

Browse files
author
Joshua Sprey
authored
Merge pull request #12 from cloudogu/feature/11_configure_video_recording
Feature/11 configure video recording
2 parents 0de720b + be3c37d commit eca752a

File tree

3 files changed

+27
-15
lines changed

3 files changed

+27
-15
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [Unreleased]
8+
9+
### Added
10+
11+
- config parameter for controlling the video recording during test execution (#11)
12+
713
## [v2.0.0](https://github.com/cloudogu/zalenium-build-lib/releases/tag/v2.0.0) - 2020-02-21
814

915
Heads-up: Breaking change ahead!

vars/withZalenium.groovy

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,29 @@
44
*
55
* @param config contains a map of settings that change the Zalenium behavior. Can be a partial map or even left out.
66
* The defaults are:
7-
* [seleniumVersion : '3.141.59-p8',
8-
* seleniumImage : 'elgalu/selenium',
9-
* zaleniumVersion : '3.141.59g',
10-
* zaleniumImage : 'dosel/zalenium',
11-
* zaleniumVideoDir : 'zalenium',
12-
* sendGoogleAnalytics: false,
13-
* debugZalenium : false]
7+
* [seleniumVersion : '3.141.59-p8',
8+
* seleniumImage : 'elgalu/selenium',
9+
* zaleniumVersion : '3.141.59g',
10+
* zaleniumImage : 'dosel/zalenium',
11+
* zaleniumVideoDir : 'zalenium',
12+
* debugZalenium : false,
13+
* videoRecordingEnabled: false,
14+
* sendGoogleAnalytics : false]
1415
* @param zaleniumNetwork The Zalenium container will be added to this docker network. This is useful if other containers
1516
* must communicate with Zalenium while being in a docker network. If empty or left out, Zalenium will stay in the
1617
* default network.
1718
* @param closure the body
1819
*/
1920
void call(Map config = [:], String zaleniumNetwork, Closure closure) {
2021

21-
def defaultConfig = [seleniumVersion : '3.141.59-p8',
22-
seleniumImage : 'elgalu/selenium',
23-
zaleniumVersion : '3.141.59g',
24-
zaleniumImage : 'dosel/zalenium',
25-
zaleniumVideoDir : 'zalenium',
26-
debugZalenium : false,
27-
sendGoogleAnalytics: false]
22+
def defaultConfig = [seleniumVersion : '3.141.59-p8',
23+
seleniumImage : 'elgalu/selenium',
24+
zaleniumVersion : '3.141.59g',
25+
zaleniumImage : 'dosel/zalenium',
26+
zaleniumVideoDir : 'zalenium',
27+
debugZalenium : false,
28+
videoRecordingEnabled: false,
29+
sendGoogleAnalytics : false]
2830

2931
// Merge default config with the one passed as parameter
3032
config = defaultConfig << config
@@ -58,6 +60,7 @@ void call(Map config = [:], String zaleniumNetwork, Closure closure) {
5860
"-v ${WORKSPACE}/${config.zaleniumVideoDir}:/home/seluser/videos",
5961
'start ' +
6062
"--seleniumImageName ${config.seleniumImage} " +
63+
"--videoRecordingEnabled ${config.videoRecordingEnabled} " +
6164
"${config.debugZalenium ? '--debugEnabled true' : ''} " +
6265
// switch off analytic gathering
6366
"${config.sendGoogleAnalytics ? '--sendAnonymousUsageInfo false' : ''} "
@@ -77,7 +80,9 @@ void call(Map config = [:], String zaleniumNetwork, Closure closure) {
7780
// Wait for Selenium sessions to end (i.e. videos to be copied)
7881
// Leaving the withRun() closure leads to "docker rm -f" being called, cancelling copying
7982
waitForSeleniumSessionsToEnd(zaleniumIp)
80-
archiveArtifacts allowEmptyArchive: true, artifacts: "${config.zaleniumVideoDir}/*.mp4"
83+
if(config.videoRecordingEnabled) {
84+
archiveArtifacts allowEmptyArchive: true, artifacts: "${config.zaleniumVideoDir}/*.mp4"
85+
}
8186

8287
// Stop container gracefully and wait
8388
sh "docker stop ${zaleniumContainer.id}"

vars/withZalenium.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Requires Docker!
1010
- zaleniumVersion - version of the zalenium docker image
1111
- zaleniumVideoDir - path where the videos are stored, relative to the Jenkins workspace.
1212
- debugZalenium - makes the zalenium container write a lot more logs
13+
- videoRecordingEnabled - enables the video recording during the test execution; defaults to false
1314
- sendGoogleAnalytics - if true this will send analytic data to Google/Zalando
1415

1516
Exemplary calls:

0 commit comments

Comments
 (0)