Enable video recording
This commit is contained in:
parent
83baa09384
commit
b6a1a57bed
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -6,4 +6,7 @@
|
|||
.coverage
|
||||
coverage.xml
|
||||
xunit.xml
|
||||
coverage/*
|
||||
coverage/*
|
||||
|
||||
# Video
|
||||
video*
|
||||
|
|
|
@ -21,11 +21,14 @@ services:
|
|||
scale: 1
|
||||
ports:
|
||||
- 6080
|
||||
volumes:
|
||||
- ./video-nexus_7.1.1:/tmp/video
|
||||
environment:
|
||||
- DEVICE=Nexus 5
|
||||
- CONNECT_TO_GRID=True
|
||||
- APPIUM=true
|
||||
- SELENIUM_HOST=selenium_hub
|
||||
- AUTO_RECORD=True
|
||||
|
||||
# Docker-Android for mobile website testing with chrome browser
|
||||
# Chrome browser exists only for version 7.0 and 7.1.1
|
||||
|
@ -36,12 +39,15 @@ services:
|
|||
scale: 1
|
||||
ports:
|
||||
- 6080
|
||||
volumes:
|
||||
- ./video-samsung_7.1.1:/tmp/video
|
||||
environment:
|
||||
- DEVICE=Samsung Galaxy S6
|
||||
- CONNECT_TO_GRID=True
|
||||
- APPIUM=true
|
||||
- SELENIUM_HOST=selenium_hub
|
||||
- MOBILE_WEB_TEST=True
|
||||
- AUTO_RECORD=True
|
||||
|
||||
# Docker-Android for mobile website testing with default browser
|
||||
# Default browser exists only for version 5.0.1, 5.1.1 and 6.0
|
||||
|
@ -52,9 +58,12 @@ services:
|
|||
scale: 1
|
||||
ports:
|
||||
- 6080
|
||||
volumes:
|
||||
- ./video-samsung_5.1.1:/tmp/video
|
||||
environment:
|
||||
- DEVICE=Samsung Galaxy S6
|
||||
- CONNECT_TO_GRID=True
|
||||
- APPIUM=true
|
||||
- SELENIUM_HOST=selenium_hub
|
||||
- MOBILE_WEB_TEST=True
|
||||
- AUTO_RECORD=True
|
||||
|
|
|
@ -29,6 +29,11 @@ WORKDIR /root
|
|||
# Numpy, For faster performance: https://github.com/novnc/websockify/issues/77
|
||||
# net-tools
|
||||
# Netstat
|
||||
#------------------
|
||||
# Video Recording
|
||||
#------------------
|
||||
# ffmpeg
|
||||
# Video recorder
|
||||
#==================
|
||||
RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \
|
||||
xterm \
|
||||
|
@ -39,6 +44,7 @@ RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \
|
|||
menu \
|
||||
python-numpy \
|
||||
net-tools \
|
||||
ffmpeg \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
#=======
|
||||
|
@ -100,6 +106,7 @@ ENV DISPLAY=:0 \
|
|||
LOCAL_PORT=5900 \
|
||||
TARGET_PORT=6080 \
|
||||
TIMEOUT=1 \
|
||||
VIDEO_PATH=/tmp/video \
|
||||
LOG_PATH=/var/log/supervisor
|
||||
|
||||
#===============
|
||||
|
|
|
@ -30,6 +30,11 @@ WORKDIR /root
|
|||
# net-tools
|
||||
# Netstat
|
||||
#------------------
|
||||
# Video Recording
|
||||
#------------------
|
||||
# ffmpeg
|
||||
# Video recorder
|
||||
#------------------
|
||||
# KVM Package
|
||||
# for emulator x86
|
||||
# https://help.ubuntu.com/community/KVM/Installation
|
||||
|
@ -48,6 +53,7 @@ RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \
|
|||
menu \
|
||||
python-numpy \
|
||||
net-tools \
|
||||
ffmpeg \
|
||||
qemu-kvm \
|
||||
libvirt-bin \
|
||||
ubuntu-vm-builder \
|
||||
|
@ -113,6 +119,7 @@ ENV DISPLAY=:0 \
|
|||
LOCAL_PORT=5900 \
|
||||
TARGET_PORT=6080 \
|
||||
TIMEOUT=1 \
|
||||
VIDEO_PATH=/tmp/video \
|
||||
LOG_PATH=/var/log/supervisor
|
||||
|
||||
#===============
|
||||
|
|
|
@ -29,6 +29,11 @@ WORKDIR /root
|
|||
# Numpy, For faster performance: https://github.com/novnc/websockify/issues/77
|
||||
# net-tools
|
||||
# Netstat
|
||||
#------------------
|
||||
# Video Recording
|
||||
#------------------
|
||||
# ffmpeg
|
||||
# Video recorder
|
||||
#==================
|
||||
RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \
|
||||
xterm \
|
||||
|
@ -39,6 +44,7 @@ RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \
|
|||
menu \
|
||||
python-numpy \
|
||||
net-tools \
|
||||
ffmpeg \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
#=======
|
||||
|
@ -77,6 +83,7 @@ ENV DISPLAY=:0 \
|
|||
LOCAL_PORT=5900 \
|
||||
TARGET_PORT=6080 \
|
||||
TIMEOUT=1 \
|
||||
VIDEO_PATH=/tmp/video \
|
||||
LOG_PATH=/var/log/supervisor
|
||||
|
||||
#=========================
|
||||
|
|
45
src/record.sh
Normal file
45
src/record.sh
Normal file
|
@ -0,0 +1,45 @@
|
|||
#!/bin/bash
|
||||
|
||||
function start() {
|
||||
mkdir -p $VIDEO_PATH
|
||||
sw=$(($SCREEN_WIDTH - 1))
|
||||
sh=$(($SCREEN_HEIGHT - 1))
|
||||
name="$DEVICE-$BROWSER-$(date '+%d/%m/%Y-%H:%M:%S')"
|
||||
echo "Start video recording"
|
||||
ffmpeg -video_size $swx$sh -framerate 15 -f x11grab -i ${DISPLAY} $VIDEO_PATH/$name -y
|
||||
}
|
||||
|
||||
function stop() {
|
||||
echo "Stop video recording"
|
||||
kill $(ps -ef | grep ffmpeg)
|
||||
}
|
||||
|
||||
function auto_record() {
|
||||
if [ ! -z $AUTO_RECORD ]; then
|
||||
if [ ${AUTO_RECORD,,} = true ]; then
|
||||
echo "Auto recording is enable. It will record the video automatically as soon as appium receive test scenario!"
|
||||
|
||||
# Check if there is test running
|
||||
no_test=true
|
||||
while $no_test; do
|
||||
task=$(curl -s localhost:4723/wd/hub/sessions | jq -r '.value')
|
||||
if [ -n "$task" ]; then
|
||||
sleep .5
|
||||
else
|
||||
no_test=false
|
||||
start
|
||||
fi
|
||||
done
|
||||
|
||||
# Check if test is finished
|
||||
while [ $no_test = false ]; do
|
||||
task=$(curl -s localhost:4723/wd/hub/sessions | jq -r '.value')
|
||||
if [ -n "$task" ]; then
|
||||
stop
|
||||
else
|
||||
sleep .5
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
}
|
|
@ -48,3 +48,10 @@ autorestart=false
|
|||
stdout_logfile=%(ENV_LOG_PATH)s/docker-android.stdout.log
|
||||
stderr_logfile=%(ENV_LOG_PATH)s/docker-android.stderr.log
|
||||
priority=4
|
||||
|
||||
[program:auto-recording]
|
||||
command=./src/record.sh
|
||||
autorestart=false
|
||||
stdout_logfile=%(ENV_LOG_PATH)s/video-recording.stdout.log
|
||||
stderr_logfile=%(ENV_LOG_PATH)s/video-recording.stderr.log
|
||||
priority=4
|
||||
|
|
Loading…
Reference in a new issue