-
Notifications
You must be signed in to change notification settings - Fork 3
/
RunTests.sh
72 lines (48 loc) · 1.54 KB
/
RunTests.sh
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
67
68
69
70
71
#!/bin/bash
kill $(ps aux | grep 'IntelliJ' | awk '{print $2}')
kill $(ps aux | grep 'Xcode' | awk '{print $2}')
sleep 3s
### Part 1 (IntellJ IDEA)
echo "Starting IntelliJ IDEA"
/Applications/IntelliJ\ IDEA.app/Contents/MacOS/idea &
sleep 40s
osascript <<EOD
tell application "System Events"
key code 36 #Enter (if the project does not open)
end tell
EOD
echo "IntelliJ IDEA has been opened"
### Part 2 (Appium Session)
echo "Starting Appium Session"
appium --session-override &
### Part 3 (Xcode)
echo "Starting Xcode"
open /Users/admin/Downloads/WebDriverAgent-master/WebDriverAgent.xcodeproj
sleep 10s
osascript <<EOD
tell application "Xcode"
activate
end tell
tell application "System Events"
click menu bar item "Product" of menu bar 1 of application process "Xcode"
click menu item "Destination" of menu "Product" of menu bar item "Product" of menu bar 1 of application process "Xcode"
key code 125 #Down Key
key code 125
key code 36
click menu bar item "Product" of menu bar 1 of application process "Xcode"
click menu item "Test" of menu "Product" of menu bar item "Product" of menu bar 1 of application process "Xcode"
end tell
EOD
echo "Xcode has been opened"
### Part 4 (Focus to IntelliJ IDEA -> Start tests)
sleep 10s
osascript <<EOD
tell application "IntelliJ IDEA"
activate
end tell
tell application "System Events"
click menu bar item "Run" of menu bar 1 of application process "IntelliJ IDEA"
key code 125
key code 36
end tell
EOD