forked from Vieira-zj/zj_macaca_project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-test.sh
executable file
·214 lines (173 loc) · 5.21 KB
/
run-test.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
#!/bin/bash
set -x
target=""
default="test-desktop-chrome-single-custom"
# run mocha test
if [ "$1" == "mo" ]; then
target="test-mocha-default"
# run macaca single test case
elif [ "$1" == "ma" ]; then
target=${default}
# run all macaca test cases in specified folder
elif [ "$1" == "all" ]; then
target="test-desktop-chrome-all-custom"
else
target=${default}
fi
echo "run target: ${target}"
# make ${target}
# Mocha cli:
# https://mochajs.org/
mocha_bin="./node_modules/.bin/mocha"
# ${mocha_bin} -h
# ${mocha_bin} -V
# -R, --reporter: specify the reporter to use.
# -u, --ui: specify user-interface (bdd|tdd|qunit|exports).
# ${mocha_bin} --opts mocha.opts -R list -u tdd -g "part 2"
# ${mocha_bin} --opts mocha.opts --grep "part 3"
# Macaca cli:
# https://macacajs.github.io/quick-start
# macaca run -h
# test="./macaca-test-web/desktop-browser-sample.test.js"
# CHROMEDRIVER_VERSION=2.35 BROWSER_CLOSE=true browser=chrome macaca run -d ${test}
# run macaca chrome tests by mocha cmd
# pre-condition: start server => "$ CHROMEDRIVER_VERSION=2.35 macaca server --verbose"
# chrome_test="./macaca-test-web/chrome_demo_01.test.js"
# CHROMEDRIVER_VERSION=2.35 BROWSER_CLOSE=true browser=chrome ${mocha_bin} ${chrome_test} -g "#01-01" -R list
# run macaca andorid tests by mocha cmd
# env setup: $ cnpm i macaca-android -g
# for dependency apks:
# /usr/local/lib/node_modules/macaca-android/node_modules/uiautomatorwd/scripts/build.js
android_test="./macaca-test-mobile/mobile-app-sample.test.js"
platform=android ${mocha_bin} ${android_test} --reporter macaca-reporter --colors -g "#01"
# SHELL SCRIPT SAMPELS
# #1, variable
# str="hello wrold"
# echo "the source string is "${str}
# echo "the string length is "${#str}
# echo "the 6th to last string is "${str:5}
# echo "the 6th to 8th string is "${str:5:2}
# #2, conditions, file test
# echo "Please input a filename: "
# read filename
# echo "by test\n"
# test -f $filename && echo "the file is ordinary file" || echo "the file is not ordinary file"
# test -d $filename && echo "the file is document folder" || echo "the file is not document folder"
# test -r $filename && echo "the file can read" || echo "the file can not read"
# test -w $filename && echo "the file can write" || echo "the file can not write"
# test -x $filename && echo "the file can executable" || echo "the file can not executable"
# echo "by []\n"
# [ -f $filename ] && echo "the file is ordinary file" || echo "the file is not ordinary file"
# [ -d $filename ] && echo "the file is document folder" || echo "the file is not document folder"
# [ -r $filename ] && echo "the file can read" || echo "the file can not read"
# [ -w $filename ] && echo "the file can write" || echo "the file can not write"
# [ -x $filename ] && echo "the file can executable" || echo "the file can not executable"
# #3, conditions, number test
# echo "Please input two numbers:"
# read num1
# read num2
# echo "num1 = "${num1}
# echo "num2 = "${num2}
# echo "by test\n"
# test $num1 -eq $num2 && echo "num1 == num2" || echo "num1 != num2"
# test $num1 -ne $num2 && echo "num1 != num2" || echo "num1 == num2"
# test $num1 -gt $num2 && echo "num1 > num2" || echo "num1 <= num2"
# test $num1 -lt $num2 && echo "num1 < num2" || echo "num1 >= num2"
# test $num1 -ge $num2 && echo "num1 >= num2" || echo "num1 < num2"
# test $num1 -le $num2 && echo "num1 <= num2" || echo "num1 > num2"
# #4, conditions, if
# echo "Please input a filename"
# read filename
# if [ -f $filename ];then
# echo "this file is a ordinary file."
# else
# echo "this file is not a ordinary file."
# fi
# #5, conditions, if
# echo "Please input your math grades"
# read grades
# if [ $grades -gt 100 ] || [ $grades -lt 0 ];then
# echo "Please input the number range in 0 - 100"
# fi
# if [ $grades -ge 90 ] && [ $grades -le 100 ];then
# echo "Your grade is excellent."
# elif [ $grades -ge 80 ] && [ $grades -le 89 ];then
# echo "Your grade is good."
# elif [ $grades -ge 70 ] && [ $grades -le 79 ];then
# echo "Your grade is middle."
# elif [ $grades -ge 60 ] && [ $grades -le 69 ];then
# echo "Your grade is passing."
# else
# echo "Your grade is badly."
# fi
# #6,loop, while
# echo "run file: "$0
# # 6-1
# i=$1
# i=${i:=3} # set default value
# while test $i -gt 0
# do
# echo $i
# ((i--))
# done
# #6-2
# i=$1
# while ((i>0))
# do
# echo $i
# ((i--))
# done
# #7, loop, for in
# for i in `seq 2 8`
# do
# echo $i
# done
# echo 'node version: '`node -v`
# #8, expr
# a=1
# b="str"
# echo $((a>1?8:9))
# ((b!="a")) && echo "str not equal"
# #9, expr
# num=10
# total=0
# for ((i=0;i<=num;i++))
# do
# ((total+=i))
# done
# echo 'total: '${total}
# #10
# name='zheng jin'
# echo 'hello ${name}' # print string
# echo "hello ${name}" # print varibale
# #11, reg expr
# strlist='testcheck dabletest checktest'
# for str in $strlist
# do
# # if [[ $str =~ test$ ]]
# if [[ ! $str =~ check$ ]]
# then
# echo $str
# fi
# done
# #12, function
# function fSum()
# {
# echo "args: $1,$2"
# return $(($1+$2))
# }
# fSum 5 7
# echo "results: $?"
# function cpBackup() {
# if [ -f $1 ];then
# cp $1 ~/Documents/zj_files_backups/
# echo "copied success"
# return 0
# else
# echo "invalid file: $1"
# return -1
# fi
# }
# cpBackup ~/Documents/vim_test.log
# echo "results: $?"
set +x