From 0ba8f875914f91dae76d83feaa37afdaf72c49a7 Mon Sep 17 00:00:00 2001 From: Pierre GRANDIN Date: Thu, 23 Feb 2017 07:12:57 -0800 Subject: Add:CI:Add basic UI tests (#197) * Ensures that navit has time to start before starting tests * Adding basic UI town search tests * Add pointer icon when clicking via CI * Fetch zlib from github, reduces download issues * Download a sample map for UI tests * Start navit in the background * Fixed Demo vehicle activation * Set a destination for UI tests * UI tests to switch to 3d view * Capture image when clicking for UI tests * Append 5 frames of usage to the UI tests * Use keyboard instead of mouse emulation for UI tests * Temporarily disabling dbus test because of issues in circleCI --- ci/pointer-64.png | Bin 0 -> 1733 bytes ci/run_linux_tests.sh | 17 ++++++++-- ci/xdotools.sh | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 100 insertions(+), 3 deletions(-) create mode 100644 ci/pointer-64.png create mode 100644 ci/xdotools.sh diff --git a/ci/pointer-64.png b/ci/pointer-64.png new file mode 100644 index 000000000..904f6878d Binary files /dev/null and b/ci/pointer-64.png differ diff --git a/ci/run_linux_tests.sh b/ci/run_linux_tests.sh index 0897ec4e4..3db760962 100644 --- a/ci/run_linux_tests.sh +++ b/ci/run_linux_tests.sh @@ -4,15 +4,26 @@ set -e pushd ~/linux-bin/navit/ sed -i -e 's@name="Local GPS" profilename="car" enabled="yes" active="1"@name="Local GPS" profilename="car" enabled="no" active="0"@' navit.xml -sed -i -e 's@name="Demo" profilename="car" enabled="no" active="yes"@name="Demo" profilename="car" enabled="yes" active="yes" follow="1" refresh="1"@' navit.xml +sed -i -e 's@name="Demo" profilename="car" enabled="no" @name="Demo" profilename="car" enabled="yes" follow="1" refresh="1"@' navit.xml sed -i -e 's@type="internal" enabled@type="internal" fullscreen="1" font_size="350" enabled@' navit.xml sed -i -e 's@libbinding_dbus.so" active="no"@libbinding_dbus.so" active="yes"@' navit.xml -./navit & +cat > maps/berkeley.xml << EOF + +EOF +wget http://sd-55475.dedibox.fr/berkeley.bin -O maps/berkeley.bin + +mkdir $CIRCLE_ARTIFACTS/logs + +./navit >$CIRCLE_ARTIFACTS/logs/stdout.txt 2>$CIRCLE_ARTIFACTS/logs/stderr.txt & pid=$! +sleep 5 + import -window root $CIRCLE_ARTIFACTS/default.png +bash ~/navit/ci/xdotools.sh + # python ~/navit/ci/dbus_tests.py $CIRCLE_TEST_REPORTS/ -# + # dbus-send --print-reply --session --dest=org.navit_project.navit /org/navit_project/navit/default_navit org.navit_project.navit.navit.quit diff --git a/ci/xdotools.sh b/ci/xdotools.sh new file mode 100644 index 000000000..6c29c696d --- /dev/null +++ b/ci/xdotools.sh @@ -0,0 +1,86 @@ +sudo apt-get install xdotool +# Use xinput test 4 when running x11vnc on the circleci server to find mouse coordinates + +[ -d $CIRCLE_ARTIFACTS/frames/ ] || mkdir $CIRCLE_ARTIFACTS/frames/ + +event=0 + +send_event (){ + file=`printf "%05d\n" $event` + + import -window root $CIRCLE_ARTIFACTS/frames/tmp.png + if [[ "$1" == "mousemove" ]]; then + composite -gravity NorthWest -geometry +$2+$3 ~/navit/ci/pointer-64.png $CIRCLE_ARTIFACTS/frames/tmp.png $CIRCLE_ARTIFACTS/frames/${file}.png + else + mv $CIRCLE_ARTIFACTS/frames/tmp.png $CIRCLE_ARTIFACTS/frames/${file}.png + fi + event=$((event+1)) + xdotool $@ + sleep 1 +} + + +# Center the view +send_event key KP_Enter # Open main menu +send_event key Down # Select 'Actions' +send_event key KP_Enter # Validate +send_event key Down # Scroll to 'Bookmarks' +send_event key Right # Scroll to 'Former destinations' +send_event key Right # Select 'Town' +send_event key KP_Enter # Validate +# Send 'Berk' +send_event key b +send_event key e +send_event key r +send_event key k +send_event key Down # Highlight search area +send_event key Down # Highlight first result +send_event key KP_Enter # Validate + +# Set the position +send_event mousemove 482 318 click 1 # Open main menu, clicking on a somewhat random position on the map +send_event key Down # Select 'Actions' +send_event key KP_Enter # Validate +send_event key Down # Scroll to 'Bookmarks' +send_event key Right # Scroll to 'Former destinations' +send_event key Right # Select current coordinates +send_event key KP_Enter # Validate + +# Set a destination +send_event key KP_Enter # Open main menu +send_event key Down # Select 'Actions' +send_event key KP_Enter # Validate +send_event key Down # Scroll to 'Bookmarks' +send_event key Right # Scroll to 'Former destinations' +send_event key Right # Select 'Town' +send_event key KP_Enter # Validate +# Send 'oakl' +send_event key o +send_event key a +send_event key k +send_event key l +send_event key Down # Highlight search area +send_event key Down # Highlight first result +send_event key KP_Enter # Validate + +# Switch to 3d view +send_event key KP_Enter # Open main menu +send_event key Down # Select 'Actions' +send_event key Right # Select 'Settings' +send_event key KP_Enter # Validate +send_event key Down # Select 'Display' +send_event key KP_Enter # Validate +send_event key Down # Scroll to 'Layout' +send_event key Right # Scroll to 'Fullscreen' +send_event key Right # Select '3d' +send_event key KP_Enter # Validate +# Send 'Berk' + +# capture 5 seconds of usage +for i in `seq 99994 99999`; do + import -window root $CIRCLE_ARTIFACTS/frames/${i}.png + sleep 1 +done + +# Assemble the gif +convert -delay 100 -loop 0 $CIRCLE_ARTIFACTS/frames/*.png $CIRCLE_ARTIFACTS/town_search.gif -- cgit v1.2.1