Updated documentation / scripts / compiled selenium scripts.
[mediagoblin-automation:mediagoblin-selenium.git] / scripts / runtests.sh
1 #!/bin/bash
2
3 # GNU MediaGoblin Selenium Automation
4 # Copyright (C) 2013 Emily O'Leary
5 #
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU Affero General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU Affero General Public License for more details.
15 #
16 # You should have received a copy of the GNU Affero General Public License
17 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
19 basedir=${PWD}
20 cd mediagoblin
21 tflag=0
22 while getopts tests: name
23 do
24     case $name in
25     branch) tflag=1
26             testdir="$OPTARG";;
27     ?)      echo "Usage: $0: [-tests value]"
28             exit 2;;
29     esac
30 done
31
32 if [ -x "$basedir/mediagoblin/bin/py.test" ]; then
33     export PYTEST="$basedir/mediagoblin/bin/py.test";
34     echo "Using $PYTEST";
35 elif which py.test > /dev/null; then
36     echo "Using py.test from \$PATH";
37     export PYTEST="py.test";
38 else
39     echo "py.test not found.  X_X";
40     echo "Please install 'py.test'.  Exiting.";
41     exit 1
42 fi
43
44 $basedir/mediagoblin/lazyserver.sh&
45
46 sleep 5s
47
48 if [ $tflag -ne 1 ]
49 then
50   testdir="$basedir/tests"
51 fi
52 rm $basedir/run/*.py
53
54 for f in $testdir/*.py
55 do
56     m4 -DWORKING_DIRECTORY="$basedir" $f > $basedir/run/$(basename "$f")
57 done
58 set -x
59 exec "$PYTEST" "$basedir/run" --boxed