aboutsummaryrefslogtreecommitdiff
path: root/robot/robot-test.sh
blob: c27b94bb5cb9a4273c51125210b20d52abf64aa1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash

set -e

function run_drill {
    ## Org-drill should be running at this point, so give three answers
    ## with a score of file
    sleep 1
    echo answer one
    #xdotool type --window $window_id answer
    xdotool key --window $window_id Return
    sleep 0.25
    xdotool key --window $window_id 5
    sleep 0.25


    echo answer two
    #xdotool type --window $window_id answer
    xdotool key --window $window_id Return
    sleep 0.25
    xdotool key --window $window_id 5
    sleep 0.25

    echo answer three
    #xdotool type --window $window_id answer
    xdotool key --window $window_id Return
    sleep 0.25
    xdotool key --window $window_id 5
    sleep 0.25

    ## Press any key to continue
    echo press any key to continue
    xdotool key --window $window_id Return
    sleep 0.25

    echo Save file
    xdotool key --window $window_id y
}

function kill_emacs {
    echo Goodnight Emacs
    xdotool key --window $window_id alt+x
    xdotool type --window $window_id kill-emacs
    xdotool key --window $window_id KP_Enter
}

$EMACS -Q -l ./robot/org-drill-launch.el &

{
    sleep 2

    window_id=`xdotool search --name "emacs-bot"`
    if [ -z "$window_id" ]
    then
        echo "Could not find window ID for Emacs-bot"
        exit 1
    fi

    ## Run once with default options
    run_drill

    ## Run once with presentation-prompt-with-typing
    run_drill

    kill_emacs
} || cat robot/failure.txt