summaryrefslogtreecommitdiff
path: root/automated/linux/ui-browser-test/ui-browser-test.sh
diff options
context:
space:
mode:
authorNaresh Kamboju <naresh.kamboju@linaro.org>2016-08-17 17:11:30 +0530
committerNaresh Kamboju <naresh.kamboju@linaro.org>2016-09-06 14:44:41 +0530
commitf88f4d732720599b4bf2fcadcb70203994c019b0 (patch)
tree9bbb74c511f9430c470c534855d03ae74ae54b85 /automated/linux/ui-browser-test/ui-browser-test.sh
parentfaf7d2820ef33bb47d81ec9bccd19353188bfdb5 (diff)
ui-browser-test: Adding UI browser testing
Ui browser test developed on top of Robot frame work. Test runs chromium, chrome and firefox test cases. On LAVA we have access to serial console and we have to run ui tests from this serial console, this is possible by changing user from root to linaro and exporting the DISPLAY=:0. because linaro owns the X display process. Change-Id: I43bda407f468120839b0a4c8248777303945529e Signed-off-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Diffstat (limited to 'automated/linux/ui-browser-test/ui-browser-test.sh')
-rwxr-xr-xautomated/linux/ui-browser-test/ui-browser-test.sh81
1 files changed, 81 insertions, 0 deletions
diff --git a/automated/linux/ui-browser-test/ui-browser-test.sh b/automated/linux/ui-browser-test/ui-browser-test.sh
new file mode 100755
index 0000000..9d7b377
--- /dev/null
+++ b/automated/linux/ui-browser-test/ui-browser-test.sh
@@ -0,0 +1,81 @@
+#!/bin/bash
+#
+# ui browser tests by using Robot framework
+#
+# Copyright (C) 2016 Linaro Limited
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Author: Naresh Kamboju <naresh.kamboju@linaro.org>
+
+set -eu
+. ../../lib/sh-test-lib
+WD="$(pwd)"
+OUTPUT="$(pwd)/output"
+RESULT_FILE="${OUTPUT}/ui-browser-test-results.txt"
+UI_BROWSER_TEST_OUTPUT="ui-browser-test-output"
+
+usage()
+{
+ echo "Usage: $0 [-u username] [-s <true|false>]" 1>&2
+ echo "the user should own X process and DISPLAY=:0"
+ exit 1
+}
+
+
+while getopts "s:u:" o; do
+ case "$o" in
+ # Skip package installation
+ s) SKIP_INSTALL="${OPTARG}" ;;
+ # Default user is linaro
+ u) TESTUSER="${OPTARG}" && id "${TESTUSER}" ;;
+ *) usage ;;
+ esac
+done
+
+if [ $# -ne 4 ]; then
+ usage
+fi
+
+
+# Test run.
+! check_root && error_msg "This script must be run as root"
+pkgs="python2.7 python-pip python-lxml"
+install_deps "${pkgs}" "${SKIP_INSTALL}"
+
+[ -d "${OUTPUT}" ] && mv "${OUTPUT}" "${OUTPUT}_$(date +%Y%m%d%H%M%S)"
+mkdir -p "${OUTPUT}"
+
+dist_name
+if [ "${dist}" = "Debian" ] || [ "${dist}" = "Ubuntu" ]; then
+ "${WD}"/install-on-debian.sh
+else
+ echo "Not a debian machine"
+fi
+
+# Copy robot test scripts to /tmp
+cp -a robot-test-scripts /tmp/
+# Tests should runs by linaro users because X owned by linaro user.
+# linaro user can not create output files in /root
+# so change directory to /tmp
+cd /tmp
+# Run as TESTUSER
+su "${TESTUSER}" -c "${WD}"/run-robot-tests.sh
+# "${UI_BROWSER_TEST_OUTPUT}" directory created by TESTUSER from run-robot-tests.sh
+mv "${UI_BROWSER_TEST_OUTPUT}" "${OUTPUT}"
+mv robot-test-scripts "${OUTPUT}"
+# Parse test results
+python "${WD}"/robot-results-parser.py "${OUTPUT}"/"${UI_BROWSER_TEST_OUTPUT}"/output.xml >> "${RESULT_FILE}"
+cd -