aboutsummaryrefslogtreecommitdiff
path: root/robot/robot.sh
diff options
context:
space:
mode:
authorPhillip Lord <phillip.lord@russet.org.uk>2019-06-16 20:21:31 +0100
committerPhillip Lord <phillip.lord@russet.org.uk>2019-06-16 20:21:31 +0100
commit50885fbeea8a282dc027b03b19097de3c6dabd18 (patch)
tree68462f789bb9e339c48d061dad578f6569a3b879 /robot/robot.sh
parenta923ba2c90ebb5e7fd66b29f6a3af7fd12b6b9f4 (diff)
downloadorg-drill-50885fbeea8a282dc027b03b19097de3c6dabd18.tar.gz
org-drill-50885fbeea8a282dc027b03b19097de3c6dabd18.zip
Refactor robot testing to allow multiple tests
Diffstat (limited to 'robot/robot.sh')
-rw-r--r--robot/robot.sh20
1 files changed, 17 insertions, 3 deletions
diff --git a/robot/robot.sh b/robot/robot.sh
index e013308..022b567 100644
--- a/robot/robot.sh
+++ b/robot/robot.sh
@@ -1,5 +1,7 @@
#!/bin/bash
+set -e
+
## call find_bot to init this
window_id=
@@ -8,6 +10,8 @@ window_id=
small_sleep=0.25
big_sleep=1
+emacs_process_pid=
+
function sleep_small {
sleep $small_sleep
}
@@ -26,6 +30,7 @@ function send_answer {
function launch_emacs {
echo Launching $EMACS -Q -l $1 &
$EMACS -Q -l $1 &
+ emacs_process_pid=$!
}
function kill_emacs {
@@ -34,16 +39,25 @@ function kill_emacs {
retn
}
+function xdo {
+ xdotool $1 --window $window_id $2 || {
+ echo "Failed command: $1, $2";exit 1
+ }
+}
function key {
- xdotool key --window $window_id $1
+ xdo key $1
}
function command {
- xdotool type --window $window_id $1
+ xdo type $1
}
function retn {
- xdotool key --window $window_id Return
+ key Return
+}
+
+function wait_emacs {
+ wait $emacs_process_pid
}
function find_bot {