Add recording of tests using ffmpeg
Signed-off-by: Radim Hopp <rhopp@redhat.com>7.20.x
parent
db3d588466
commit
9d2b189bca
|
|
@ -9,7 +9,7 @@ RUN apt-get update && apt-get install && \
|
|||
apt-get install -y nodejs && \
|
||||
apt-get install -y npm && \
|
||||
npm install -g typescript && \
|
||||
apt-get install x11vnc -y
|
||||
apt-get install x11vnc ffmpeg -y
|
||||
|
||||
RUN mkdir /tmp/e2e && \
|
||||
chmod -R 777 /tmp/e2e
|
||||
|
|
|
|||
|
|
@ -1,5 +1,17 @@
|
|||
#!/bin/bash
|
||||
|
||||
EXIT_CODE=0
|
||||
|
||||
kill_ffmpeg(){
|
||||
echo "Killing ffmpeg with PID=$ffmpeg_pid"
|
||||
kill -2 "$ffmpeg_pid"
|
||||
wait "$ffmpeg_pid"
|
||||
mkdir -p /tmp/e2e/report/
|
||||
cp /tmp/ffmpeg_report/* /tmp/e2e/report/
|
||||
exit $EXIT_CODE
|
||||
}
|
||||
|
||||
set -x
|
||||
# Validate selenium base URL
|
||||
if [ -z "$TS_SELENIUM_BASE_URL" ]; then
|
||||
echo "The \"TS_SELENIUM_BASE_URL\" is not set!";
|
||||
|
|
@ -59,6 +71,10 @@ else
|
|||
cd /tmp/e2e || exit
|
||||
fi
|
||||
|
||||
mkdir -p /tmp/ffmpeg_report
|
||||
nohup ffmpeg -y -video_size 1920x1080 -framerate 24 -f x11grab -i :20.0 /tmp/ffmpeg_report/output.mp4 2> /tmp/ffmpeg_report/ffmpeg_err.txt > /tmp/ffmpeg_report/ffmpeg_std.txt &
|
||||
ffmpeg_pid=$!
|
||||
trap kill_ffmpeg 2 15
|
||||
|
||||
# Launch tests
|
||||
if [ $TEST_SUITE == "load-test" ]; then
|
||||
|
|
@ -86,4 +102,6 @@ End_script
|
|||
else
|
||||
echo "Running TEST_SUITE: $TEST_SUITE with user: $TS_SELENIUM_USERNAME"
|
||||
npm run $TEST_SUITE
|
||||
EXIT_CODE=$?
|
||||
fi
|
||||
kill_ffmpeg
|
||||
|
|
|
|||
|
|
@ -301,7 +301,7 @@ pipeline {
|
|||
|
||||
stage("Run E2E Happy path tests") {
|
||||
steps {
|
||||
sh """
|
||||
sh """
|
||||
CHE_URL=http://${cheHost}
|
||||
docker run --shm-size=1g --net=host --ipc=host \\
|
||||
-p 5920:5920 \\
|
||||
|
|
@ -323,22 +323,6 @@ pipeline {
|
|||
}
|
||||
|
||||
post {
|
||||
failure {
|
||||
echo "Create screencast from $WORKSPACE/tests/e2e/report/executionScreencast files."
|
||||
sh """
|
||||
command -v ffmpeg >/dev/null 2>&1 && if ls $WORKSPACE/tests/e2e/report/executionScreencast/*.png 1> /dev/null 2>&1; then
|
||||
cd $WORKSPACE/tests/e2e/report/executionScreencast
|
||||
|
||||
# remove first screenshot which has lower resolution 800x600 and breaks screencast video
|
||||
sudo rm -f 00100001* || true
|
||||
|
||||
sudo ffmpeg -framerate 1 -pattern_type glob -i '*.png' -c:v libx264 -r 30 -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" -pix_fmt yuv420p $WORKSPACE/tests/e2e/report/screencast.mp4
|
||||
cd $WORKSPACE/tests/e2e/report/
|
||||
sudo rm -rf $WORKSPACE/tests/e2e/report/executionScreencast
|
||||
fi
|
||||
"""
|
||||
}
|
||||
|
||||
cleanup {
|
||||
sh """
|
||||
mkdir -p $LOGS_AND_CONFIGS/kubectl
|
||||
|
|
|
|||
|
|
@ -196,9 +196,9 @@ export const TestConstants = {
|
|||
TS_SELENIUM_REPORT_FOLDER: process.env.TS_SELENIUM_REPORT_FOLDER || './report',
|
||||
|
||||
/**
|
||||
* Enable or disable storing of execution screencast, "true" by default.
|
||||
* Enable or disable storing of execution screencast, "false" by default.
|
||||
*/
|
||||
TS_SELENIUM_EXECUTION_SCREENCAST: process.env.TS_SELENIUM_EXECUTION_SCREENCAST !== 'false',
|
||||
TS_SELENIUM_EXECUTION_SCREENCAST: process.env.TS_SELENIUM_EXECUTION_SCREENCAST === 'true',
|
||||
|
||||
/**
|
||||
* Delete screencast after execution if all tests passed, "true" by default.
|
||||
|
|
|
|||
Loading…
Reference in New Issue