Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6302de6bc4 | ||
|
|
1e1c60fc89 | ||
|
|
2a12e66077 | ||
|
|
f2a418d712 | ||
|
|
44dcc5b166 | ||
|
|
2e88c06124 | ||
|
|
6b34c74a25 | ||
|
|
1fc2c74d8c | ||
|
|
ffbafe87e8 | ||
|
|
62fa6a05c8 | ||
|
|
77542f5b45 | ||
|
|
39df955c26 | ||
|
|
8da596a8f1 | ||
|
|
7f55b248fd | ||
|
|
c434ae7770 | ||
|
|
ff9f9268e3 | ||
|
|
27e95cd197 | ||
|
|
1f1224599e | ||
|
|
846cd2ed09 | ||
|
|
b5fbe9777e | ||
|
|
21ffb20ca6 | ||
|
|
c0368d3d71 | ||
|
|
6e5ed8386a | ||
|
|
602dcf15a7 | ||
|
|
1dd79c6188 | ||
|
|
7abe6c19d8 | ||
|
|
eb91462bd4 | ||
|
|
ac251e7704 | ||
|
|
b997803064 | ||
|
|
88dbde577e | ||
|
|
a51e451a1f | ||
|
|
0f8d8eb98b | ||
|
|
97b3ca2c28 | ||
|
|
7b599fe7ea | ||
|
|
34846cd059 | ||
|
|
8df9081573 | ||
|
|
9f0c0dcfd2 | ||
|
|
e8186fb6bf | ||
|
|
f33fc1906c | ||
|
|
be3150f39f | ||
|
|
5688826f1a | ||
|
|
7064a9bc2c | ||
|
|
4e44e68946 | ||
|
|
2cb2bd6256 | ||
|
|
3af8eb3f48 | ||
|
|
55a628a673 | ||
|
|
667787bada | ||
|
|
cc5806bf71 | ||
|
|
db58150cf8 | ||
|
|
26206e43bd | ||
|
|
a0851223da | ||
|
|
1b05bfafdc | ||
|
|
e1ff20db98 | ||
|
|
df2dfbf6e1 | ||
|
|
03a6754869 | ||
|
|
99efbd21a5 | ||
|
|
05d3622c64 | ||
|
|
232ed8bbe6 | ||
|
|
20b1c6f71b | ||
|
|
4417553044 | ||
|
|
050144f8da | ||
|
|
5b25d2fb79 | ||
|
|
b5aa9c1290 | ||
|
|
7e8a082936 | ||
|
|
0eb43bee45 | ||
|
|
0702f34bd3 | ||
|
|
fbd31b9076 | ||
|
|
40864137ee | ||
|
|
c5cce78990 | ||
|
|
5002255cd8 | ||
|
|
f570984135 | ||
|
|
80e22c2b1c | ||
|
|
064e9c4f37 | ||
|
|
7db92991ab | ||
|
|
47eafe24e1 | ||
|
|
8875d83305 | ||
|
|
984f5ed69e | ||
|
|
a02375de57 | ||
|
|
cebf34d8ae | ||
|
|
6da341bf6b | ||
|
|
5f1ea4c1e5 | ||
|
|
b35f538bf3 | ||
|
|
67321bdac7 | ||
|
|
baefa67e3f | ||
|
|
58f64cd2ee | ||
|
|
2b56bab0bc | ||
|
|
05ce63f360 | ||
|
|
fd4089d98e | ||
|
|
363fc77b87 | ||
|
|
b9f02023b4 | ||
|
|
cabad42452 | ||
|
|
deb9180bc7 | ||
|
|
9d85ad345e | ||
|
|
9d3f37ca0c | ||
|
|
8cd6bfb3ef | ||
|
|
4f0ddc972a | ||
|
|
703c1216cf | ||
|
|
0ecc00587e | ||
|
|
d69e7c7dd0 | ||
|
|
8f15a2845f | ||
|
|
9cee77998f | ||
|
|
13bd9611d7 | ||
|
|
9d5ab2dbe1 | ||
|
|
9a5f560a73 | ||
|
|
c1538606d2 | ||
|
|
e706fedd12 | ||
|
|
4eb85fbf28 | ||
|
|
64b922c734 | ||
|
|
c8ec687300 | ||
|
|
4feb3a1c08 | ||
|
|
cb87d43aab | ||
|
|
d4e7a95a8c | ||
|
|
72418957d5 | ||
|
|
725138794b | ||
|
|
92a5487df3 | ||
|
|
0a026decdc | ||
|
|
01d12a2263 | ||
|
|
92a406e3ba | ||
|
|
56c8deedd2 | ||
|
|
7a4933c63a | ||
|
|
e268a43141 | ||
|
|
87bebdf4ea | ||
|
|
52642214ed | ||
|
|
f0985a3898 | ||
|
|
b082c0545f | ||
|
|
6625803431 | ||
|
|
6918f1519f | ||
|
|
92c655cad2 | ||
|
|
9ad0f32d93 | ||
|
|
e77bb73077 | ||
|
|
6e9d4767f6 | ||
|
|
77f1be5bdd | ||
|
|
11279d2595 | ||
|
|
b600346ab6 | ||
|
|
f727ee0667 | ||
|
|
fe61c99eff | ||
|
|
2ac43ba4cb | ||
|
|
0591667c0b | ||
|
|
af1c18856a | ||
|
|
28c71e2b65 | ||
|
|
ea2f387203 | ||
|
|
a365368044 | ||
|
|
0fe711f563 | ||
|
|
e00e0dd54e | ||
|
|
6bc9081847 | ||
|
|
9ad2a1e73e | ||
|
|
6767970307 | ||
|
|
abcdf3f4d1 | ||
|
|
69c0bbd120 | ||
|
|
1d192c85e0 | ||
|
|
fcb6a21d00 | ||
|
|
aedb5f9ce8 | ||
|
|
d436eb36c1 | ||
|
|
3ea820cd99 | ||
|
|
e642adcaad | ||
|
|
b49e96cf93 | ||
|
|
9346afc2da | ||
|
|
607f9de6b4 | ||
|
|
6be44c92d3 | ||
|
|
d58eb73294 | ||
|
|
2756b7febc | ||
|
|
ee5630f893 | ||
|
|
a72a5d1edc | ||
|
|
9f58ad6bda | ||
|
|
94a3f40ac6 | ||
|
|
e340223c8c | ||
|
|
77488aea7f | ||
|
|
8f1c4bf1ca | ||
|
|
cd63313358 | ||
|
|
d0f9534e3d | ||
|
|
7b6bc3fe3e | ||
|
|
1f1d4ccf49 | ||
|
|
8278a3f6ef | ||
|
|
92ea480e55 | ||
|
|
0188131350 | ||
|
|
371a57c663 | ||
|
|
6d4de35602 | ||
|
|
51158d8630 | ||
|
|
3a7cba3dc9 | ||
|
|
4bb9f044ed | ||
|
|
0e35dab27f | ||
|
|
14a98aea88 | ||
|
|
337aaf5103 | ||
|
|
f5e86d5806 | ||
|
|
caf2cb2cd8 | ||
|
|
03f2ea256a | ||
|
|
af2d302bbc | ||
|
|
b6752ea535 | ||
|
|
06a8e83922 | ||
|
|
a7e7eaa5aa | ||
|
|
d2c82d05c7 | ||
|
|
79d36e1536 | ||
|
|
90ff1782ae | ||
|
|
92e4933521 | ||
|
|
4f9469db55 | ||
|
|
cc409b9914 | ||
|
|
4cc5a36c32 | ||
|
|
ed77303a16 | ||
|
|
5696fe3ea0 | ||
|
|
b39a8784b7 | ||
|
|
fcb1f2ec31 | ||
|
|
49113f2cb4 | ||
|
|
0a8b7c07a2 | ||
|
|
49b9c44f3a | ||
|
|
15cddf08c4 | ||
|
|
71949ee857 | ||
|
|
d0e3c619ca | ||
|
|
8dc87a3a3c | ||
|
|
76617374c0 | ||
|
|
70fc3b411c | ||
|
|
5e7ce8ce66 | ||
|
|
1d7121c41b | ||
|
|
0a1758091f | ||
|
|
eb045aa644 | ||
|
|
e5a9fe7031 | ||
|
|
fdb464781a | ||
|
|
2e5237ec80 | ||
|
|
b1f9ec5e79 | ||
|
|
1ac4a6484e | ||
|
|
f09e38c92c | ||
|
|
e051faf84a | ||
|
|
2461a6e832 | ||
|
|
20120f5c0a | ||
|
|
6a0f135247 | ||
|
|
b36847817d | ||
|
|
0196d23103 | ||
|
|
01d1c663c1 | ||
|
|
5b8ef77bba | ||
|
|
3b3746fff3 | ||
|
|
d9ba33c9fa | ||
|
|
94132acf41 | ||
|
|
86e7e0f8e5 | ||
|
|
77a1216730 | ||
|
|
56e01002da | ||
|
|
287378162f | ||
|
|
8affae0fa1 | ||
|
|
ca28b7ad10 | ||
|
|
edebdfd380 | ||
|
|
ddf0a451c9 | ||
|
|
fcc439b938 | ||
|
|
68ac0c42ce | ||
|
|
666d3eaee6 | ||
|
|
ecfaf236b9 | ||
|
|
a5714c805d | ||
|
|
9eb4b3c595 | ||
|
|
0389f64365 | ||
|
|
ba476eb993 | ||
|
|
9b2bc985e0 | ||
|
|
1a9b9361e6 | ||
|
|
abdb45ea0b | ||
|
|
b9d6237eb4 | ||
|
|
5936037a56 | ||
|
|
0460a62956 | ||
|
|
6403ff78be | ||
|
|
7ad2eb45c8 | ||
|
|
ea5661fa41 | ||
|
|
f323d29aa4 | ||
|
|
eec0c5df02 | ||
|
|
b66c5d122a | ||
|
|
8289bc166f | ||
|
|
d1e9f7472b | ||
|
|
a22152fd4d | ||
|
|
83dcca4b8c | ||
|
|
a38691b5e2 | ||
|
|
ad696f84bf | ||
|
|
b4d8241422 | ||
|
|
feab383008 | ||
|
|
d097c08789 | ||
|
|
f5978bab45 | ||
|
|
6e953ab74b | ||
|
|
9794270552 | ||
|
|
ba5f76116b | ||
|
|
e56975ec49 | ||
|
|
2fa8734ac5 | ||
|
|
8337e63a53 | ||
|
|
ee9c3e3635 | ||
|
|
d8ac737d00 | ||
|
|
d6a582ae20 | ||
|
|
120d80f0ab | ||
|
|
377cb04ca1 | ||
|
|
a1f83daf10 | ||
|
|
c27ab1d6d6 | ||
|
|
ca0f85b48f | ||
|
|
b1114d9b87 | ||
|
|
f5e273d05c | ||
|
|
65c139e7d2 | ||
|
|
34fa736916 | ||
|
|
b707d1971f | ||
|
|
5923820261 | ||
|
|
d9389a48c6 | ||
|
|
611a93d926 | ||
|
|
4d64ece2f9 | ||
|
|
d1126b58c2 | ||
|
|
d881cb2e06 | ||
|
|
9f0c6a595e | ||
|
|
8c09a3e169 | ||
|
|
0e1ffe9cff | ||
|
|
9adec7fcfd | ||
|
|
4de36e6568 | ||
|
|
c299582ac4 | ||
|
|
69654cd036 | ||
|
|
81f110adea | ||
|
|
068bb87ab3 | ||
|
|
d1559b6748 | ||
|
|
5c3cc8ed4d | ||
|
|
2ba73f87e0 | ||
|
|
d789139be9 | ||
|
|
b162e2ee58 | ||
|
|
42b4775e9f | ||
|
|
4213882f04 | ||
|
|
1b6bdab388 | ||
|
|
087c91922c | ||
|
|
168f51471c | ||
|
|
19e26a086b | ||
|
|
de073327af | ||
|
|
e7d684eb0a | ||
|
|
6237f452f8 | ||
|
|
cd2a7a5bcd | ||
|
|
92acd04a53 | ||
|
|
7afe1c0e54 | ||
|
|
455bf6023d | ||
|
|
ce9936b6df | ||
|
|
359551e272 | ||
|
|
c888c05572 | ||
|
|
3479738457 | ||
|
|
98a3b3d8d5 | ||
|
|
abf1d33e62 | ||
|
|
9e826e4f61 | ||
|
|
5c2045a840 | ||
|
|
aa7e88cf46 | ||
|
|
4ac0bebe99 | ||
|
|
ac9b6e9af7 | ||
|
|
65afbdeeba | ||
|
|
ed29b14c9e | ||
|
|
54cb0fc824 | ||
|
|
15375cc53b | ||
|
|
4516899786 | ||
|
|
45e7df6db3 | ||
|
|
b9a7a486e1 | ||
|
|
90642436dd | ||
|
|
ef3c4e28c0 | ||
|
|
4d4c22124f | ||
|
|
7d63eac5ae | ||
|
|
b1be8ceeab | ||
|
|
fcb89f2702 | ||
|
|
226e088390 | ||
|
|
3574b9825b | ||
|
|
d34d635114 | ||
|
|
43d38adf76 | ||
|
|
a2d3c05a1c | ||
|
|
a4c7919209 | ||
|
|
2e59c45142 | ||
|
|
664ad07905 | ||
|
|
4b7de9d645 | ||
|
|
5d1cf8e671 | ||
|
|
9441d537b7 | ||
|
|
a40acea0ba | ||
|
|
54811c0c81 | ||
|
|
893abf99e4 | ||
|
|
14b6091277 | ||
|
|
5acbce6654 | ||
|
|
1c844033f6 | ||
|
|
83ba9bb79e | ||
|
|
712d3485ad | ||
|
|
04512a0d16 | ||
|
|
cf0ebd7eb9 | ||
|
|
32cb68f6c9 | ||
|
|
98b0b3a140 | ||
|
|
2c9c421c35 | ||
|
|
afea49a2c8 | ||
|
|
442a10afd2 | ||
|
|
478e0d0e51 | ||
|
|
17d09eb835 | ||
|
|
09c3fbe765 | ||
|
|
b285d8a1da | ||
|
|
46d3a4f8c1 | ||
|
|
033be6d7c4 | ||
|
|
84ed95aac1 | ||
|
|
c298cc7ae1 | ||
|
|
0ab0eaffcf | ||
|
|
0e00cffe4d | ||
|
|
3dc73b4573 | ||
|
|
711cbfef72 | ||
|
|
67a0935fc5 | ||
|
|
55012f9ac0 | ||
|
|
2e379769e9 | ||
|
|
2ffb3a0c3d | ||
|
|
e49d2a58cb | ||
|
|
099afef2a1 | ||
|
|
67a4468b05 | ||
|
|
21306b5b08 | ||
|
|
500fff9da4 | ||
|
|
68db6315d4 | ||
|
|
2ad579c77b | ||
|
|
bc5cb96ca9 | ||
|
|
85b2312b7f | ||
|
|
b518b38c35 | ||
|
|
1ebdbc7873 | ||
|
|
b3c8cb3cce | ||
|
|
05aa522965 | ||
|
|
2a48fc6f71 | ||
|
|
fd4a5a0763 | ||
|
|
7c085db7a3 | ||
|
|
e5817ebe7d | ||
|
|
2ed92c97e1 | ||
|
|
156fc288c7 | ||
|
|
c790d05e19 | ||
|
|
78b9b79212 | ||
|
|
57ae8a1f16 | ||
|
|
fc90713016 | ||
|
|
948b5cc07b | ||
|
|
dfc86227e0 | ||
|
|
dfa70768ab | ||
|
|
a34a7e8339 | ||
|
|
e9726a86af | ||
|
|
4e5370b85b | ||
|
|
da177442ce | ||
|
|
e2800863e8 | ||
|
|
c4bd3dcf55 | ||
|
|
ac594d96e9 | ||
|
|
a49cc2950e | ||
|
|
6b657dd13e | ||
|
|
aa7a798f62 | ||
|
|
ccec2c5969 | ||
|
|
e45bc0010f | ||
|
|
efd1f07e58 | ||
|
|
73418a8b4f | ||
|
|
ad444fd738 | ||
|
|
12391277e6 | ||
|
|
c50f185c65 | ||
|
|
62090f73b4 | ||
|
|
7bce737447 | ||
|
|
f2c6ab79bb | ||
|
|
afcbd4a7e7 | ||
|
|
9a714e5fb3 | ||
|
|
a6394bcf74 | ||
|
|
43d0bb1292 | ||
|
|
e56352bf74 | ||
|
|
7746b0ce1a | ||
|
|
806443e956 | ||
|
|
a5d0e6eba2 | ||
|
|
ac9371a2ed | ||
|
|
f3abb0a828 | ||
|
|
c653efc7b1 | ||
|
|
bcd7d9a29b | ||
|
|
dd7ef41590 | ||
|
|
d7c9730712 | ||
|
|
735bc64a2d | ||
|
|
307d6502af | ||
|
|
91a4e270c6 | ||
|
|
d13e60a122 | ||
|
|
c4be3a1ac0 | ||
|
|
7c7eed4a3d | ||
|
|
d0271e0be0 | ||
|
|
9d71ecded7 | ||
|
|
81af88e7a4 | ||
|
|
a8f7fd2d02 | ||
|
|
de71e5156c | ||
|
|
bcf27f0489 | ||
|
|
972445a8bc | ||
|
|
460e0b8daf | ||
|
|
3673d195ea | ||
|
|
77c6ac8507 | ||
|
|
cd35f4a3ab | ||
|
|
217df7cd65 | ||
|
|
ccfdef4fe8 | ||
|
|
b40ec48136 | ||
|
|
064331de0e | ||
|
|
5ef52ca622 | ||
|
|
15c51a4ab1 | ||
|
|
7e2b364c08 | ||
|
|
0b18e4995c | ||
|
|
f0fb5ef009 | ||
|
|
ec0c381fb6 | ||
|
|
58f7693024 | ||
|
|
40f6e67d83 | ||
|
|
852daa4e32 | ||
|
|
bf65a73eb1 | ||
|
|
3577d7e0a1 | ||
|
|
1371744b36 | ||
|
|
cf3b1cf683 | ||
|
|
416a88143f | ||
|
|
55719bb638 | ||
|
|
c22fe34e7c | ||
|
|
69154410f2 | ||
|
|
4975ebcc47 | ||
|
|
e4180a6e65 | ||
|
|
e22b8f141e | ||
|
|
7d29525b48 | ||
|
|
f47cc495b0 | ||
|
|
bc516d5a8e | ||
|
|
b54fcd2087 | ||
|
|
7e7d12e4e8 | ||
|
|
8d9fc61158 | ||
|
|
bc5635ed0a | ||
|
|
0b7ca97939 | ||
|
|
7e0a2e4770 | ||
|
|
c82443e221 | ||
|
|
1d7b7c2ac7 | ||
|
|
59f792f7c0 | ||
|
|
84ac59f66a | ||
|
|
d176e69cc1 | ||
|
|
59f61e057e | ||
|
|
601d58c51f | ||
|
|
ac33a1f687 | ||
|
|
91ebdbf5ab | ||
|
|
c8fb92e400 | ||
|
|
80a64e82dd | ||
|
|
780278b519 | ||
|
|
b4544ae90f | ||
|
|
0af1143e72 | ||
|
|
9d0c66fb2b | ||
|
|
2b02843cfd |
@@ -0,0 +1,19 @@
|
||||
# Git
|
||||
.git/
|
||||
|
||||
# IDE
|
||||
**/*.idea
|
||||
backup
|
||||
|
||||
# Python
|
||||
**/*.egg-info
|
||||
**/*.pyc
|
||||
**/__pycache__
|
||||
**/venv
|
||||
|
||||
# Unit Test
|
||||
**/.coverage
|
||||
**/coverage.xml
|
||||
**/xunit.xml
|
||||
**/coverage
|
||||
tmp/
|
||||
@@ -1 +0,0 @@
|
||||
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
||||
@@ -0,0 +1,3 @@
|
||||
github: [budtmo]
|
||||
custom:
|
||||
- "paypal.me/budtmo"
|
||||
@@ -1,22 +0,0 @@
|
||||
**Please make sure that it is an issue / a feature request. If it is a question / help wanted, please visit [our group chat](https://gitter.im/butomo1989/docker-android). Thank you!**
|
||||
|
||||
Operating System:
|
||||
<!-- OSX Yosemite, Ubuntu 16.04, Windows 10 etc -->
|
||||
|
||||
Docker Image:
|
||||
<!-- butomo1989/docker-android-x86-7.1.1, butomo1989/docker-android-real-device etc -->
|
||||
|
||||
Docker Version:
|
||||
<!-- 17.09.0-ce, 17.06.2-ce etc -->
|
||||
|
||||
Docker-compose version (Only if you use it):
|
||||
<!-- 1.16.1 etc -->
|
||||
|
||||
Docker Command to start docker-android:
|
||||
<!-- docker run ... -->
|
||||
|
||||
## Expected Behavior
|
||||
<!-- Explaination about expected behaviour goes here -->
|
||||
|
||||
## Actual Behavior
|
||||
<!-- Explaination about actual behaviour goes here -->
|
||||
@@ -0,0 +1,45 @@
|
||||
name: 🐛 Bug Report
|
||||
description: File a bug report
|
||||
title: "[🐛 Bug ]: "
|
||||
labels: [bug]
|
||||
body:
|
||||
- type: input
|
||||
id: operating-system
|
||||
attributes:
|
||||
label: Operating System
|
||||
description: Which host operating system do you use?
|
||||
placeholder: e.g. OSX Yosemite / Ubuntu 20.04 / Windows 10 etc
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: docker-image
|
||||
attributes:
|
||||
label: Docker Image
|
||||
description: Which docker image do you use?
|
||||
placeholder: e.g. budtmo/docker-android:emulator_10.0_v2.0 / budtmo/docker-android:genymotion_v2.0 etc
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: expected-behaviour
|
||||
attributes:
|
||||
label: Expected behaviour
|
||||
description: |
|
||||
What behaviour that you expected?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: actual-behaviour
|
||||
attributes:
|
||||
label: Actual behaviour
|
||||
description: |
|
||||
What is the actual behaviour?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: Logs
|
||||
description: |
|
||||
Please provide logs here
|
||||
validations:
|
||||
required: false
|
||||
@@ -0,0 +1,45 @@
|
||||
name: 🐛 [Pro version] Bug Report
|
||||
description: File a bug report
|
||||
title: "[🐛 PRO | Bug ]: "
|
||||
labels: [bug, pro]
|
||||
body:
|
||||
- type: input
|
||||
id: operating-system
|
||||
attributes:
|
||||
label: Operating System
|
||||
description: Which host operating system do you use?
|
||||
placeholder: e.g. OSX Yosemite / Ubuntu 20.04 / Windows 10 etc
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: docker-image
|
||||
attributes:
|
||||
label: Docker Image
|
||||
description: Which docker image do you use?
|
||||
placeholder: e.g. budtmo/docker-android-pro:emulator_10.0_v2.0 / budtmo/docker-android-pro:emulator_headless_10.0_v2.0 etc
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: expected-behaviour
|
||||
attributes:
|
||||
label: Expected behaviour
|
||||
description: |
|
||||
What behaviour that you expected?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: actual-behaviour
|
||||
attributes:
|
||||
label: Actual behaviour
|
||||
description: |
|
||||
What is the actual behaviour?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: Logs
|
||||
description: |
|
||||
Please provide logs here
|
||||
validations:
|
||||
required: false
|
||||
@@ -0,0 +1,5 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: 📖 Docker-Android Documentation
|
||||
url: https://github.com/budtmo/docker-android
|
||||
about: Please read the whole project README before filling out an issue.
|
||||
@@ -0,0 +1,29 @@
|
||||
name: 🚀 Feature Request
|
||||
description: Submit your idea to have cool feature(s)
|
||||
title: "[🚀 Feature Request ]: "
|
||||
labels: [feature-request]
|
||||
body:
|
||||
- type: textarea
|
||||
id: idea
|
||||
attributes:
|
||||
label: Idea
|
||||
description: |
|
||||
What is the idea that you want to share to improve the project?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: problem
|
||||
attributes:
|
||||
label: Probelm to solve
|
||||
description: |
|
||||
What is the problem that you want to solve with requested feature?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: Note
|
||||
attributes:
|
||||
label: Additional Note
|
||||
description: |
|
||||
Please share any additional information here if needed
|
||||
validations:
|
||||
required: false
|
||||
@@ -1,12 +1,8 @@
|
||||
### Purpose of changes
|
||||
<!-- Please describe why this change is required / What problem you want to solve. -->
|
||||
|
||||
### Types of changes
|
||||
_Put an `x` in the boxes that apply_
|
||||
|
||||
- [ ] Bug fix (non-breaking change which fixes an issue)
|
||||
- [ ] New feature (non-breaking change which adds functionality)
|
||||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
||||
|
||||
### How has this been tested?
|
||||
<!-- Please describe in detail how you tested your changes. -->
|
||||
### Purpose of changes
|
||||
<!-- Please describe why this change is required / What problem you want to solve. -->
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: docker
|
||||
directory: "/docker"
|
||||
schedule:
|
||||
interval: daily
|
||||
time: '01:00'
|
||||
timezone: "Europe/Berlin"
|
||||
commit-message:
|
||||
prefix: "[docker] "
|
||||
target-branch: "master"
|
||||
open-pull-requests-limit: 99
|
||||
reviewers:
|
||||
- "budtmo"
|
||||
|
||||
- package-ecosystem: pip
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: daily
|
||||
time: '01:00'
|
||||
timezone: "Europe/Berlin"
|
||||
commit-message:
|
||||
prefix: "[pip] "
|
||||
target-branch: "master"
|
||||
open-pull-requests-limit: 99
|
||||
reviewers:
|
||||
- "budtmo"
|
||||
|
||||
- package-ecosystem: github-actions
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: daily
|
||||
time: '01:00'
|
||||
timezone: "Europe/Berlin"
|
||||
commit-message:
|
||||
prefix: "[github-action] "
|
||||
target-branch: "master"
|
||||
open-pull-requests-limit: 99
|
||||
reviewers:
|
||||
- "budtmo"
|
||||
@@ -0,0 +1,88 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*.*-*'
|
||||
|
||||
jobs:
|
||||
run_test:
|
||||
runs-on: ubuntu-24.04
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ["3.8"]
|
||||
steps:
|
||||
- name: Checkout the repo
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Run unit-test
|
||||
run: script -e -c "./app.sh test emulator test 11.0 && sudo mv tmp/* ."
|
||||
|
||||
release_base:
|
||||
runs-on: ubuntu-24.04
|
||||
needs: run_test
|
||||
steps:
|
||||
- name: Checkout the repo
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Get release version
|
||||
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
||||
|
||||
- name: Build and push base image (${RELEASE_VERSION})
|
||||
run: |
|
||||
docker login -u=${{secrets.DOCKER_USERNAME}} -p=${{secrets.DOCKER_PASSWORD}}
|
||||
./app.sh push base ${RELEASE_VERSION}
|
||||
docker logout
|
||||
|
||||
release_emulator:
|
||||
runs-on: ubuntu-24.04
|
||||
needs: release_base
|
||||
strategy:
|
||||
matrix:
|
||||
android: ["9.0", "10.0", "11.0", "12.0", "13.0", "14.0"]
|
||||
steps:
|
||||
- name: Checkout the repo
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Get release version
|
||||
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
||||
|
||||
- name: Set up extension
|
||||
run: |
|
||||
echo "${{ secrets.extension }}" > extension.sh
|
||||
chmod 700 extension.sh
|
||||
shell: bash
|
||||
|
||||
- name: Build and push emulator image ${{ matrix.android }} (${RELEASE_VERSION})
|
||||
run: |
|
||||
docker login -u=${{secrets.DOCKER_USERNAME}} -p=${{secrets.DOCKER_PASSWORD}}
|
||||
./app.sh push emulator ${RELEASE_VERSION} ${{ matrix.android }}
|
||||
docker logout
|
||||
|
||||
release_genymotion:
|
||||
runs-on: ubuntu-24.04
|
||||
needs: release_base
|
||||
steps:
|
||||
- name: Checkout the repo
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Get release version
|
||||
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
||||
|
||||
- name: Set up extension
|
||||
run: |
|
||||
echo "${{ secrets.extension }}" > extension.sh
|
||||
chmod 700 extension.sh
|
||||
shell: bash
|
||||
|
||||
- name: Build and push genymotion image (${RELEASE_VERSION})
|
||||
run: |
|
||||
docker login -u=${{secrets.DOCKER_USERNAME}} -p=${{secrets.DOCKER_PASSWORD}}
|
||||
./app.sh push genymotion ${RELEASE_VERSION}
|
||||
docker logout
|
||||
@@ -0,0 +1,32 @@
|
||||
name: Run Test on Demand
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build_and_test:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Checkout the repo
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Set up extension
|
||||
run: |
|
||||
echo "${{ secrets.extension }}" > extension.sh
|
||||
chmod 700 extension.sh
|
||||
shell: bash
|
||||
|
||||
- name: Build base image
|
||||
run: script -e -c "./app.sh build base test"
|
||||
|
||||
- name: Build sample image
|
||||
run: script -e -c "./app.sh build emulator test 11.0"
|
||||
|
||||
- name: Run unit-test
|
||||
run: script -e -c "./app.sh test emulator test 11.0 && sudo mv tmp/* ."
|
||||
|
||||
- name: Publish test result
|
||||
run: bash <(curl -s https://codecov.io/bash)
|
||||
@@ -0,0 +1,35 @@
|
||||
name: Run Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build_and_test:
|
||||
runs-on: ubuntu-24.04
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.actor == 'budtmo'
|
||||
steps:
|
||||
- name: Checkout the repo
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Set up extension
|
||||
run: |
|
||||
echo "${{ secrets.extension }}" > extension.sh
|
||||
chmod 700 extension.sh
|
||||
shell: bash
|
||||
|
||||
- name: Build base image
|
||||
run: script -e -c "./app.sh build base test"
|
||||
|
||||
- name: Build sample image
|
||||
run: script -e -c "./app.sh build emulator test 11.0"
|
||||
|
||||
- name: Run unit-test
|
||||
run: script -e -c "./app.sh test emulator test 11.0 && sudo mv tmp/* ."
|
||||
|
||||
- name: Publish test result
|
||||
run: bash <(curl -s https://codecov.io/bash)
|
||||
@@ -1,9 +1,20 @@
|
||||
.idea/*
|
||||
.DS_Store
|
||||
*.pyc
|
||||
# IDE
|
||||
**/*.idea
|
||||
backup
|
||||
|
||||
# Coverage
|
||||
.coverage
|
||||
coverage.xml
|
||||
xunit.xml
|
||||
coverage/*
|
||||
# Python
|
||||
**/*.egg-info
|
||||
**/*.pyc
|
||||
**/__pycache__
|
||||
**/venv
|
||||
|
||||
# Unit Test
|
||||
**/.coverage
|
||||
**/coverage.xml
|
||||
**/xunit.xml
|
||||
**/coverage
|
||||
tmp/
|
||||
|
||||
# Dev-files
|
||||
n*.txt
|
||||
e*.sh
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
language: python
|
||||
|
||||
python:
|
||||
- "3.5"
|
||||
|
||||
sudo: required
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
||||
install: "pip install -r requirements.txt"
|
||||
|
||||
env:
|
||||
- ANDROID_VERSION=5.0.1
|
||||
- ANDROID_VERSION=5.1.1
|
||||
- ANDROID_VERSION=6.0
|
||||
- ANDROID_VERSION=7.0
|
||||
- ANDROID_VERSION=7.1.1
|
||||
- REAL_DEVICE=True
|
||||
|
||||
script: bash travis.sh
|
||||
|
||||
after_success:
|
||||
- bash <(curl -s https://codecov.io/bash)
|
||||
@@ -1,13 +0,0 @@
|
||||
Copyright 2016 budi utomo
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -0,0 +1,46 @@
|
||||
## License Information
|
||||
|
||||
Copyright 2023 budi utomo
|
||||
|
||||
This program is subject to the terms of the Apache License, Version 2.0 AND the following amendments on forks and data processing. Thus, this is a Custom Apache 2.0 License, NOT a dual-license model you may choose from.
|
||||
|
||||
|
||||
You can obtain a copy of the license at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
||||
|
||||
|
||||
## Forks
|
||||
Additionally to Apache-2.0, when you fork this repo you are required to either remove our Google Form ID: 1FAIpQLSdrKWQdMh6Nt8v8NQdYvTIntohebAgqWCpXT3T9NofAoxcpkw or stop usage gathering completely.
|
||||
|
||||
## Data processing agreement
|
||||
By using this software you agree that the following non-PII (non personally identifiable information) data will be collected, processed and used by the maintainers for the purpose of improving the docker-android project.
|
||||
|
||||
|
||||
By using this software you also grant us a nonexclusive, irrevocable, world-wide, perpetual royalty-free permission to use, modify and publish these data for all purposes, internally or publicly, including the right to sub-license said permission rights.
|
||||
|
||||
|
||||
We collect, process and use the following data:
|
||||
|
||||
* Date and time when Docker-Android started
|
||||
* User (it will collect the information about Release Version of Machine), e.g. Linux-5.4.0-146-generic-x86_64-with-glibc2.29_#163-Ubuntu_SMP_Fri_Mar_17_18:26:02_UTC_2023. This does not allow us to track individual users but does enable us to accurately measure user counts
|
||||
* City (the information come from https://ipinfo.io)
|
||||
* Region (the information come from https://ipinfo.io)
|
||||
* Country (the information come from https://ipinfo.io)
|
||||
* Release version of Docker-Android
|
||||
* Appium (Whether user use Appium or not - The possible value will be "true" or "false")
|
||||
* Appium Additional Arguments
|
||||
* Web-Log (Whether user use Web-Log feature or not - The possible value will be "true" or "false")
|
||||
* Web-Vnc (Whether user use Web-Vnc feature or not - The possible value will be "true" or "false")
|
||||
* Screen-Resolution
|
||||
* Device Type (Which docker image is used - The possible value will be "emulator" or "geny_cloud" or "geny_aws")
|
||||
* Emulator Device (Which device profile and skin is used if the user use device_type "emulator")
|
||||
* Emulator Android Version (Which Android version is used if the user use device_type "emulator"
|
||||
* Emulator No-Skin feature (Whether user use no-skin feature or not - The possible value will be "true" or "false")
|
||||
* Emulator Data Partition
|
||||
* Emulator Additional Arguments
|
||||
|
||||
## End of License Information
|
||||
|
||||
More information about anonymized data collection can be seen [here](./documentations/USER_BEHAVIOR_ANALYTICS.md)
|
||||
@@ -1 +0,0 @@
|
||||
Budi Utomo <budi.ut.1989@gmail.com>
|
||||
@@ -0,0 +1 @@
|
||||
Budi Utomo <budtmo.os@gmail.com>
|
||||
@@ -1,351 +1,178 @@
|
||||
|
||||
<p align="center">
|
||||
<img id="header" src="./images/logo_dockerandroid_small.png" />
|
||||
<img id="header" src="./images/logo_docker-android.png" />
|
||||
</p>
|
||||
|
||||
[](https://gitter.im/butomo1989/docker-android?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[](https://travis-ci.org/butomo1989/docker-android)
|
||||
[](https://hub.docker.com/r/butomo1989/docker-android-x86-7.1.1/)
|
||||
[](https://codecov.io/gh/butomo1989/docker-android)
|
||||
[](https://www.codacy.com/app/butomo1989/docker-appium?utm_source=github.com&utm_medium=referral&utm_content=butomo1989/docker-appium&utm_campaign=Badge_Grade)
|
||||
[](http://paypal.me/budtmo) [](http://makeapullrequest.com) [](https://codecov.io/gh/budtmo/docker-android) [](https://gitter.im/budtmo/docker-android?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [](https://github.com/budtmo/docker-android/releases)
|
||||
|
||||
Docker-Android is a docker image built to be used for everything related to mobile website testing and Android project.
|
||||
Docker-Android is a docker image built to be used for everything related to Android. It can be used for Application development and testing (native, web and hybrid-app).
|
||||
|
||||
<p align="center">
|
||||
<a href="https://youtu.be/pQdpjuYwvp8"><img src="./images/appiumconf2018.png" alt="Appium Conference 2018" width="600"></a>
|
||||
</p>
|
||||
|
||||
Emulator - Samsung Device | Emulator - Nexus Device | Real Device
|
||||
:---------------------------:|:---------------------------:|:---------------------------:
|
||||
![][emulator samsung] |![][emulator nexus] |![][real device]
|
||||
|
||||
Purpose
|
||||
-------
|
||||
|
||||
1. Run UI tests for mobile websites with [appium]
|
||||
2. Build Android project and run unit tests with the latest build-tools
|
||||
3. Run UI tests for Android applications with different frameworks ([appium], [espresso], [robotium], etc.)
|
||||
4. Run monkey / stress tests
|
||||
5. SMS testing
|
||||
|
||||
Advantages compare with other docker-android projects
|
||||
-----------------------------------------------------
|
||||
|
||||
1. noVNC to see what happen inside docker container
|
||||
2. Emulator for different devices / skins, such as Samsung Galaxy S6, LG Nexus 4, HTC Nexus One and more.
|
||||
3. Ability to connect to Selenium Grid
|
||||
Advantages of using this project
|
||||
--------------------------------
|
||||
1. Emulator with different device profile and skins, such as Samsung Galaxy S6, LG Nexus 4, HTC Nexus One and more.
|
||||
2. Support vnc to be able to see what happen inside docker container
|
||||
3. Support log sharing feature where all logs can be accessed from web-UI
|
||||
4. Ability to control emulator from outside container by using adb connect
|
||||
5. Support real devices with screen mirroring
|
||||
6. Ability to record video during test execution for debugging
|
||||
7. Open source with more features coming
|
||||
5. Integrated with other cloud solutions, e.g. [Genymotion Cloud](https://www.genymotion.com/cloud/)
|
||||
6. It can be used to build Android project
|
||||
7. It can be used to run unit and UI-Test with different test-frameworks, e.g. Appium, Espresso, etc.
|
||||
|
||||
List of Docker images
|
||||
List of Docker-Images
|
||||
---------------------
|
||||
|
||||
|Supported OS |Android version |API level |Image name |Image status |
|
||||
|:---|:---|:---|:---|:---:|
|
||||
|Linux|5.0.1|21|butomo1989/docker-android-x86-5.0.1|[](https://microbadger.com/images/butomo1989/docker-android-x86-5.0.1 "Get your own image badge on microbadger.com")|
|
||||
|Linux|5.1.1|22|butomo1989/docker-android-x86-5.1.1|[](https://microbadger.com/images/butomo1989/docker-android-x86-5.1.1 "Get your own image badge on microbadger.com")|
|
||||
|Linux|6.0|23|butomo1989/docker-android-x86-6.0|[](https://microbadger.com/images/butomo1989/docker-android-x86-6.0 "Get your own image badge on microbadger.com")|
|
||||
|Linux|7.0|24|butomo1989/docker-android-x86-7.0|[](https://microbadger.com/images/butomo1989/docker-android-x86-7.0 "Get your own image badge on microbadger.com")|
|
||||
|Linux|7.1.1|25|butomo1989/docker-android-x86-7.1.1|[](https://microbadger.com/images/butomo1989/docker-android-x86-7.1.1 "Get your own image badge on microbadger.com")|
|
||||
|OSX / Windows|5.0.1|21|butomo1989/docker-android-arm-5.0.1|[](https://microbadger.com/images/butomo1989/docker-android-arm-5.0.1 "Get your own image badge on microbadger.com")|
|
||||
|OSX / Windows|5.1.1|22|butomo1989/docker-android-arm-5.1.1|[](https://microbadger.com/images/butomo1989/docker-android-arm-5.1.1 "Get your own image badge on microbadger.com")|
|
||||
|OSX / Windows|6.0|23|butomo1989/docker-android-arm-6.0|[](https://microbadger.com/images/butomo1989/docker-android-arm-6.0 "Get your own image badge on microbadger.com")|
|
||||
|OSX / Windows|7.0|24|butomo1989/docker-android-arm-7.0|[](https://microbadger.com/images/butomo1989/docker-android-arm-7.0 "Get your own image badge on microbadger.com")|
|
||||
|OSX / Windows|7.1.1|25|butomo1989/docker-android-arm-7.1.1|[](https://microbadger.com/images/butomo1989/docker-android-arm-7.1.1 "Get your own image badge on microbadger.com")|
|
||||
|All |-|-|butomo1989/docker-android-real-device|[](https://microbadger.com/images/butomo1989/docker-android-real-device "Get your own image badge on microbadger.com")|
|
||||
|Linux|All|All|butomo1989/docker-android-genymotion|[](https://microbadger.com/images/butomo1989/docker-android-genymotion "Get your own image badge on microbadger.com")|
|
||||
|Android |API |Image with latest release version |Image with specific release version|
|
||||
|:---|:---|:---|:---|
|
||||
|9.0|28|budtmo/docker-android:emulator_9.0|budtmo/docker-android:emulator_9.0_<release_version>|
|
||||
|10.0|29|budtmo/docker-android:emulator_10.0|budtmo/docker-android:emulator_10.0_<release_version>|
|
||||
|11.0|30|budtmo/docker-android:emulator_11.0|budtmo/docker-android:emulator_11.0_<release_version>|
|
||||
|12.0|32|budtmo/docker-android:emulator_12.0|budtmo/docker-android:emulator_12.0_<release_version>|
|
||||
|13.0|33|budtmo/docker-android:emulator_13.0|budtmo/docker-android:emulator_13.0_<release_version>|
|
||||
|14.0|34|budtmo/docker-android:emulator_14.0|budtmo/docker-android:emulator_14.0_<release_version>|
|
||||
|-|-|budtmo/docker-android:genymotion|budtmo/docker-android:genymotion_<release_version>|
|
||||
|
||||
List of Devices
|
||||
---------------
|
||||
|
||||
Type | Device Name
|
||||
----- | -----
|
||||
Phone | Samsung Galaxy S10
|
||||
Phone | Samsung Galaxy S9
|
||||
Phone | Samsung Galaxy S8
|
||||
Phone | Samsung Galaxy S7 Edge
|
||||
Phone | Samsung Galaxy S7
|
||||
Phone | Samsung Galaxy S6
|
||||
Phone | Nexus 4
|
||||
Phone | Nexus 5
|
||||
Phone | Nexus One
|
||||
Phone | Nexus S
|
||||
Tablet | Nexus 7
|
||||
Tablet | Pixel C
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Docker is installed in your system.
|
||||
1. Docker is installed on your system.
|
||||
|
||||
Quick Start
|
||||
-----------
|
||||
|
||||
1. Run docker-android
|
||||
1. If you use ***Ubuntu OS*** on your host machine, you can skip this step. For ***OSX*** and ***Windows OS*** user, you need to use Virtual Machine that support Virtualization with Ubuntu OS because the image can be run under ***Ubuntu OS only***.
|
||||
|
||||
- For ***Linux OS***, please use image name that contains "x86"
|
||||
2. Your machine should support virtualization. To check if the virtualization is enabled is:
|
||||
```
|
||||
sudo apt install cpu-checker
|
||||
kvm-ok
|
||||
```
|
||||
|
||||
```bash
|
||||
docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -e DEVICE="Samsung Galaxy S6" --name android-container butomo1989/docker-android-x86-7.1.1
|
||||
```
|
||||
3. Run Docker-Android container
|
||||
```
|
||||
docker run -d -p 6080:6080 -e EMULATOR_DEVICE="Samsung Galaxy S10" -e WEB_VNC=true --device /dev/kvm --name android-container budtmo/docker-android:emulator_11.0
|
||||
```
|
||||
|
||||
- For ***OSX*** and ***Windows OS***, please use image name that contains "arm"
|
||||
4. Open ***http://localhost:6080*** to see inside running container.
|
||||
|
||||
```bash
|
||||
docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -e DEVICE="Samsung Galaxy S6" --name android-container butomo1989/docker-android-arm-7.1.1
|
||||
```
|
||||
5. To check the status of the emulator
|
||||
```
|
||||
docker exec -it android-container cat device_status
|
||||
```
|
||||
|
||||
2. Verify the ip address of docker host.
|
||||
Persisting data
|
||||
-----------
|
||||
|
||||
- For OSX, you can find out by using following command:
|
||||
The default behaviour is to destroy the emulated device on container restart. To persist data, you need to mount a volume at `/home/androidusr`:
|
||||
```
|
||||
docker run -v data:/home/androidusr budtmo/docker-android:emulator_11.0
|
||||
```
|
||||
|
||||
```bash
|
||||
docker-machine ip default
|
||||
```
|
||||
WSL2 Hardware acceleration (Windows 11 only)
|
||||
-----------
|
||||
|
||||
- For different OS, localhost should work.
|
||||
Credit goes to [Guillaume - The Parallel Interface blog](https://www.paralint.com/2022/11/find-new-modified-and-unversioned-subversion-files-on-windows)
|
||||
|
||||
3. Open ***http://docker-host-ip-address:6080*** from web browser.
|
||||
[Microsoft - Advanced settings configuration in WSL](https://learn.microsoft.com/en-us/windows/wsl/wsl-config)
|
||||
|
||||
Run Appium Server
|
||||
-----------------
|
||||
|
||||
Appium is automation test framework to test mobile website and mobile application, including android. To be able to use appium, you need to run appium-server. You run appium server inside docker-android container by ***opening port 4723*** and ***passing an environment variable APPIUM=true***.
|
||||
1. Add yourself to the `kvm` usergroup.
|
||||
```
|
||||
sudo usermod -a -G kvm ${USER}
|
||||
```
|
||||
|
||||
```bash
|
||||
docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -p 4723:4723 -e DEVICE="Samsung Galaxy S6" -e APPIUM=true --name android-container butomo1989/docker-android-x86-7.1.1
|
||||
```
|
||||
2. Add necessary flags to `/etc/wsl.conf` to their respective sections.
|
||||
```
|
||||
[boot]
|
||||
command = /bin/bash -c 'chown -v root:kvm /dev/kvm && chmod 660 /dev/kvm'
|
||||
|
||||
### Connect to Selenium Grid
|
||||
[wsl2]
|
||||
nestedVirtualization=true
|
||||
```
|
||||
3. Restart WSL2 via CMD prompt or Powershell
|
||||
```
|
||||
wsl --shutdown
|
||||
```
|
||||
|
||||
It is also possible to connect appium server that run inside docker-android with selenium grid by passing following environment variables:
|
||||
|
||||
- CONNECT\_TO\_GRID=true
|
||||
- APPIUM_HOST="\<host\_ip\_address>"
|
||||
- APPIUM_PORT=\<port\_number>
|
||||
- SELENIUM_HOST="\<host\_ip\_address>"
|
||||
- SELENIUM_PORT=\<port\_number>
|
||||
`command = /bin/bash -c 'chown -v root:kvm /dev/kvm && chmod 660 /dev/kvm'` sets `/dev/kvm` to `kvm` usergroup rather than the default `root` usergroup on WSL2 startup.
|
||||
|
||||
To run tests for mobile browser, following parameter can be passed:
|
||||
`nestedVirtualization` flag is only available to Windows 11.
|
||||
|
||||
- MOBILE\_WEB\_TEST=true
|
||||
Use-Cases
|
||||
---------
|
||||
|
||||
```bash
|
||||
docker run --privileged -d -p 6080:6080 -p 4723:4723 -p 5554:5554 -p 5555:5555 -e DEVICE="Samsung Galaxy S6" -e APPIUM=true -e CONNECT_TO_GRID=true -e APPIUM_HOST="127.0.0.1" -e APPIUM_PORT=4723 -e SELENIUM_HOST="172.17.0.1" -e SELENIUM_PORT=4444 -e MOBILE_WEB_TEST=true --name android-container butomo1989/docker-android-x86-7.1.1
|
||||
```
|
||||
1. [Build Android project](./documentations/USE_CASE_BUILD_ANDROID_PROJECT.md)
|
||||
2. [UI-Test with Appium](./documentations/USE_CASE_APPIUM.md)
|
||||
3. [Control Android emulator on host machine](./documentations/USE_CASE_CONTROL_EMULATOR.md)
|
||||
4. [SMS Simulation](./documentations/USE_CASE_SMS.md)
|
||||
5. [Jenkins](./documentations/USE_CASE_JENKINS.md)
|
||||
6. [Deploying on cloud (Azure, AWS, GCP)](./documentations/USE_CASE_CLOUD.md)
|
||||
|
||||
### Share Volume
|
||||
|
||||
If you want to use appium to test UI of your android application, you need to share volume where the APK is located to folder ***/root/tmp***.
|
||||
|
||||
```bash
|
||||
docker run --privileged -d -p 6080:6080 -p 4723:4723 -p 5554:5554 -p 5555:5555 -v $PWD/example/sample_apk:/root/tmp -e DEVICE="Nexus 5" -e APPIUM=true -e CONNECT_TO_GRID=true -e APPIUM_HOST="127.0.0.1" -e APPIUM_PORT=4723 -e SELENIUM_HOST="172.17.0.1" -e SELENIUM_PORT=4444 --name android-container butomo1989/docker-android-x86-7.1.1
|
||||
```
|
||||
|
||||
### Video Recording
|
||||
|
||||
You can deactivate auto_record by changing the value to "False" in docker-compose file. e.g. change value to "False" in this [line].
|
||||
|
||||
### Docker-Compose
|
||||
|
||||
![][compose]
|
||||
|
||||
There is [example of compose file] to run complete selenium grid and docker-android container as nodes. [docker-compose] version [1.13.0] or higher is required to be able to execute that compose file.
|
||||
|
||||
```bash
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
Build Android project
|
||||
Custom-Configurations
|
||||
---------------------
|
||||
|
||||
docker-android can be used for building Android project and executing its unit test. This following steps will illustrate how to build Android project:
|
||||
|
||||
1. Clone [this sample test project](https://github.com/googlesamples/android-testing).
|
||||
|
||||
```bash
|
||||
git clone git@github.com:googlesamples/android-testing.git
|
||||
```
|
||||
|
||||
2. Build the project
|
||||
|
||||
```bash
|
||||
docker run -it --rm -v $PWD/android-testing/ui/espresso/BasicSample:/root/tmp butomo1989/docker-android-x86-7.1.1 tmp/gradlew build
|
||||
```
|
||||
|
||||
Proxy
|
||||
-----
|
||||
|
||||
You can enable proxy inside container by passing following environment variables:
|
||||
|
||||
- HTTP_PROXY="\<docker\_bridge\_ip\_address>"
|
||||
- HTTPS_PROXY="\<docker\_bridge\_ip\_address>"
|
||||
- NO_PROXY="localhost"
|
||||
|
||||
Relaxed Security
|
||||
-----
|
||||
|
||||
Pass environment variable RELAXED_SECURITY=true to disable additional security check to use some advanced features.
|
||||
This [document](./documentations/CUSTOM_CONFIGURATIONS.md) contains information about configurations that can be used to enable some features, e.g. log-sharing, etc.
|
||||
|
||||
Genymotion
|
||||
----------
|
||||
|
||||

|
||||
<p align="center">
|
||||
<img id="geny" src="./images/logo_genymotion_and_dockerandroid.png" />
|
||||
</p>
|
||||
|
||||
Docker-Android supports [Genymotion Cloud]. What you need is [device.json] and run following command
|
||||
For you who do not have ressources to maintain the simulator or to buy machines or need different device profiles, you can give a try by using [Genymotion SAAS](https://cloud.geny.io/). Docker-Android is [integrated with Genymotion](https://www.genymotion.com/blog/partner_tag/docker/) on different cloud services, e.g. Genymotion SAAS, AWS, GCP, Alibaba Cloud. Please follow [this document](./documentations/THIRD_PARTY_GENYMOTION.md) for more detail.
|
||||
|
||||
```bash
|
||||
export USER="xxx"
|
||||
export PASS="xxx"
|
||||
export LICENSE="xxx"
|
||||
|
||||
docker run -it --rm -p 4723:4723 -v $PWD/genymotion/example/sample_devices:/root/tmp -e USER=$USER -e PASS=$PASS -e LICENSE=$LICENSE butomo1989/docker-android-genymotion
|
||||
```
|
||||
|
||||
You can also use [this docker-compose file].
|
||||
|
||||
|
||||
Control android emulator outside container
|
||||
------------------------------------------
|
||||
|
||||
```bash
|
||||
adb connect <docker-machine-ip-address>:5555
|
||||
```
|
||||
|
||||
![][adb_connection]
|
||||
|
||||
**Note:** You need to have Android Debug Bridge (adb) installed in your host machine.
|
||||
|
||||
SMS Simulation
|
||||
Emulator Skins
|
||||
--------------
|
||||
The Emulator skins are taken from [Android Studio IDE](https://developer.android.com/studio) and [Samsung Developer Website](https://developer.samsung.com/)
|
||||
|
||||
1. Using telnet
|
||||
- Find the auth_token and copy it.
|
||||
USERS
|
||||
-----
|
||||
|
||||
```bash
|
||||
docker exec -it android-container cat /root/.emulator_console_auth_token
|
||||
```
|
||||
<a href="https://lookerstudio.google.com/s/iGaemHJqQvg">
|
||||
<p align="center">
|
||||
<img src="./images/docker-android_users.png" alt="docker-android-users" width="800" height="600">
|
||||
</p>
|
||||
</a>
|
||||
|
||||
- Access emulator using telnet and login with auth_token
|
||||
PRO VERSION
|
||||
-----------
|
||||
|
||||
```bash
|
||||
telnet <docker-machine-ip-address> 5554
|
||||
```
|
||||
Due to high requests for help and to be able to actively maintain the projects, the creator has decided to create docker-android-pro. Docker-Android-Pro is a sponsor based project which mean that the docker image of pro-version can be pulled only by [active sponsor](https://github.com/sponsors/budtmo).
|
||||
|
||||
- Login with given auth_token from 1.step
|
||||
The differences between normal version and pro version are:
|
||||
|
||||
```bash
|
||||
auth <auth_token>
|
||||
```
|
||||
|Feature |Normal |Pro |Comment|
|
||||
|:---|:---|:---|:---|
|
||||
|user-behavior-analytics|Yes|No|-|
|
||||
|proxy|No|Yes|Set up company proxy on Android emulator on fly|
|
||||
|language|No|Yes|Set up language on Android emulator on fly|
|
||||
|Newer Android version|No|Yes|Support other newer Android version e.g. Android 15, Android 16, etc|
|
||||
|root-privileged|No|Yes|Able to run command with security privileged|
|
||||
|headless-mode|No|Yes|Save resources by using headless mode|
|
||||
|Selenium 4.x integration|No|Yes|Running Appium UI-Tests againt one (Selenium Hub) endpoint for Android- and iOS emulator(s) / device(s)|
|
||||
|multiple Android-Simulators|No|Yes (soon)|Save resources by having multiple Android-Simulators on one docker-container|
|
||||
|Google Play Store|No|Yes (soon)|-|
|
||||
|Video Recording|No|Yes (soon)|Helpful for debugging|
|
||||
|
||||
- Send the sms
|
||||
This [document](./documentations/DOCKER-ANDROID-PRO.md) contains detail information about how to use docker-android-pro.
|
||||
|
||||
```bash
|
||||
sms send <phone_number> <message>
|
||||
```
|
||||
|
||||
2. Using adb
|
||||
|
||||
```bash
|
||||
docker exec -it android-container adb emu sms send <phone_number> <message>
|
||||
```
|
||||
|
||||
3. You can also integrate it inside project using adb library.
|
||||
|
||||
![][sms]
|
||||
|
||||
How to use docker-android in VMWare or Parallels Desktop
|
||||
---------------
|
||||
The following instructions are used for OS X. You'll need [docker-machine-parallels](https://github.com/Parallels/docker-machine-parallels) to create a virtual machine (vm) with tiny core linux for running docker images. After that, you may start the vm you created for VMWare Fusion or Parallels Desktop and run a docker container inside this vm. If you're going to use the android docker of emulator with x86 processor, setup this vm for nested virtualization and kvm support before you run a docker container.
|
||||
|
||||
1. Install docker-machine-parallels via Homebrew:
|
||||
```bash
|
||||
$ brew install docker-machine-parallels
|
||||
```
|
||||
|
||||
2. Create a virtual machine for running docker images based on the virtual machine tool you use
|
||||
|
||||
2.1. Create a virtual machine of VMWare Fusion
|
||||
```bash
|
||||
$ docker-machine create --driver=vmwarefusion vmware-dev
|
||||
```
|
||||
|
||||
2.2. Create a virtual machine of Parallels Desktop
|
||||
```bash
|
||||
$ docker-machine create --driver=parallels prl-dev
|
||||
```
|
||||
|
||||
This utility `docker-machine-parallels` will fetch boot2docker.iso to create a vm of VMWare fusion or Parallels Desktop. When the vm is created, you'll see it's booted with VMWare fusion or Parallels Desktop where the network of vm is set to NAT and one IP is assigned. You'll be able to connect to vnc service inside the docker image through that IP. Say it's `10.211.55.3` and we'll use it later.
|
||||
|
||||
3. Setup the virtual machine for nested virtualization support
|
||||
|
||||
3.1. Shutdown the vm by running the command below in the boot2docker vm before you setup it.
|
||||
```bash
|
||||
# shutdown -h now
|
||||
```
|
||||
|
||||
If you use VMWare Fusion, go to menu bar > Vitual Machine > Settings > Processors and Memory, expand Advanced options, and select `Enable hypervisor applications in this virtual machine`.
|
||||
|
||||

|
||||
|
||||
If you use Parallels Desktop, open settings screen of that vm and go to `CPU & Memory` under `hardware` tab, expand Advanced settings and select `Enable nested virtualization`.
|
||||
|
||||

|
||||
|
||||
4. Enable kvm inside virtual machine
|
||||
4.1. Run as an account other than root to install kvm packages using tce-load.
|
||||
```bash
|
||||
# su docker
|
||||
$ tce-load -wi kvm
|
||||
```
|
||||
|
||||
4.2. Run as root to load kvm module after kvm packages install.
|
||||
```bash
|
||||
$ sudo modprobe kvm_intel
|
||||
```
|
||||
|
||||
4.3. Check if the kvm device is loaded.
|
||||
```bash
|
||||
$ ls /dev/kvm
|
||||
```
|
||||
|
||||
4.4. Check if your CPU supports hardware virtualization now
|
||||
```bash
|
||||
$ egrep -c '(vmx|svm)' /proc/cpuinfo
|
||||
```
|
||||
|
||||
If **0** it means that your CPU doesn't support hardware virtualization.
|
||||
If **1** or more it does - but you still need to make sure that virtualization is enabled in the BIOS.
|
||||
|
||||
5. You may now run a docker container
|
||||
5.1. Let's run a docker image for an emulator with x86 processor.
|
||||
```bash
|
||||
docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -e DEVICE="Samsung Galaxy S6" --name android-container butomo1989/docker-android-x86-7.1.1
|
||||
```
|
||||
|
||||
When the services inside this docker container are running, connect to http://10.211.55.3:6080/vnc.html (the IP we got when the docker machine was created) and login. The emulator with x86 processor should be running on screen.
|
||||
|
||||
Troubleshooting
|
||||
---------------
|
||||
All logs inside container are stored under folder **/var/log/supervisor**. you can print out log file by using **docker exec**. Example:
|
||||
|
||||
```bash
|
||||
docker exec -it android-container tail -f /var/log/supervisor/docker-android.stdout.log
|
||||
```
|
||||
|
||||
Special Thanks
|
||||
--------------
|
||||
- [Gian Christanto] for creating a great logo!
|
||||
|
||||
[appium]: <https://appium.io>
|
||||
[espresso]: <https://google.github.io/android-testing-support-library/docs/espresso/>
|
||||
[robotium]: <https://github.com/RobotiumTech/robotium>
|
||||
[emulator samsung]: <images/emulator_samsung_galaxy_s6.png>
|
||||
[emulator nexus]: <images/emulator_nexus_5.png>
|
||||
[real device]: <images/real_device.png>
|
||||
[compose]: <images/compose.png>
|
||||
[line]: <https://github.com/butomo1989/docker-android/blob/master/docker-compose.yml#L70>
|
||||
[example of compose file]: <docker-compose.yml>
|
||||
[docker-compose]: <https://docs.docker.com/compose/install/>
|
||||
[1.13.0]: <https://github.com/docker/compose/releases/tag/1.13.0>
|
||||
[Genymotion Cloud]: <https://cloud.geny.io/signin>
|
||||
[device.json]: <genymotion/example/sample_devices/devices.json>
|
||||
[this docker-compose file]: <genymotion/example/geny.yml>
|
||||
[adb_connection]: <images/adb_connection.png>
|
||||
[sms]: <images/SMS.png>
|
||||
[gian christanto]: <https://www.linkedin.com/in/gian-christanto-0b398b131/>
|
||||
LICENSE
|
||||
-------
|
||||
See [License](LICENSE.md)
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
#!/bin/bash
|
||||
|
||||
function is_str_in_list(){
|
||||
local given_str=${1}
|
||||
local list_str=${@:2}
|
||||
|
||||
if [[ ! " ${list_str[*]} " =~ " ${given_str} " ]]; then
|
||||
echo "${given_str} is not supported!"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
tasks=("test" "build" "push")
|
||||
if [ -z "${1}" ]; then
|
||||
read -p "Task ($(echo "${tasks[@]}" | tr ' ' '|')) : " t
|
||||
else
|
||||
t=${1}
|
||||
fi
|
||||
is_str_in_list ${t} ${tasks[@]}
|
||||
|
||||
projects=("base" "emulator" "genymotion" "pro-emulator" "pro-emulator_headless")
|
||||
if [ -z "${2}" ]; then
|
||||
read -p "Project ($(echo "${projects[@]}" | tr ' ' '|')) : " p
|
||||
else
|
||||
p=${2}
|
||||
fi
|
||||
is_str_in_list ${p} ${projects[@]}
|
||||
|
||||
if [ -z "${3}" ]; then
|
||||
read -p "Release Version (v2.0.0-p0|v2.0.0-p1|etc) : " r_v
|
||||
else
|
||||
r_v=${3}
|
||||
fi
|
||||
|
||||
FOLDER_PATH=""
|
||||
IMAGE_NAME=""
|
||||
TAG_NAME=""
|
||||
|
||||
if [[ "${p}" == "pro"* ]]; then
|
||||
IFS='-' read -ra arr <<<"${p}"
|
||||
FOLDER_PATH+="docker/${arr[0]}/${arr[1]}"
|
||||
IMAGE_NAME+="budtmo2/docker-android-${arr[0]}"
|
||||
TAG_NAME+="${arr[1]}"
|
||||
else
|
||||
FOLDER_PATH+="docker/${p}"
|
||||
IMAGE_NAME+="budtmo/docker-android"
|
||||
TAG_NAME+="${p}"
|
||||
fi
|
||||
|
||||
if [[ "${p}" == *"emulator"* ]]; then
|
||||
supported_android_version=("9.0" "10.0" "11.0" "12.0" "13.0" "14.0")
|
||||
declare -A api_levels=(
|
||||
["9.0"]=28
|
||||
["10.0"]=29
|
||||
["11.0"]=30
|
||||
["12.0"]=32
|
||||
["13.0"]=33
|
||||
["14.0"]=34
|
||||
)
|
||||
|
||||
# To get the last index
|
||||
keys=("${!api_levels[@]}")
|
||||
sorted_keys=($(printf '%s\n' "${keys[@]}" | sort))
|
||||
last_key=${keys[-2]} # because 9.0 will be last
|
||||
|
||||
if [ -z "${4}" ]; then
|
||||
read -p "Android Version ($(echo "${supported_android_version[@]}" \
|
||||
| tr ' ' '|')) : " a_v
|
||||
else
|
||||
a_v=${4}
|
||||
fi
|
||||
is_str_in_list ${a_v} ${supported_android_version[@]}
|
||||
a_l=${api_levels[${a_v}]}
|
||||
TAG_NAME+="_${a_v}"
|
||||
fi
|
||||
|
||||
IMAGE_NAME_LATEST="${IMAGE_NAME}:${TAG_NAME}"
|
||||
TAG_NAME+="_${r_v}"
|
||||
IMAGE_NAME_SPECIFIC_RELEASE=${IMAGE_NAME}:${TAG_NAME}
|
||||
echo "${IMAGE_NAME_SPECIFIC_RELEASE} or ${IMAGE_NAME_LATEST} "
|
||||
|
||||
function build() {
|
||||
# autopep8 --recursive --exclude=.git,__pycache__,venv --max-line-length=120 --in-place .
|
||||
cmd="docker build --no-cache -t ${IMAGE_NAME_SPECIFIC_RELEASE} --build-arg DOCKER_ANDROID_VERSION=${r_v} "
|
||||
if [ -n "${a_v}" ]; then
|
||||
DOCKER_BUILDKIT=1
|
||||
cmd="${cmd} --secret id=extension,src=extension.sh --build-arg EMULATOR_ANDROID_VERSION=${a_v} --build-arg EMULATOR_API_LEVEL=${a_l} "
|
||||
fi
|
||||
|
||||
if [[ "${p}" == *"genymotion"* ]]; then
|
||||
DOCKER_BUILDKIT=1
|
||||
cmd="${cmd} --secret id=extension,src=extension.sh "
|
||||
fi
|
||||
|
||||
cmd+="-f ${FOLDER_PATH} ."
|
||||
${cmd}
|
||||
docker tag ${IMAGE_NAME_SPECIFIC_RELEASE} ${IMAGE_NAME_LATEST}
|
||||
|
||||
if [ -n "${a_v}" ] && [ "${a_v}" = "${last_key}" ]; then
|
||||
echo "${a_v} is the last version in the list, will use it as default image tag"
|
||||
docker tag ${IMAGE_NAME_SPECIFIC_RELEASE} ${IMAGE_NAME}:latest
|
||||
fi
|
||||
}
|
||||
|
||||
function test() {
|
||||
tmp_folder="/app/tmp"
|
||||
|
||||
mkdir -p tmp
|
||||
docker run -it --rm -v "$PWD":/app -w /app python:3.12-slim bash \
|
||||
-c "cd cli && rm -rf ${tmp_folder}/* && \
|
||||
pip install --upgrade pip && pip install -r requirements.txt && \
|
||||
PYTHONPATH=src pytest -v && mv test-results/* ${tmp_folder}/ && chown -R 1300:1301 ${tmp_folder} && \
|
||||
chmod a+x -R ${tmp_folder}"
|
||||
}
|
||||
|
||||
function push() {
|
||||
build
|
||||
docker push ${IMAGE_NAME_SPECIFIC_RELEASE}
|
||||
docker push ${IMAGE_NAME_LATEST}
|
||||
if [ -n "${a_v}" ] && [ "${a_v}" = "${last_key}" ]; then
|
||||
docker push ${IMAGE_NAME}:latest
|
||||
fi
|
||||
}
|
||||
|
||||
${t}
|
||||
@@ -0,0 +1,9 @@
|
||||
autopep8==2.3.2
|
||||
click==8.2.1
|
||||
coverage==7.10.6
|
||||
mock==5.2.0
|
||||
pytest==8.4.1
|
||||
pytest-cov==6.2.1
|
||||
pytest-xdist==3.8.0
|
||||
requests==2.32.5
|
||||
setuptools==80.9.0
|
||||
@@ -0,0 +1,7 @@
|
||||
[tool:pytest]
|
||||
addopts =
|
||||
--cov=src
|
||||
--cov-report=html:test-results/html
|
||||
--cov-report=xml:test-results/coverage.xml
|
||||
--junit-xml=test-results/junit-report.xml
|
||||
testpaths = src/tests
|
||||
@@ -0,0 +1,23 @@
|
||||
import os
|
||||
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
|
||||
app_version = os.getenv("DOCKER_ANDROID_VERSION", "test-version")
|
||||
|
||||
with open("requirements.txt", "r") as f:
|
||||
reqs = f.read().splitlines()
|
||||
|
||||
setup(
|
||||
name="docker-android",
|
||||
version="0.1",
|
||||
url="https://github.com/budtmo/docker-android",
|
||||
description="CLI for docker-android",
|
||||
author="Budi Utomo",
|
||||
author_email="budtmo.os@gmail.com",
|
||||
install_requires=reqs,
|
||||
packages=find_packages(where="src"),
|
||||
package_dir={"": "src"},
|
||||
py_modules=["cli", "docker-android"],
|
||||
entry_points={"console_scripts": "docker-android=app:cli"}
|
||||
)
|
||||
@@ -0,0 +1,213 @@
|
||||
#!/usr/bin/env python3
|
||||
import subprocess
|
||||
from typing import Union
|
||||
|
||||
import click
|
||||
import logging
|
||||
import os
|
||||
|
||||
from enum import Enum
|
||||
|
||||
from application import Application
|
||||
from device import DeviceType
|
||||
from device.emulator import Emulator
|
||||
from device.geny_aws import GenyAWS
|
||||
from device.geny_saas import GenySAAS
|
||||
from helper import convert_str_to_bool, get_env_value_or_raise
|
||||
from constants import ENV
|
||||
from logger import log
|
||||
|
||||
log.init()
|
||||
logger = logging.getLogger("App")
|
||||
|
||||
|
||||
def get_device(given_input: str) -> Union[Emulator, GenyAWS, GenySAAS, None]:
|
||||
"""
|
||||
Get Device object based on given input
|
||||
|
||||
:param given_input: device in string
|
||||
:return: Platform object
|
||||
"""
|
||||
|
||||
input_lower = given_input.lower()
|
||||
|
||||
if input_lower == DeviceType.EMULATOR.value.lower():
|
||||
emu_av = get_env_value_or_raise(ENV.EMULATOR_ANDROID_VERSION)
|
||||
emu_img_type = get_env_value_or_raise(ENV.EMULATOR_IMG_TYPE)
|
||||
emu_sys_img = get_env_value_or_raise(ENV.EMULATOR_SYS_IMG)
|
||||
|
||||
emu_device = os.getenv(ENV.EMULATOR_DEVICE, "Nexus 5")
|
||||
emu_data_partition = os.getenv(ENV.EMULATOR_DATA_PARTITION, "550m")
|
||||
emu_additional_args = os.getenv(ENV.EMULATOR_ADDITIONAL_ARGS, "")
|
||||
|
||||
emu_name = os.getenv(ENV.EMULATOR_NAME, "{d}_{v}".format(
|
||||
d=emu_device.replace(" ", "_").lower(), v=emu_av))
|
||||
emu = Emulator(emu_name, emu_device, emu_av, emu_data_partition,
|
||||
emu_additional_args, emu_img_type, emu_sys_img)
|
||||
return emu
|
||||
elif input_lower == DeviceType.GENY_AWS.value.lower():
|
||||
return GenyAWS()
|
||||
elif input_lower == DeviceType.GENY_SAAS.value.lower():
|
||||
return GenySAAS()
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
@click.group(context_settings=dict(help_option_names=['-h', '--help']))
|
||||
def cli():
|
||||
pass
|
||||
|
||||
|
||||
def start_appium() -> None:
|
||||
if convert_str_to_bool(os.getenv(ENV.APPIUM)):
|
||||
cmd = f"/usr/bin/appium"
|
||||
app_appium = Application("Appium", cmd,
|
||||
os.getenv(ENV.APPIUM_ADDITIONAL_ARGS, ""), False)
|
||||
app_appium.start()
|
||||
else:
|
||||
logger.info("env APPIUM cannot be found, Appium is not started!")
|
||||
|
||||
|
||||
def start_device() -> None:
|
||||
given_pt = get_env_value_or_raise(ENV.DEVICE_TYPE)
|
||||
selected_device = get_device(given_pt)
|
||||
if selected_device is None:
|
||||
raise RuntimeError(f"'{given_pt}' is invalid! Please check again!")
|
||||
selected_device.create()
|
||||
selected_device.start()
|
||||
selected_device.wait_until_ready()
|
||||
selected_device.reconfigure()
|
||||
selected_device.keep_alive()
|
||||
|
||||
|
||||
def start_display_screen() -> None:
|
||||
cmd = "/usr/bin/Xvfb"
|
||||
args = f"{os.getenv(ENV.DISPLAY)} " \
|
||||
f"-screen {os.getenv(ENV.SCREEN_NUMBER)} " \
|
||||
f"{os.getenv(ENV.SCREEN_WIDTH)}x" \
|
||||
f"{os.getenv(ENV.SCREEN_HEIGHT)}x" \
|
||||
f"{os.getenv(ENV.SCREEN_DEPTH)}"
|
||||
d_screen = Application("d_screen", cmd, args, False)
|
||||
d_screen.start()
|
||||
|
||||
|
||||
def start_display_wm() -> None:
|
||||
cmd = "/usr/bin/openbox-session"
|
||||
d_wm = Application("d_wm", cmd)
|
||||
d_wm.start()
|
||||
|
||||
|
||||
def start_port_forwarder() -> None:
|
||||
import socket
|
||||
local_ip = socket.gethostbyname(socket.gethostname())
|
||||
cmd = f"/usr/bin/socat tcp-listen:5554,bind={local_ip},fork tcp:127.0.0.1:5554 & " \
|
||||
f"/usr/bin/socat tcp-listen:5555,bind={local_ip},fork tcp:127.0.0.1:5555"
|
||||
pf = Application("port_forwarder", cmd)
|
||||
pf.start()
|
||||
|
||||
|
||||
def start_vnc_server() -> None:
|
||||
cmd = "/usr/bin/x11vnc"
|
||||
vnc_pass = os.getenv(ENV.VNC_PASSWORD)
|
||||
if vnc_pass:
|
||||
pass_path = os.path.join(os.getenv(ENV.WORK_PATH), ".vncpass")
|
||||
subprocess.check_call(f"{cmd} -storepasswd {vnc_pass} {pass_path}", shell=True)
|
||||
last_arg = f"-rfbauth {pass_path}"
|
||||
else:
|
||||
last_arg = "-nopw"
|
||||
|
||||
display = os.getenv(ENV.DISPLAY)
|
||||
args = f"-display {display} -forever -shared {last_arg}"
|
||||
vnc_server = Application("vnc_web", cmd, args, False)
|
||||
vnc_server.start()
|
||||
|
||||
|
||||
def start_vnc_web() -> None:
|
||||
if convert_str_to_bool(os.getenv(ENV.WEB_VNC)):
|
||||
vnc_port = get_env_value_or_raise(ENV.VNC_PORT)
|
||||
vnc_web_port = get_env_value_or_raise(ENV.WEB_VNC_PORT)
|
||||
cmd = "/opt/noVNC/utils/novnc_proxy"
|
||||
args = f"--vnc localhost:{vnc_port} localhost:{vnc_web_port}"
|
||||
vnc_web = Application("vnc_web", cmd, args, False)
|
||||
vnc_web.start()
|
||||
else:
|
||||
logger.info("env WEB_VNC cannot be found, VNC_WEB is not started!")
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.argument("app", type=click.Choice([app.value for app in Application.App]))
|
||||
def start(app):
|
||||
selected_app = str(app).lower()
|
||||
if selected_app == Application.App.APPIUM.value.lower():
|
||||
start_appium()
|
||||
elif selected_app == Application.App.DEVICE.value.lower():
|
||||
start_device()
|
||||
elif selected_app == Application.App.DISPLAY_SCREEN.value.lower():
|
||||
start_display_screen()
|
||||
elif selected_app == Application.App.DISPLAY_WM.value.lower():
|
||||
start_display_wm()
|
||||
elif selected_app == Application.App.PORT_FORWARDER.value.lower():
|
||||
start_port_forwarder()
|
||||
elif selected_app == Application.App.VNC_SERVER.value.lower():
|
||||
start_vnc_server()
|
||||
elif selected_app == Application.App.VNC_WEB.value.lower():
|
||||
start_vnc_web()
|
||||
else:
|
||||
logger.error(f"application '{selected_app}' is not supported!")
|
||||
|
||||
|
||||
class SharedComponent(Enum):
|
||||
LOG = "log"
|
||||
|
||||
|
||||
def shared_log() -> None:
|
||||
if convert_str_to_bool(os.getenv(ENV.WEB_LOG)):
|
||||
from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||
|
||||
log_path = get_env_value_or_raise(ENV.LOG_PATH)
|
||||
log_port = int(get_env_value_or_raise(ENV.WEB_LOG_PORT))
|
||||
logger.info(f"Shared log is enabled! all logs can be found on port '{log_port}'")
|
||||
|
||||
class LogSharedHandler(BaseHTTPRequestHandler):
|
||||
def do_GET(self):
|
||||
# root path
|
||||
if self.path == "/":
|
||||
html = "<html><body>"
|
||||
for f in os.listdir(log_path):
|
||||
html += f"<p><a href=\"{f}\">{f}</a></p>"
|
||||
html += "</body></html>"
|
||||
|
||||
self.send_response(200)
|
||||
self.send_header("Content-type", "text/html")
|
||||
self.end_headers()
|
||||
self.wfile.write(html.encode())
|
||||
# open each selected log file
|
||||
else:
|
||||
p = log_path + self.path
|
||||
try:
|
||||
with open(p, "rb") as file:
|
||||
self.send_response(200)
|
||||
self.send_header("Content-type", "text/plain")
|
||||
self.end_headers()
|
||||
self.wfile.write(file.read())
|
||||
except FileNotFoundError:
|
||||
self.send_error(404, "File not found")
|
||||
|
||||
httpd = HTTPServer(('0.0.0.0', log_port), LogSharedHandler)
|
||||
httpd.serve_forever()
|
||||
else:
|
||||
logger.info(f"Shared log is disabled! nothing to do!")
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.argument("component", type=click.Choice([component.value for component in SharedComponent]))
|
||||
def share(component):
|
||||
selected_component = str(component).lower()
|
||||
if selected_component == SharedComponent.LOG.value.lower():
|
||||
shared_log()
|
||||
else:
|
||||
logger.error(f"component '{component}' is not supported!")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
cli()
|
||||
@@ -0,0 +1,35 @@
|
||||
import logging
|
||||
import subprocess
|
||||
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class Application:
|
||||
class App(Enum):
|
||||
APPIUM = "appium"
|
||||
DEVICE = "device"
|
||||
DISPLAY_SCREEN = "display_screen"
|
||||
DISPLAY_WM = "display_wm"
|
||||
PORT_FORWARDER = "port_forwarder"
|
||||
VNC_SERVER = "vnc_server"
|
||||
VNC_WEB = "vnc_web"
|
||||
|
||||
def __init__(self, name: str, command: str, additional_args: str = "", ui: bool = False) -> None:
|
||||
self.logger = logging.getLogger(self.__class__.__name__)
|
||||
self.name = name
|
||||
self.command = command
|
||||
self.additional_args = additional_args
|
||||
self.ui = ui
|
||||
|
||||
def start(self) -> None:
|
||||
if self.ui:
|
||||
self.logger.info(f"{self.name} will be started with ui!")
|
||||
subprocess.check_call(f"/usr/bin/xterm -T {self.name} -n {self.name} "
|
||||
f"-e '{self.command} {self.additional_args}'", shell=True)
|
||||
else:
|
||||
self.logger.info(f"{self.name} will be started without ui!")
|
||||
subprocess.check_call(f"{self.command} {self.additional_args}", shell=True)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return "Application(name={n}, command={c}, args={args}, ui={ui})".format(
|
||||
n=self.name, c=self.command, args=self.additional_args, ui=self.ui)
|
||||
@@ -0,0 +1,6 @@
|
||||
# Status
|
||||
STATUS_CREATING = "CREATING"
|
||||
STATUS_STARTING = "STARTING"
|
||||
STATUS_BOOTING = "BOOTING"
|
||||
STATUS_RECONFIGURING = "RECONFIGURING"
|
||||
STATUS_READY = "READY"
|
||||
@@ -0,0 +1,47 @@
|
||||
# General
|
||||
DOCKER_ANDROID_VERSION = "DOCKER_ANDROID_VERSION"
|
||||
USER_BEHAVIOR_ANALYTICS = "USER_BEHAVIOR_ANALYTICS"
|
||||
APPIUM = "APPIUM"
|
||||
APPIUM_ADDITIONAL_ARGS = "APPIUM_ADDITIONAL_ARGS"
|
||||
DISPLAY = "DISPLAY"
|
||||
SCREEN_DEPTH = "SCREEN_DEPTH"
|
||||
SCREEN_HEIGHT = "SCREEN_HEIGHT"
|
||||
SCREEN_NUMBER = "SCREEN_NUMBER"
|
||||
SCREEN_WIDTH = "SCREEN_WIDTH"
|
||||
VNC_PASSWORD = "VNC_PASSWORD"
|
||||
VNC_PORT = "VNC_PORT"
|
||||
WEB_VNC_PORT = "WEB_VNC_PORT"
|
||||
WEB_VNC = "WEB_VNC"
|
||||
WORK_PATH = "WORK_PATH"
|
||||
LOG_PATH = "LOG_PATH"
|
||||
WEB_LOG_PORT = "WEB_LOG_PORT"
|
||||
WEB_LOG = "WEB_LOG"
|
||||
|
||||
# Device
|
||||
DEVICE_INTERVAL_WAITING = "DEVICE_INTERVAL_WAITING"
|
||||
DEVICE_TYPE = "DEVICE_TYPE"
|
||||
|
||||
# Device (Emulator)
|
||||
EMULATOR_ADDITIONAL_ARGS = "EMULATOR_ADDITIONAL_ARGS"
|
||||
EMULATOR_ANDROID_VERSION = "EMULATOR_ANDROID_VERSION"
|
||||
EMULATOR_DATA_PARTITION = "EMULATOR_DATA_PARTITION"
|
||||
EMULATOR_DEVICE = "EMULATOR_DEVICE"
|
||||
EMULATOR_IMG_TYPE = "EMULATOR_IMG_TYPE"
|
||||
EMULATOR_NAME = "EMULATOR_NAME"
|
||||
EMULATOR_NO_SKIN = "EMULATOR_NO_SKIN"
|
||||
EMULATOR_SYS_IMG = "EMULATOR_SYS_IMG"
|
||||
EMULATOR_CONFIG_PATH = "EMULATOR_CONFIG_PATH"
|
||||
|
||||
# Device (Genymotion - General)
|
||||
GENYMOTION_TEMPLATE_PATH = "GENYMOTION_TEMPLATE_PATH"
|
||||
|
||||
# Device (Geny_SAAS)
|
||||
GENY_SAAS_USER = "GENY_SAAS_USER"
|
||||
GENY_SAAS_PASS = "GENY_SAAS_PASS"
|
||||
GENY_AUTH_TOKEN = "GENY_AUTH_TOKEN"
|
||||
GENY_SAAS_TEMPLATE_FILE_NAME = "saas.json"
|
||||
|
||||
# Device (Geny_AWS)
|
||||
AWS_ACCESS_KEY_ID = "AWS_ACCESS_KEY_ID"
|
||||
AWS_SECRET_ACCESS_KEY = "AWS_SECRET_ACCESS_KEY"
|
||||
GENY_AWS_TEMPLATE_FILE_NAME = "aws.json"
|
||||
@@ -0,0 +1 @@
|
||||
UTF8 = "utf-8"
|
||||
@@ -0,0 +1,172 @@
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import platform
|
||||
import requests
|
||||
import signal
|
||||
import time
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
from enum import Enum
|
||||
|
||||
from helper import convert_str_to_bool, get_env_value_or_raise
|
||||
from constants import DEVICE, ENV
|
||||
|
||||
|
||||
class DeviceType(Enum):
|
||||
EMULATOR = "emulator"
|
||||
GENY_SAAS = "geny_saas"
|
||||
GENY_AWS = "geny_aws"
|
||||
|
||||
|
||||
class Device(ABC):
|
||||
FORM_ID = "1FAIpQLSdrKWQdMh6Nt8v8NQdYvTIntohebAgqWCpXT3T9NofAoxcpkw"
|
||||
FORM_USER = "user"
|
||||
FORM_CITY = "city"
|
||||
FORM_REGION = "region"
|
||||
FORM_COUNTRY = "country"
|
||||
FORM_APP_VERSION = "app_version"
|
||||
FORM_APPIUM = "appium"
|
||||
FORM_APPIUM_ADDITIONAL_ARGS = "appium_additional_args"
|
||||
FORM_WEB_LOG = "web_log"
|
||||
FORM_WEB_VNC = "web_vnc"
|
||||
FORM_SCREEN_RESOLUTION = "screen_resolution"
|
||||
FORM_DEVICE_TYPE = "device_type"
|
||||
FORM_EMU_DEVICE = "emu_device"
|
||||
FORM_EMU_ANDROID_VERSION = "emu_android_version"
|
||||
FORM_EMU_NO_SKIN = "emu_no_skin"
|
||||
FORM_EMU_DATA_PARTITION = "emu_data_partition"
|
||||
FORM_EMU_ADDITIONAL_ARGS = "emu_additional_args"
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.logger = logging.getLogger(self.__class__.__name__)
|
||||
self.device_type = None
|
||||
self.interval_waiting = int(os.getenv(ENV.DEVICE_INTERVAL_WAITING, 2))
|
||||
self.user_behavior_analytics = convert_str_to_bool(os.getenv(ENV.USER_BEHAVIOR_ANALYTICS, "true"))
|
||||
self.form_field = {
|
||||
Device.FORM_USER: "entry.108751316",
|
||||
Device.FORM_CITY: "entry.2083022547",
|
||||
Device.FORM_REGION: "entry.1083141079",
|
||||
Device.FORM_COUNTRY: "entry.1946159560",
|
||||
Device.FORM_APP_VERSION: "entry.818050927",
|
||||
Device.FORM_APPIUM: "entry.181610571",
|
||||
Device.FORM_APPIUM_ADDITIONAL_ARGS: "entry.727759656",
|
||||
Device.FORM_WEB_LOG: "entry.1225589007",
|
||||
Device.FORM_WEB_VNC: "entry.2055392048",
|
||||
Device.FORM_SCREEN_RESOLUTION: "entry.709976626",
|
||||
Device.FORM_DEVICE_TYPE: "entry.207096546",
|
||||
Device.FORM_EMU_DEVICE: "entry.1960740382",
|
||||
Device.FORM_EMU_ANDROID_VERSION: "entry.671872491",
|
||||
Device.FORM_EMU_NO_SKIN: "entry.403556951",
|
||||
Device.FORM_EMU_DATA_PARTITION: "entry.1052258875",
|
||||
Device.FORM_EMU_ADDITIONAL_ARGS: "entry.57529972"
|
||||
}
|
||||
self.form_data = {}
|
||||
signal.signal(signal.SIGTERM, self.tear_down)
|
||||
|
||||
def set_status(self, current_status) -> None:
|
||||
bashrc_file = f"{os.getenv(ENV.WORK_PATH)}/device_status"
|
||||
with open(bashrc_file, "w+") as bf:
|
||||
bf.write(current_status)
|
||||
# It won't work using docker exec
|
||||
# os.environ[constants.ENV_DEVICE_STATUS] = current_status
|
||||
|
||||
def _prepare_analytics_payload(self) -> None:
|
||||
self.form_data.update({
|
||||
self.form_field[Device.FORM_USER]: f"{platform.platform()}_{platform.version().replace(' ', '_')}",
|
||||
self.form_field[Device.FORM_APP_VERSION]: os.getenv(ENV.DOCKER_ANDROID_VERSION),
|
||||
self.form_field[Device.FORM_DEVICE_TYPE]: self.device_type,
|
||||
self.form_field[Device.FORM_WEB_VNC]: convert_str_to_bool(os.getenv(ENV.WEB_VNC)),
|
||||
self.form_field[Device.FORM_WEB_LOG]: convert_str_to_bool(os.getenv(ENV.WEB_LOG)),
|
||||
self.form_field[Device.FORM_APPIUM]: convert_str_to_bool(os.getenv(ENV.APPIUM))
|
||||
})
|
||||
|
||||
try:
|
||||
res = requests.get("https://ipinfo.io")
|
||||
if res.ok:
|
||||
json_res = res.json()
|
||||
self.form_data.update({
|
||||
self.form_field[Device.FORM_CITY]: json_res[Device.FORM_CITY],
|
||||
self.form_field[Device.FORM_REGION]: json_res[Device.FORM_REGION],
|
||||
self.form_field[Device.FORM_COUNTRY]: json_res[Device.FORM_COUNTRY]
|
||||
})
|
||||
except requests.exceptions.RequestException as rer:
|
||||
self.logger.warning(rer)
|
||||
pass
|
||||
except KeyError as ke:
|
||||
self.logger.warning(ke)
|
||||
pass
|
||||
|
||||
def create(self) -> None:
|
||||
if self.user_behavior_analytics:
|
||||
self.logger.info("Sending user behavior analytics to improve the tool")
|
||||
try:
|
||||
form_url = f"https://docs.google.com/forms/d/e/{Device.FORM_ID}/formResponse"
|
||||
self._prepare_analytics_payload()
|
||||
requests.post(url=form_url, data=self.form_data)
|
||||
except requests.exceptions.RequestException as rer:
|
||||
self.logger.warning(rer)
|
||||
pass
|
||||
self.set_status(DEVICE.STATUS_CREATING)
|
||||
|
||||
def start(self) -> None:
|
||||
self.set_status(DEVICE.STATUS_STARTING)
|
||||
|
||||
def wait_until_ready(self) -> None:
|
||||
self.set_status(DEVICE.STATUS_BOOTING)
|
||||
|
||||
def reconfigure(self) -> None:
|
||||
self.set_status(DEVICE.STATUS_RECONFIGURING)
|
||||
|
||||
def keep_alive(self) -> None:
|
||||
self.set_status(DEVICE.STATUS_READY)
|
||||
self.logger.warning(f"{self.device_type} process will be kept alive to be able to get sigterm signal...")
|
||||
while True:
|
||||
time.sleep(2)
|
||||
|
||||
@abstractmethod
|
||||
def tear_down(self, *args) -> None:
|
||||
pass
|
||||
|
||||
|
||||
class Genymotion(Device):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
self.logger = logging.getLogger(self.__class__.__name__)
|
||||
|
||||
def get_data_from_template(self, filename: str) -> dict:
|
||||
path_template_json = os.path.join(get_env_value_or_raise(ENV.GENYMOTION_TEMPLATE_PATH), filename)
|
||||
data = {}
|
||||
if os.path.isfile(path_template_json):
|
||||
try:
|
||||
self.logger.info(path_template_json)
|
||||
with open(path_template_json, "r") as f:
|
||||
data = json.load(f)
|
||||
except FileNotFoundError as fnf:
|
||||
self.shutdown_and_logout()
|
||||
self.logger.error(f"File cannot be found: {fnf}")
|
||||
except json.JSONDecodeError as jde:
|
||||
self.shutdown_and_logout()
|
||||
self.logger.error(f"Error Decoding Json: {jde}")
|
||||
except Exception as e:
|
||||
self.shutdown_and_logout()
|
||||
self.logger.error(e)
|
||||
else:
|
||||
self.shutdown_and_logout()
|
||||
raise RuntimeError(f"'{path_template_json}' cannot be found!")
|
||||
return data
|
||||
|
||||
@abstractmethod
|
||||
def login(self) -> None:
|
||||
pass
|
||||
|
||||
def create(self) -> None:
|
||||
super().create()
|
||||
self.login()
|
||||
|
||||
@abstractmethod
|
||||
def shutdown_and_logout(self) -> None:
|
||||
pass
|
||||
|
||||
def tear_down(self, *args) -> None:
|
||||
self.shutdown_and_logout()
|
||||
@@ -0,0 +1,264 @@
|
||||
import logging
|
||||
import os
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
from enum import Enum
|
||||
|
||||
from device import Device, DeviceType
|
||||
from helper import convert_str_to_bool, get_env_value_or_raise, symlink_force
|
||||
from constants import ENV, UTF8
|
||||
|
||||
|
||||
class Emulator(Device):
|
||||
DEVICE = (
|
||||
"Nexus 4",
|
||||
"Nexus 5",
|
||||
"Nexus 7",
|
||||
"Nexus One",
|
||||
"Nexus S",
|
||||
"Samsung Galaxy S6",
|
||||
"Samsung Galaxy S7",
|
||||
"Samsung Galaxy S7 Edge",
|
||||
"Samsung Galaxy S8",
|
||||
"Samsung Galaxy S9",
|
||||
"Samsung Galaxy S10",
|
||||
"Pixel C"
|
||||
)
|
||||
|
||||
API_LEVEL = {
|
||||
"9.0": "28",
|
||||
"10.0": "29",
|
||||
"11.0": "30",
|
||||
"12.0": "32",
|
||||
"13.0": "33",
|
||||
"14.0": "34"
|
||||
}
|
||||
|
||||
adb_name_id = 5554
|
||||
|
||||
class ReadinessCheck(Enum):
|
||||
BOOTED = "booted"
|
||||
RUN_STATE = "in running state"
|
||||
WELCOME_SCREEN = "in welcome screen"
|
||||
POP_UP_WINDOW = "pop up window"
|
||||
|
||||
def __init__(self, name: str, device: str, android_version: str, data_partition: str,
|
||||
additional_args: str, img_type: str, sys_img: str) -> None:
|
||||
super().__init__()
|
||||
self.logger = logging.getLogger(self.__class__.__name__)
|
||||
self.adb_name = f"emulator-{Emulator.adb_name_id}"
|
||||
self.device_type = DeviceType.EMULATOR.value
|
||||
self.name = name
|
||||
if device in self.DEVICE:
|
||||
self.device = device
|
||||
else:
|
||||
raise RuntimeError(f"device '{device}' is not supported!")
|
||||
if android_version in self.API_LEVEL.keys():
|
||||
self.android_version = android_version
|
||||
else:
|
||||
raise RuntimeError(f"android version '{android_version}' is not supported!")
|
||||
self.api_level = self.API_LEVEL[self.android_version]
|
||||
self.data_partition = data_partition
|
||||
self.additional_args = additional_args
|
||||
self.img_type = img_type
|
||||
self.sys_img = sys_img
|
||||
workdir = get_env_value_or_raise(ENV.WORK_PATH)
|
||||
self.path_device_profile_target = os.path.join(workdir, ".android", "devices.xml")
|
||||
self.path_emulator = os.path.join(workdir, "emulator")
|
||||
self.path_emulator_config = os.path.join(workdir, "emulator", "config.ini")
|
||||
self.path_emulator_profiles = os.path.join(workdir, "docker-android", "mixins",
|
||||
"configs", "devices", "profiles")
|
||||
self.path_emulator_skins = os.path.join(workdir, "docker-android", "mixins",
|
||||
"configs", "devices", "skins")
|
||||
self.file_name = self.device.replace(" ", "_").lower()
|
||||
self.no_skin = convert_str_to_bool(os.getenv(ENV.EMULATOR_NO_SKIN))
|
||||
self.interval_after_booting = 15
|
||||
Emulator.adb_name_id += 2
|
||||
self.form_data.update({
|
||||
self.form_field[Device.FORM_SCREEN_RESOLUTION]: f"{os.getenv(ENV.SCREEN_WIDTH)}x"
|
||||
f"{os.getenv(ENV.SCREEN_HEIGHT)}x"
|
||||
f"{os.getenv(ENV.SCREEN_DEPTH)}",
|
||||
self.form_field[Device.FORM_EMU_DEVICE]: self.device,
|
||||
self.form_field[Device.FORM_EMU_ANDROID_VERSION]: self.android_version,
|
||||
self.form_field[Device.FORM_EMU_NO_SKIN]: self.no_skin,
|
||||
self.form_field[Device.FORM_EMU_DATA_PARTITION]: self.data_partition,
|
||||
self.form_field[Device.FORM_EMU_ADDITIONAL_ARGS]: self.additional_args
|
||||
})
|
||||
|
||||
def is_initialized(self) -> bool:
|
||||
import re
|
||||
if os.path.exists(self.path_emulator_config):
|
||||
self.logger.info("Config file exists")
|
||||
with open(self.path_emulator_config, 'r') as f:
|
||||
if any(re.match(r'hw\.device\.name ?= ?{}'.format(self.device), line) for line in f):
|
||||
self.logger.info("Selected device is already created")
|
||||
return True
|
||||
else:
|
||||
self.logger.info("Selected device is not created")
|
||||
return False
|
||||
|
||||
self.logger.info("Config file does not exist")
|
||||
return False
|
||||
|
||||
def _add_profile(self) -> None:
|
||||
if "samsung" in self.device.lower():
|
||||
path_device_profile_source = os.path.join(self.path_emulator_profiles,
|
||||
"{fn}.xml".format(fn=self.file_name))
|
||||
symlink_force(path_device_profile_source, self.path_device_profile_target)
|
||||
self.logger.info("Samsung device profile is linked")
|
||||
|
||||
def _use_override_config(self) -> None:
|
||||
override_confg_path = os.getenv(ENV.EMULATOR_CONFIG_PATH)
|
||||
|
||||
if override_confg_path is None:
|
||||
self.logger.info(f"The environment variable 'EMULATOR_CONFIG_PATH' is not set")
|
||||
return
|
||||
|
||||
self.logger.info(f"Environment variable 'EMULATOR_CONFIG_PATH' found: {override_confg_path}")
|
||||
|
||||
if not os.path.isfile(override_confg_path):
|
||||
self.logger.warning(f"Source file '{override_confg_path}' does not exist.")
|
||||
return
|
||||
|
||||
if not os.access(override_confg_path, os.R_OK):
|
||||
self.logger.warning(f"Source file '{override_confg_path}' is not readable.")
|
||||
return
|
||||
|
||||
try:
|
||||
with open(override_confg_path, 'r') as src, open(self.path_emulator_config, 'a') as dst:
|
||||
dst.write(src.read())
|
||||
self.logger.info(f"Content from '{override_confg_path}' successfully appended to '{self.path_emulator_config}'.")
|
||||
except Exception as e:
|
||||
self.logger.error(f"An error occurred while copying file content: {e}")
|
||||
|
||||
def _add_skin(self) -> None:
|
||||
device_skin_path = os.path.join(
|
||||
self.path_emulator_skins, "{fn}".format(fn=self.file_name))
|
||||
with open(self.path_emulator_config, "a") as cf:
|
||||
cf.write("hw.keyboard=yes\n")
|
||||
cf.write("disk.dataPartition.size={dp}\n".format(dp=self.data_partition))
|
||||
cf.write("skin.path={sp}\n".format(
|
||||
sp="_no_skin" if self.no_skin else device_skin_path))
|
||||
self.logger.info(f"Skin is added in: '{self.path_emulator_config}'")
|
||||
|
||||
def create(self) -> None:
|
||||
super().create()
|
||||
first_run = not self.is_initialized()
|
||||
if first_run:
|
||||
self.logger.info(f"Creating the {self.device_type}...")
|
||||
self._add_profile()
|
||||
creation_cmd = "avdmanager create avd -f -n {n} -b {it}/{si} " \
|
||||
"-k 'system-images;android-{al};{it};{si}' " \
|
||||
"-d {d} -p {pe}".format(n=self.name, it=self.img_type, si=self.sys_img,
|
||||
al=self.api_level, d=self.device.replace(" ", "\ "),
|
||||
pe=self.path_emulator)
|
||||
self.logger.info(f"Command to create emulator: '{creation_cmd}'")
|
||||
subprocess.check_call(creation_cmd, shell=True)
|
||||
self._add_skin()
|
||||
self._use_override_config()
|
||||
self.logger.info(f"{self.device_type} is created!")
|
||||
|
||||
def change_permission(self) -> None:
|
||||
kvm_path = "/dev/kvm"
|
||||
if os.path.exists(kvm_path):
|
||||
cmds = (f"sudo chown 1300:1301 {kvm_path}",
|
||||
"sudo sed -i '1d' /etc/passwd")
|
||||
for c in cmds:
|
||||
subprocess.check_call(c, shell=True)
|
||||
self.logger.info("KVM permission is granted!")
|
||||
else:
|
||||
raise RuntimeError("/dev/kvm cannot be found!")
|
||||
|
||||
def deploy(self):
|
||||
self.logger.info(f"Deploying the {self.device_type}")
|
||||
|
||||
basic_cmd = "emulator @{n}".format(n=self.name)
|
||||
basic_args = "-gpu swiftshader_indirect -accel on -writable-system -verbose"
|
||||
wipe_arg = "-wipe-data" if not self.is_initialized() else ""
|
||||
|
||||
start_cmd = f"{basic_cmd} {basic_args} {wipe_arg} {self.additional_args}"
|
||||
self.logger.info(f"Command to run {self.device_type}: '{start_cmd}'")
|
||||
subprocess.Popen(start_cmd.split())
|
||||
|
||||
def start(self) -> None:
|
||||
super().start()
|
||||
self.change_permission()
|
||||
self.deploy()
|
||||
|
||||
def check_adb_command(self, readiness_check_type: ReadinessCheck, bash_command: str,
|
||||
expected_keyword: str, max_attempts: int, interval_waiting_time: int,
|
||||
adb_action: str = None) -> None:
|
||||
success = False
|
||||
for _ in range(1, max_attempts):
|
||||
if success:
|
||||
break
|
||||
else:
|
||||
try:
|
||||
output = subprocess.check_output(
|
||||
bash_command.split()).decode(UTF8)
|
||||
if expected_keyword in str(output).lower():
|
||||
if readiness_check_type is self.ReadinessCheck.POP_UP_WINDOW:
|
||||
subprocess.check_call(adb_action, shell=True)
|
||||
else:
|
||||
self.logger.info(
|
||||
f"{self.device_type} is {readiness_check_type.value}!")
|
||||
success = True
|
||||
else:
|
||||
self.logger.info(f"[attempt: {_}] {self.device_type} is not {readiness_check_type.value}! "
|
||||
f"will check again in {interval_waiting_time} seconds")
|
||||
time.sleep(interval_waiting_time)
|
||||
except subprocess.CalledProcessError:
|
||||
self.logger.warning("command cannot be executed! will continue...")
|
||||
time.sleep(2)
|
||||
continue
|
||||
else:
|
||||
if readiness_check_type is self.ReadinessCheck.POP_UP_WINDOW:
|
||||
self.logger.info(f"Pop up windows '{expected_keyword}' is not found!")
|
||||
else:
|
||||
raise RuntimeError(
|
||||
f"{readiness_check_type.value} is checked {_} times!")
|
||||
|
||||
def wait_until_ready(self) -> None:
|
||||
super().wait_until_ready()
|
||||
booting_cmd = f"adb -s {self.adb_name} wait-for-device shell getprop sys.boot_completed"
|
||||
focus_cmd = f"adb -s {self.adb_name} shell dumpsys window | grep -i mCurrentFocus"
|
||||
self.check_adb_command(self.ReadinessCheck.BOOTED,
|
||||
booting_cmd, "1", 60, self.interval_waiting)
|
||||
time.sleep(self.interval_after_booting)
|
||||
|
||||
interval_pop_up = 0
|
||||
max_attempt_pop_up = 3
|
||||
pop_up_system_ui = "Not Responding: com.android.systemui"
|
||||
system_ui_cmd = f"adb shell su root 'kill $(pidof com.android.systemui)'"
|
||||
pop_up_key_enter = {
|
||||
"Not Responding: com.google.android.gms",
|
||||
"Not Responding: system",
|
||||
"ConversationListActivity"
|
||||
}
|
||||
key_enter_cmd = "adb shell input keyevent KEYCODE_ENTER"
|
||||
self.check_adb_command(self.ReadinessCheck.POP_UP_WINDOW, focus_cmd, pop_up_system_ui,
|
||||
max_attempt_pop_up, interval_pop_up, system_ui_cmd)
|
||||
for pe in pop_up_key_enter:
|
||||
self.check_adb_command(self.ReadinessCheck.POP_UP_WINDOW, focus_cmd, pe, max_attempt_pop_up,
|
||||
interval_pop_up, key_enter_cmd)
|
||||
|
||||
self.check_adb_command(self.ReadinessCheck.WELCOME_SCREEN,
|
||||
focus_cmd, "launcheractivity", 60, self.interval_waiting)
|
||||
self.logger.info(f"{self.device_type} is ready to use")
|
||||
|
||||
def tear_down(self, *args) -> None:
|
||||
self.logger.warning("Sigterm is detected! Nothing to do!")
|
||||
|
||||
def __repr__(self) -> str:
|
||||
try:
|
||||
return "Emulator(name={n}, device={d}, adb_name={an}, android_version={av}, api_level={al}, " \
|
||||
"data_partition={dp}, additional_args={aa}, img_type={it}, sys_img={si}, " \
|
||||
"path_device_profile_target={pdpt}, path_emulator={pe}, path_emulator_config={pec}, " \
|
||||
"file={f})".format(n=self.name, d=self.device, an=self.adb_name, av=self.android_version,
|
||||
al=self.api_level, dp=self.data_partition, aa=self.additional_args,
|
||||
it=self.img_type, si=self.sys_img, pdpt=self.path_device_profile_target,
|
||||
pe=self.path_emulator, pec=self.path_emulator_config, f=self.file_name)
|
||||
except AttributeError as ae:
|
||||
self.logger.error(ae)
|
||||
return ""
|
||||
@@ -0,0 +1,223 @@
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
from device import Genymotion, DeviceType
|
||||
from helper import get_env_value_or_raise
|
||||
from constants import ENV, UTF8
|
||||
|
||||
|
||||
class GenyAWS(Genymotion):
|
||||
port = 5555
|
||||
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
self.logger = logging.getLogger(self.__class__.__name__)
|
||||
self.device_type = DeviceType.GENY_AWS.value
|
||||
self.workdir = get_env_value_or_raise(ENV.WORK_PATH)
|
||||
self.aws_credentials_path = os.path.join(self.workdir, ".aws")
|
||||
self.remove_cred_at_the_end = False # for logout
|
||||
self.geny_aws_template_path = os.path.join(self.workdir, "docker-android", "mixins",
|
||||
"templates", "genymotion", "aws")
|
||||
self.created_devices = {}
|
||||
|
||||
def login(self) -> None:
|
||||
aws_credentials_file = os.path.join(self.aws_credentials_path, "credentials")
|
||||
if os.path.exists(self.aws_credentials_path):
|
||||
self.logger.info(".aws is found! It will be used as credentials")
|
||||
else:
|
||||
self.logger.info(".aws cannot be found! the template will be used!")
|
||||
self.remove_cred_at_the_end = True
|
||||
aws_credentials_template_path = os.path.join(self.geny_aws_template_path, ".aws")
|
||||
shutil.move(aws_credentials_template_path, self.aws_credentials_path)
|
||||
|
||||
aws_key_id = get_env_value_or_raise(ENV.AWS_ACCESS_KEY_ID)
|
||||
aws_secret_key = get_env_value_or_raise(ENV.AWS_SECRET_ACCESS_KEY)
|
||||
replacements_cred = {
|
||||
f"<{ENV.AWS_ACCESS_KEY_ID.lower()}>": aws_key_id,
|
||||
f"<{ENV.AWS_SECRET_ACCESS_KEY.lower()}>": aws_secret_key
|
||||
}
|
||||
with open(aws_credentials_file, 'r+') as cred_file:
|
||||
cred_file_contents = cred_file.read()
|
||||
for old_str, new_str in replacements_cred.items():
|
||||
cred_file_contents = cred_file_contents.replace(old_str, new_str)
|
||||
cred_file.seek(0)
|
||||
cred_file.write(cred_file_contents)
|
||||
cred_file.truncate()
|
||||
self.logger.info("aws credentials is set!")
|
||||
|
||||
def create_ssh_key(self) -> None:
|
||||
subprocess.check_call('ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa -N ""', shell=True)
|
||||
self.logger.info("ssh key is created!")
|
||||
|
||||
def create_tf_files(self) -> None:
|
||||
try:
|
||||
for item in self.get_data_from_template(ENV.GENY_AWS_TEMPLATE_FILE_NAME):
|
||||
name = item["name"]
|
||||
region = item["region"]
|
||||
ami = item["ami"]
|
||||
instance_type = item["instance_type"]
|
||||
if "security_group" in item:
|
||||
sg = item["security_group"]
|
||||
tf_content = f'''
|
||||
provider "aws" {{
|
||||
alias = "provider_{name}"
|
||||
region = "{region}"
|
||||
}}
|
||||
|
||||
resource "aws_key_pair" "geny_key_{name}" {{
|
||||
provider = aws.provider_{name}
|
||||
public_key = file("~/.ssh/id_rsa.pub")
|
||||
}}
|
||||
|
||||
resource "aws_instance" "geny_aws_{name}" {{
|
||||
provider = aws.provider_{name}
|
||||
ami = "{ami}"
|
||||
instance_type = "{instance_type}"
|
||||
vpc_security_group_ids = ["{sg}"]
|
||||
key_name = aws_key_pair.geny_key_{name}.key_name
|
||||
tags = {{
|
||||
Name = "DockerAndroid-GenyAWS-{ami}.id}}"
|
||||
}}
|
||||
|
||||
provisioner "remote-exec" {{
|
||||
connection {{
|
||||
type = "ssh"
|
||||
user = "shell"
|
||||
host = self.public_ip
|
||||
private_key = file("~/.ssh/id_rsa")
|
||||
}}
|
||||
script = "/home/androidusr/docker-android/mixins/scripts/genymotion/aws/enable_adb.sh"
|
||||
}}
|
||||
}}
|
||||
|
||||
output "public_dns_{name}" {{
|
||||
value = aws_instance.geny_aws_{name}.public_dns
|
||||
}}
|
||||
'''
|
||||
else:
|
||||
ingress_rules = json.dumps(item["ingress_rules"])
|
||||
egress_rules = json.dumps(item["egress_rules"])
|
||||
tf_content = f'''
|
||||
locals {{
|
||||
ingress_rules = {ingress_rules}
|
||||
egress_rules = {egress_rules}
|
||||
}}
|
||||
|
||||
provider "aws" {{
|
||||
alias = "provider_{name}"
|
||||
region = "{region}"
|
||||
}}
|
||||
|
||||
resource "aws_security_group" "geny_sg_{name}" {{
|
||||
provider = aws.provider_{name}
|
||||
dynamic "ingress" {{
|
||||
for_each = local.ingress_rules
|
||||
content {{
|
||||
from_port = ingress.value.from_port
|
||||
to_port = ingress.value.to_port
|
||||
protocol = ingress.value.protocol
|
||||
cidr_blocks = ingress.value.cidr_blocks
|
||||
}}
|
||||
}}
|
||||
|
||||
dynamic "egress" {{
|
||||
for_each = local.egress_rules
|
||||
content {{
|
||||
from_port = egress.value.from_port
|
||||
to_port = egress.value.to_port
|
||||
protocol = egress.value.protocol
|
||||
cidr_blocks = egress.value.cidr_blocks
|
||||
}}
|
||||
}}
|
||||
}}
|
||||
|
||||
resource "aws_key_pair" "geny_key_{name}" {{
|
||||
provider = aws.provider_{name}
|
||||
public_key = file("~/.ssh/id_rsa.pub")
|
||||
}}
|
||||
|
||||
resource "aws_instance" "geny_aws_{name}" {{
|
||||
provider = aws.provider_{name}
|
||||
ami = "{ami}"
|
||||
instance_type = "{instance_type}"
|
||||
vpc_security_group_ids = [aws_security_group.geny_sg_{name}.name]
|
||||
key_name = aws_key_pair.geny_key_{name}.key_name
|
||||
tags = {{
|
||||
Name = "DockerAndroid-GenyAWS-{ami}.id}}"
|
||||
}}
|
||||
|
||||
provisioner "remote-exec" {{
|
||||
connection {{
|
||||
type = "ssh"
|
||||
user = "shell"
|
||||
host = self.public_ip
|
||||
private_key = file("~/.ssh/id_rsa")
|
||||
}}
|
||||
script = "/home/androidusr/docker-android/mixins/scripts/genymotion/aws/enable_adb.sh"
|
||||
}}
|
||||
}}
|
||||
|
||||
output "public_dns_{name}" {{
|
||||
value = aws_instance.geny_aws_{name}.public_dns
|
||||
}}
|
||||
'''
|
||||
tf_deployment_filename = f"{name}.tf"
|
||||
self.created_devices[name] = GenyAWS.port
|
||||
GenyAWS.port += 1
|
||||
with open(tf_deployment_filename, "w") as df:
|
||||
df.write(tf_content)
|
||||
self.logger.info("Terraform files are created!")
|
||||
except Exception as e:
|
||||
self.logger.error(e)
|
||||
self.shutdown_and_logout()
|
||||
|
||||
def deploy_tf(self) -> None:
|
||||
try:
|
||||
cmds = (
|
||||
"terraform init",
|
||||
"terraform plan",
|
||||
"terraform apply -auto-approve"
|
||||
)
|
||||
for c in cmds:
|
||||
subprocess.check_call(c, shell=True)
|
||||
self.logger.info("Genymotion-Device(s) are deployed on AWS")
|
||||
except subprocess.CalledProcessError as cpe:
|
||||
self.logger.error(cpe)
|
||||
self.shutdown_and_logout()
|
||||
|
||||
def connect_with_local_adb(self) -> None:
|
||||
self.logger.info(f"created devices: {self.created_devices}")
|
||||
try:
|
||||
for d, p in self.created_devices.items():
|
||||
dns_cmd = f"terraform output public_dns_{d}"
|
||||
dns_ip = subprocess.check_output(dns_cmd.split()).decode(UTF8).replace('"', '')
|
||||
tunnel_cmd = f"ssh -i ~/.ssh/id_rsa -o ServerAliveInterval=60 -o StrictHostKeyChecking=no -q -NL " \
|
||||
f"{p}:localhost:5555 shell@{dns_ip}"
|
||||
subprocess.Popen(tunnel_cmd.split())
|
||||
time.sleep(10)
|
||||
subprocess.check_call(f"adb connect localhost:{p} >/dev/null 2>&1", shell=True)
|
||||
except Exception as e:
|
||||
self.logger.error(e)
|
||||
self.shutdown_and_logout()
|
||||
|
||||
def create(self) -> None:
|
||||
super().create()
|
||||
self.create_ssh_key()
|
||||
self.create_tf_files()
|
||||
self.deploy_tf()
|
||||
self.connect_with_local_adb()
|
||||
|
||||
def shutdown_and_logout(self) -> None:
|
||||
try:
|
||||
subprocess.check_call("terraform destroy -auto-approve -lock=false", shell=True)
|
||||
self.logger.info("device(s) is successfully removed!")
|
||||
except subprocess.CalledProcessError as cpe:
|
||||
self.logger.error(cpe)
|
||||
finally:
|
||||
if self.remove_cred_at_the_end:
|
||||
subprocess.check_call(f"rm -rf {self.aws_credentials_path}", shell=True)
|
||||
self.logger.info("successfully logged out!")
|
||||
@@ -0,0 +1,141 @@
|
||||
import logging
|
||||
import os
|
||||
import subprocess
|
||||
import concurrent.futures
|
||||
import uuid
|
||||
|
||||
from device import Genymotion, DeviceType
|
||||
from helper import get_env_value_or_raise
|
||||
from constants import ENV, UTF8
|
||||
|
||||
class GenySAAS(Genymotion):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
self.logger = logging.getLogger(self.__class__.__name__)
|
||||
self.device_type = DeviceType.GENY_SAAS.value
|
||||
self.created_devices = []
|
||||
|
||||
def login(self) -> None:
|
||||
if os.getenv(ENV.GENY_AUTH_TOKEN):
|
||||
auth_token = get_env_value_or_raise(ENV.GENY_AUTH_TOKEN)
|
||||
subprocess.check_call(f"gmsaas auth token {auth_token} > /dev/null 2>&1", shell=True)
|
||||
else:
|
||||
user = get_env_value_or_raise(ENV.GENY_SAAS_USER)
|
||||
password = get_env_value_or_raise(ENV.GENY_SAAS_PASS)
|
||||
subprocess.check_call(f"gmsaas auth login {user} {password} > /dev/null 2>&1", shell=True)
|
||||
self.logger.info("successfully logged in!")
|
||||
|
||||
def create(self) -> None:
|
||||
super().create()
|
||||
|
||||
# Collect all items first
|
||||
items = []
|
||||
for item in self.get_data_from_template(ENV.GENY_SAAS_TEMPLATE_FILE_NAME):
|
||||
name = ""
|
||||
template = ""
|
||||
local_port = ""
|
||||
# implement like this because local_port param is not a must
|
||||
for k, v in item.items():
|
||||
if k.lower() == "name":
|
||||
name = v
|
||||
elif k.lower() == "template":
|
||||
template = v
|
||||
elif k.lower() == "local_port":
|
||||
local_port = v
|
||||
else:
|
||||
self.logger.warning(f"'{k}' is not supported! Please check the documentation!")
|
||||
|
||||
if not name:
|
||||
name = str(uuid.uuid4())
|
||||
|
||||
if not template:
|
||||
self.shutdown_and_logout()
|
||||
raise RuntimeError(f"'template' is a must parameter and not given!")
|
||||
|
||||
items.append({
|
||||
'name': name,
|
||||
'template': template,
|
||||
'local_port': local_port
|
||||
})
|
||||
|
||||
# Start all devices in parallel
|
||||
with concurrent.futures.ThreadPoolExecutor(max_workers=100) as executor:
|
||||
try:
|
||||
# Submit all tasks
|
||||
future_to_item = {executor.submit(self.create_instance, item): item for item in items}
|
||||
|
||||
# Collect results as they complete
|
||||
for future in concurrent.futures.as_completed(future_to_item):
|
||||
item = future_to_item[future]
|
||||
try:
|
||||
created_device = future.result()
|
||||
self.created_devices.append(created_device)
|
||||
self.logger.info(f"Successfully created device: {created_device}")
|
||||
except Exception as e:
|
||||
self.logger.error(f"Instance creation failed for {item['name']}: {e}")
|
||||
self.shutdown_and_logout()
|
||||
exit(1)
|
||||
|
||||
except Exception as e:
|
||||
self.shutdown_and_logout()
|
||||
self.logger.error(f"Parallel execution failed: {e}")
|
||||
exit(1)
|
||||
|
||||
def create_instance(self, item_data):
|
||||
"""Create a single instance and return the result"""
|
||||
name = item_data['name']
|
||||
template = item_data['template']
|
||||
local_port = item_data['local_port']
|
||||
|
||||
self.logger.info(f"name: {name}, template: {template}")
|
||||
creation_cmd = f"gmsaas instances start {template} {name}"
|
||||
|
||||
try:
|
||||
instance_id = subprocess.check_output(creation_cmd.split()).decode(UTF8).replace("\n", "")
|
||||
|
||||
# Connect to ADB
|
||||
additional_args = ""
|
||||
if local_port:
|
||||
additional_args = f"--adb-serial-port {local_port}"
|
||||
connect_cmd = f"gmsaas instances adbconnect {instance_id} {additional_args}"
|
||||
subprocess.check_call(f"{connect_cmd}", shell=True)
|
||||
|
||||
return {f"{name}": instance_id}
|
||||
|
||||
except Exception as e:
|
||||
self.logger.error(f"Failed to create instance {name}: {e}")
|
||||
raise e
|
||||
|
||||
def stop_instance(self, device_info):
|
||||
"""Stop a single instance"""
|
||||
for name, instance_id in device_info.items():
|
||||
try:
|
||||
subprocess.check_call(f"gmsaas instances stop {instance_id}", shell=True)
|
||||
self.logger.info(f"device '{name}' is successfully removed!")
|
||||
return True
|
||||
except Exception as e:
|
||||
self.logger.error(f"Failed to stop device '{name}': {e}")
|
||||
return False
|
||||
|
||||
def shutdown_and_logout(self) -> None:
|
||||
if bool(self.created_devices):
|
||||
self.logger.info("Created device(s) will be removed!")
|
||||
|
||||
# Stop all devices in parallel
|
||||
with concurrent.futures.ThreadPoolExecutor(max_workers=100) as executor:
|
||||
# Submit all stop tasks
|
||||
futures = [executor.submit(self.stop_instance, device) for device in self.created_devices]
|
||||
|
||||
# Wait for all to complete
|
||||
for future in concurrent.futures.as_completed(futures):
|
||||
try:
|
||||
future.result()
|
||||
except Exception as e:
|
||||
self.logger.error(f"Error during device shutdown: {e}")
|
||||
|
||||
# Logout after all devices are stopped
|
||||
if os.getenv(ENV.GENY_AUTH_TOKEN):
|
||||
subprocess.check_call("gmsaas auth reset", shell=True)
|
||||
else:
|
||||
subprocess.check_call("gmsaas auth logout", shell=True)
|
||||
self.logger.info("successfully logged out!")
|
||||
@@ -0,0 +1,56 @@
|
||||
import logging
|
||||
import os
|
||||
|
||||
logger = logging.getLogger("helper")
|
||||
|
||||
|
||||
def convert_str_to_bool(given_str: str) -> bool:
|
||||
"""
|
||||
Convert String to Boolean value
|
||||
|
||||
:param given_str: given string
|
||||
:return: converted string in Boolean
|
||||
"""
|
||||
if given_str:
|
||||
if type(given_str) is str:
|
||||
return given_str.lower() in ("yes", "true", "t", "1")
|
||||
else:
|
||||
raise AttributeError
|
||||
else:
|
||||
logger.info(f"'{given_str}' is empty!")
|
||||
return False
|
||||
|
||||
|
||||
def get_env_value_or_raise(env_key: str) -> str:
|
||||
"""
|
||||
Get value of necessary environment variable.
|
||||
|
||||
:param env_key: given environment variable
|
||||
:return: env_value in String
|
||||
"""
|
||||
try:
|
||||
env_value = os.getenv(env_key)
|
||||
if not env_value:
|
||||
raise RuntimeError(f"'{env_key}' is missing.")
|
||||
elif env_value.isspace():
|
||||
raise RuntimeError(f"'{env_key}' contains only white space.")
|
||||
return env_value
|
||||
except TypeError as t_err:
|
||||
logger.error(t_err)
|
||||
|
||||
|
||||
def symlink_force(source: str, target: str) -> None:
|
||||
"""
|
||||
Create Symbolic link
|
||||
|
||||
:param source: source file
|
||||
:param target: target file
|
||||
:return: None
|
||||
"""
|
||||
try:
|
||||
os.symlink(source, target)
|
||||
except FileNotFoundError as ffe_err:
|
||||
logger.error(ffe_err)
|
||||
except FileExistsError:
|
||||
os.remove(target)
|
||||
os.symlink(source, target)
|
||||
@@ -0,0 +1,3 @@
|
||||
import os
|
||||
|
||||
LOGGING_FILE = os.path.join(os.path.dirname(__file__), 'logging.conf')
|
||||
@@ -1,9 +1,7 @@
|
||||
import logging
|
||||
import logging.config
|
||||
|
||||
from src import LOGGING_FILE
|
||||
from logger import LOGGING_FILE
|
||||
|
||||
|
||||
def init():
|
||||
"""Init log."""
|
||||
logging.config.fileConfig(LOGGING_FILE)
|
||||
@@ -1,5 +1,5 @@
|
||||
[loggers]
|
||||
keys=root, app
|
||||
keys=root
|
||||
|
||||
[handlers]
|
||||
keys=console
|
||||
@@ -11,16 +11,11 @@ keys=formatter
|
||||
level=INFO
|
||||
handlers=console
|
||||
|
||||
[logger_app]
|
||||
level=INFO
|
||||
handlers=console
|
||||
propagate=0
|
||||
qualname=app
|
||||
|
||||
[handler_console]
|
||||
class=StreamHandler
|
||||
formatter=formatter
|
||||
args=(sys.stdout,)
|
||||
|
||||
[formatter_formatter]
|
||||
format=[%(process)2d] [%(levelname)5s] %(name)s - %(message)s
|
||||
format=%(asctime)s %(levelname)s %(name)s - %(message)s
|
||||
datefmt=%Y-%m-%d %H:%M:%S
|
||||
@@ -0,0 +1,9 @@
|
||||
from unittest import TestCase
|
||||
|
||||
|
||||
class BaseTest(TestCase):
|
||||
def setUp(self) -> None:
|
||||
pass
|
||||
|
||||
def tearDown(self) -> None:
|
||||
pass
|
||||
@@ -0,0 +1,21 @@
|
||||
import os
|
||||
|
||||
from constants import ENV
|
||||
from tests import BaseTest
|
||||
|
||||
|
||||
class BaseDeviceTest(BaseTest):
|
||||
DEVICE_ENVS = {
|
||||
ENV.WORK_PATH: "/home/androidusr",
|
||||
ENV.USER_BEHAVIOR_ANALYTICS: str(False),
|
||||
ENV.EMULATOR_NO_SKIN: str(False)
|
||||
}
|
||||
|
||||
def setUp(self) -> None:
|
||||
for k, v in self.DEVICE_ENVS.items():
|
||||
os.environ[k] = v
|
||||
|
||||
def tearDown(self) -> None:
|
||||
for k in self.DEVICE_ENVS.keys():
|
||||
if os.environ[k]:
|
||||
del os.environ[k]
|
||||
@@ -0,0 +1,8 @@
|
||||
from device import Device
|
||||
from tests.device import BaseDeviceTest
|
||||
|
||||
|
||||
class TestDevice(BaseDeviceTest):
|
||||
def test_create_device(self):
|
||||
with self.assertRaises(TypeError):
|
||||
Device()
|
||||
@@ -0,0 +1,86 @@
|
||||
import mock
|
||||
|
||||
from device.emulator import Emulator
|
||||
from tests.device import BaseDeviceTest
|
||||
|
||||
|
||||
class TestEmulator(BaseDeviceTest):
|
||||
def setUp(self) -> None:
|
||||
super().setUp()
|
||||
self.name = "my_emu"
|
||||
self.device = "Nexus 4"
|
||||
self.a_version = "10.0"
|
||||
self.d_partition = "550m"
|
||||
self.additional_args = ""
|
||||
self.i_type = "google_apis"
|
||||
self.s_img = "x86"
|
||||
self.emu = Emulator(self.name, self.device, self.a_version, self.d_partition,
|
||||
self.additional_args, self.i_type, self.s_img)
|
||||
|
||||
def tearDown(self) -> None:
|
||||
super().tearDown()
|
||||
|
||||
def test_adb_name(self):
|
||||
my_emu = Emulator("my_other_emu", self.device, self.a_version, self.d_partition,
|
||||
self.additional_args, self.i_type, self.s_img)
|
||||
self.assertNotEqual(self.emu.adb_name, my_emu.adb_name)
|
||||
|
||||
def test_invalid_device(self):
|
||||
with self.assertRaises(RuntimeError):
|
||||
Emulator("my_other_emu", "unknown device", self.a_version, self.d_partition,
|
||||
self.additional_args, self.i_type, self.s_img)
|
||||
with self.assertRaises(RuntimeError):
|
||||
Emulator("my_other_emu", "NEXUS 5", self.a_version, self.d_partition,
|
||||
self.additional_args, self.i_type, self.s_img)
|
||||
|
||||
def test_invalid_android_version(self):
|
||||
with self.assertRaises(RuntimeError):
|
||||
Emulator("my_other_emu", self.device, "0.0", self.d_partition,
|
||||
self.additional_args, self.i_type, self.s_img)
|
||||
|
||||
@mock.patch("os.path.exists", mock.MagicMock(return_value=False))
|
||||
def test_initialisation_config_not_exist(self):
|
||||
self.assertEqual(self.emu.is_initialized(), False)
|
||||
|
||||
@mock.patch("os.path.exists", mock.MagicMock(return_value=True))
|
||||
@mock.patch("builtins.open", mock.mock_open(read_data=""))
|
||||
def test_initialisation_device_not_exist(self):
|
||||
self.assertEqual(self.emu.is_initialized(), False)
|
||||
|
||||
@mock.patch("os.path.exists", mock.MagicMock(return_value=True))
|
||||
@mock.patch("builtins.open", mock.mock_open(read_data="hw.device.name=Nexus 4\n"))
|
||||
def test_initialisation_device_exists(self):
|
||||
self.assertEqual(self.emu.is_initialized(), True)
|
||||
|
||||
def test_check_adb_command(self):
|
||||
with mock.patch("subprocess.check_output", mock.MagicMock(return_value="1".encode("utf-8"))):
|
||||
self.emu.check_adb_command(
|
||||
self.emu.ReadinessCheck.BOOTED, "mocked_command", "1", 3, 0)
|
||||
|
||||
def test_check_adb_command_out_of_attempts(self):
|
||||
with mock.patch("subprocess.check_output", mock.MagicMock(return_value=" ".encode("utf-8"))):
|
||||
with self.assertRaises(RuntimeError):
|
||||
self.emu.check_adb_command(
|
||||
self.emu.ReadinessCheck.BOOTED, "mocked_command", "1", 3, 0)
|
||||
|
||||
def test_use_override_config_no_env(self):
|
||||
with mock.patch("os.getenv", return_value=None):
|
||||
self.emu._use_override_config()
|
||||
|
||||
def test_use_override_config_file_not_exist(self):
|
||||
with mock.patch("os.getenv", return_value="mock/path/to/config"):
|
||||
with mock.patch("os.path.isfile", return_value=False):
|
||||
self.emu._use_override_config()
|
||||
|
||||
def test_use_override_config_file_not_readable(self):
|
||||
with mock.patch("os.getenv", return_value="mock/path/to/config"):
|
||||
with mock.patch("os.path.isfile", return_value=True):
|
||||
with mock.patch("os.access", return_value=False):
|
||||
self.emu._use_override_config()
|
||||
|
||||
def test_use_override_config_malformed_content(self):
|
||||
with mock.patch("os.getenv", return_value="mock/path/to/config"):
|
||||
with mock.patch("os.path.isfile", return_value=True):
|
||||
with mock.patch("os.access", return_value=True):
|
||||
with mock.patch("builtins.open", mock.mock_open(read_data="malformed data")):
|
||||
self.emu._use_override_config()
|
||||
@@ -0,0 +1,69 @@
|
||||
import os
|
||||
import mock
|
||||
|
||||
from helper import convert_str_to_bool, get_env_value_or_raise, symlink_force
|
||||
from tests import BaseTest
|
||||
|
||||
|
||||
class TestHelperMethods(BaseTest):
|
||||
def test_boolean_converter_with_valid_str(self):
|
||||
self.assertEqual(convert_str_to_bool("TRUE"), True)
|
||||
self.assertEqual(convert_str_to_bool("true"), True)
|
||||
self.assertEqual(convert_str_to_bool("T"), True)
|
||||
self.assertEqual(convert_str_to_bool("Yes"), True)
|
||||
self.assertEqual(convert_str_to_bool("1"), True)
|
||||
self.assertEqual(convert_str_to_bool("False"), False)
|
||||
self.assertEqual(convert_str_to_bool("f"), False)
|
||||
self.assertEqual(convert_str_to_bool("0"), False)
|
||||
|
||||
def test_boolean_converter_with_empty(self):
|
||||
self.assertEqual(convert_str_to_bool(None), False)
|
||||
self.assertEqual(convert_str_to_bool(""), False)
|
||||
|
||||
def test_boolean_converter_with_invalid_str(self):
|
||||
self.assertEqual(convert_str_to_bool(" "), False)
|
||||
self.assertEqual(convert_str_to_bool("test"), False)
|
||||
|
||||
def test_boolean_converter_with_invalid_format(self):
|
||||
with self.assertRaises(AttributeError):
|
||||
convert_str_to_bool(True)
|
||||
|
||||
def test_get_env_value_from_valid_key(self):
|
||||
env_key = "env_key01"
|
||||
os.environ[env_key] = "env_value01"
|
||||
get_env_value_or_raise(env_key)
|
||||
del os.environ[env_key]
|
||||
|
||||
def test_get_env_value_with_empty_string(self):
|
||||
with self.assertRaises(RuntimeError):
|
||||
env_key = "env_key01"
|
||||
os.environ[env_key] = " "
|
||||
get_env_value_or_raise(env_key)
|
||||
del os.environ[env_key]
|
||||
|
||||
def test_get_env_value_from_invalid_key(self):
|
||||
with self.assertRaises(RuntimeError):
|
||||
get_env_value_or_raise("env_key02")
|
||||
|
||||
def test_symlink(self):
|
||||
s = os.path.join("source.txt")
|
||||
t = os.path.join("target_file.txt")
|
||||
open(s, "a").close()
|
||||
symlink_force(s, t)
|
||||
os.remove(s)
|
||||
os.remove(t)
|
||||
|
||||
def test_symlink_already_exist(self):
|
||||
s = os.path.join("source.txt")
|
||||
t = os.path.join("target_file.txt")
|
||||
open(s, "a").close()
|
||||
open(t, "a").close()
|
||||
symlink_force(s, t)
|
||||
os.remove(s)
|
||||
os.remove(t)
|
||||
|
||||
def test_symlink_file_not_exists(self):
|
||||
s = os.path.join("source.txt")
|
||||
t = os.path.join("target_file.txt")
|
||||
symlink_force(s, t)
|
||||
os.remove(t)
|
||||
@@ -0,0 +1,4 @@
|
||||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file
|
||||
!.gitignore
|
||||
|
Before Width: | Height: | Size: 112 KiB |
|
Before Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 53 KiB |
@@ -1,59 +0,0 @@
|
||||
parts {
|
||||
device {
|
||||
display {
|
||||
width 720
|
||||
height 1280
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
}
|
||||
portrait {
|
||||
background {
|
||||
image port_back.png
|
||||
}
|
||||
onion {
|
||||
image port_fore.png
|
||||
}
|
||||
}
|
||||
landscape {
|
||||
background {
|
||||
image land_back.png
|
||||
}
|
||||
onion {
|
||||
image land_fore.png
|
||||
}
|
||||
}
|
||||
}
|
||||
layouts {
|
||||
portrait {
|
||||
width 1101
|
||||
height 1709
|
||||
event EV_SW:0:1
|
||||
part1 {
|
||||
name portrait
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
part2 {
|
||||
name device
|
||||
x 192
|
||||
y 213
|
||||
}
|
||||
}
|
||||
landscape {
|
||||
width 1847
|
||||
height 886
|
||||
event EV_SW:0:0
|
||||
part1 {
|
||||
name landscape
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
part2 {
|
||||
name device
|
||||
x 304
|
||||
y 788
|
||||
rotation 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 81 KiB |
|
Before Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 45 KiB |
|
Before Width: | Height: | Size: 7.6 KiB |
|
Before Width: | Height: | Size: 557 KiB |
|
Before Width: | Height: | Size: 68 KiB |
|
Before Width: | Height: | Size: 72 KiB |
@@ -1,59 +0,0 @@
|
||||
parts {
|
||||
device {
|
||||
display {
|
||||
width 1600
|
||||
height 2560
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
}
|
||||
portrait {
|
||||
background {
|
||||
image port_back.png
|
||||
}
|
||||
onion {
|
||||
image port_fore.png
|
||||
}
|
||||
}
|
||||
landscape {
|
||||
background {
|
||||
image land_back.png
|
||||
}
|
||||
onion {
|
||||
image land_fore.png
|
||||
}
|
||||
}
|
||||
}
|
||||
layouts {
|
||||
portrait {
|
||||
width 2330
|
||||
height 3136
|
||||
event EV_SW:0:1
|
||||
part1 {
|
||||
name portrait
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
part2 {
|
||||
name device
|
||||
x 366
|
||||
y 266
|
||||
}
|
||||
}
|
||||
landscape {
|
||||
width 3340
|
||||
height 2176
|
||||
event EV_SW:0:0
|
||||
part1 {
|
||||
name landscape
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
part2 {
|
||||
name device
|
||||
x 388
|
||||
y 1866
|
||||
rotation 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 511 KiB |
|
Before Width: | Height: | Size: 65 KiB |
|
Before Width: | Height: | Size: 86 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 806 KiB |
|
Before Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 39 KiB |
@@ -1,59 +0,0 @@
|
||||
parts {
|
||||
device {
|
||||
display {
|
||||
width 1080
|
||||
height 1920
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
}
|
||||
portrait {
|
||||
background {
|
||||
image port_back.png
|
||||
}
|
||||
onion {
|
||||
image port_fore.png
|
||||
}
|
||||
}
|
||||
landscape {
|
||||
background {
|
||||
image land_back.png
|
||||
}
|
||||
onion {
|
||||
image land_fore.png
|
||||
}
|
||||
}
|
||||
}
|
||||
layouts {
|
||||
portrait {
|
||||
width 1370
|
||||
height 2446
|
||||
event EV_SW:0:1
|
||||
part1 {
|
||||
name portrait
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
part2 {
|
||||
name device
|
||||
x 147
|
||||
y 233
|
||||
}
|
||||
}
|
||||
landscape {
|
||||
width 2497
|
||||
height 1234
|
||||
event EV_SW:0:0
|
||||
part1 {
|
||||
name landscape
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
part2 {
|
||||
name device
|
||||
x 278
|
||||
y 1143
|
||||
rotation 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 820 KiB |
|
Before Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 62 KiB |
|
Before Width: | Height: | Size: 690 KiB |
|
Before Width: | Height: | Size: 221 KiB |
|
Before Width: | Height: | Size: 60 KiB |
@@ -1,59 +0,0 @@
|
||||
parts {
|
||||
device {
|
||||
display {
|
||||
width 1440
|
||||
height 2560
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
}
|
||||
portrait {
|
||||
background {
|
||||
image port_back.png
|
||||
}
|
||||
onion {
|
||||
image port_fore.png
|
||||
}
|
||||
}
|
||||
landscape {
|
||||
background {
|
||||
image land_back.png
|
||||
}
|
||||
onion {
|
||||
image land_fore.png
|
||||
}
|
||||
}
|
||||
}
|
||||
layouts {
|
||||
portrait {
|
||||
width 1896
|
||||
height 3054
|
||||
event EV_SW:0:1
|
||||
part1 {
|
||||
name portrait
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
part2 {
|
||||
name device
|
||||
x 229
|
||||
y 239
|
||||
}
|
||||
}
|
||||
landscape {
|
||||
width 3142
|
||||
height 1639
|
||||
event EV_SW:0:0
|
||||
part1 {
|
||||
name landscape
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
part2 {
|
||||
name device
|
||||
x 318
|
||||
y 1516
|
||||
rotation 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 779 KiB |
|
Before Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 92 KiB |
|
Before Width: | Height: | Size: 959 KiB |
|
Before Width: | Height: | Size: 72 KiB |
|
Before Width: | Height: | Size: 63 KiB |
@@ -1,59 +0,0 @@
|
||||
parts {
|
||||
device {
|
||||
display {
|
||||
width 1440
|
||||
height 2560
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
}
|
||||
portrait {
|
||||
background {
|
||||
image port_back.png
|
||||
}
|
||||
onion {
|
||||
image port_fore.png
|
||||
}
|
||||
}
|
||||
landscape {
|
||||
background {
|
||||
image land_back.png
|
||||
}
|
||||
onion {
|
||||
image land_fore.png
|
||||
}
|
||||
}
|
||||
}
|
||||
layouts {
|
||||
portrait {
|
||||
width 1840
|
||||
height 3251
|
||||
event EV_SW:0:1
|
||||
part1 {
|
||||
name portrait
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
part2 {
|
||||
name device
|
||||
x 195
|
||||
y 329
|
||||
}
|
||||
}
|
||||
landscape {
|
||||
width 3427
|
||||
height 1620
|
||||
event EV_SW:0:0
|
||||
part1 {
|
||||
name landscape
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
part2 {
|
||||
name device
|
||||
x 442
|
||||
y 1511
|
||||
rotation 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1001 KiB |
|
Before Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 94 KiB |
|
Before Width: | Height: | Size: 1.5 MiB |
|
Before Width: | Height: | Size: 64 KiB |
|
Before Width: | Height: | Size: 67 KiB |
@@ -1,59 +0,0 @@
|
||||
parts {
|
||||
device {
|
||||
display {
|
||||
width 1536
|
||||
height 2048
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
}
|
||||
portrait {
|
||||
background {
|
||||
image port_back.png
|
||||
}
|
||||
onion {
|
||||
image port_fore.png
|
||||
}
|
||||
}
|
||||
landscape {
|
||||
background {
|
||||
image land_back.png
|
||||
}
|
||||
onion {
|
||||
image land_fore.png
|
||||
}
|
||||
}
|
||||
}
|
||||
layouts {
|
||||
portrait {
|
||||
width 1978
|
||||
height 2631
|
||||
event EV_SW:0:1
|
||||
part1 {
|
||||
name portrait
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
part2 {
|
||||
name device
|
||||
x 219
|
||||
y 264
|
||||
}
|
||||
}
|
||||
landscape {
|
||||
width 2854
|
||||
height 1785
|
||||
event EV_SW:0:0
|
||||
part1 {
|
||||
name landscape
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
part2 {
|
||||
name device
|
||||
x 401
|
||||
y 1635
|
||||
rotation 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.7 MiB |
|
Before Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 67 KiB |
|
Before Width: | Height: | Size: 493 KiB |
|
Before Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 60 KiB |
@@ -1,59 +0,0 @@
|
||||
parts {
|
||||
device {
|
||||
display {
|
||||
width 1800
|
||||
height 2560
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
}
|
||||
portrait {
|
||||
background {
|
||||
image port_back.png
|
||||
}
|
||||
onion {
|
||||
image port_fore.png
|
||||
}
|
||||
}
|
||||
landscape {
|
||||
background {
|
||||
image land_back.png
|
||||
}
|
||||
onion {
|
||||
image land_fore.png
|
||||
}
|
||||
}
|
||||
}
|
||||
layouts {
|
||||
portrait {
|
||||
width 2307
|
||||
height 2971
|
||||
event EV_SW:0:1
|
||||
part1 {
|
||||
name portrait
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
part2 {
|
||||
name device
|
||||
x 259
|
||||
y 181
|
||||
}
|
||||
}
|
||||
landscape {
|
||||
width 3096
|
||||
height 2215
|
||||
event EV_SW:0:0
|
||||
part1 {
|
||||
name landscape
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
part2 {
|
||||
name device
|
||||
x 269
|
||||
y 1988
|
||||
rotation 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 368 KiB |
|
Before Width: | Height: | Size: 67 KiB |
|
Before Width: | Height: | Size: 54 KiB |
@@ -1,3 +0,0 @@
|
||||
Sources:
|
||||
1. Android Studio IDE
|
||||
2. http://developer.samsung.com/technical-doc/view.do?v=T000000095
|
||||
@@ -1,114 +0,0 @@
|
||||
# Note: It requires docker-compose 1.13.0
|
||||
#
|
||||
# Usage: docker-compose up -d
|
||||
version: "2.2"
|
||||
|
||||
services:
|
||||
# Selenium hub
|
||||
selenium_hub:
|
||||
image: selenium/hub:3.12.0-americium
|
||||
ports:
|
||||
- 4444:4444
|
||||
|
||||
# There is a bug for using appium. Issue: https://github.com/butomo1989/docker-android/issues/73
|
||||
# Real devices
|
||||
#real_device:
|
||||
# image: butomo1989/docker-android-real-device
|
||||
# privileged: true
|
||||
# depends_on:
|
||||
# - selenium_hub
|
||||
# ports:
|
||||
# - 6080:6080
|
||||
# volumes:
|
||||
# - ./video-real-device:/tmp/video
|
||||
# - /dev/bus/usb:/dev/bus/usb
|
||||
# - ~/.android:/root/.android
|
||||
# environment:
|
||||
# - CONNECT_TO_GRID=true
|
||||
# - APPIUM=true
|
||||
# - SELENIUM_HOST=selenium_hub
|
||||
# - AUTO_RECORD=true
|
||||
# - BROWSER_NAME=chrome
|
||||
|
||||
# Using Appium Docker Android
|
||||
real_device:
|
||||
image: appium/appium
|
||||
depends_on:
|
||||
- selenium_hub
|
||||
network_mode: "service:selenium_hub"
|
||||
privileged: true
|
||||
volumes:
|
||||
- /dev/bus/usb:/dev/bus/usb
|
||||
- ~/.android:/root/.android
|
||||
- $PWD/example/sample_apk:/root/tmp
|
||||
environment:
|
||||
- CONNECT_TO_GRID=true
|
||||
- SELENIUM_HOST=selenium_hub
|
||||
# Enable it for msite testing
|
||||
#- BROWSER_NAME=chrome
|
||||
|
||||
# Docker-Android for Android application testing
|
||||
nexus_7.1.1:
|
||||
image: butomo1989/docker-android-x86-7.1.1
|
||||
privileged: true
|
||||
# Increase scale number if needed
|
||||
scale: 1
|
||||
depends_on:
|
||||
- selenium_hub
|
||||
- real_device
|
||||
ports:
|
||||
- 6080
|
||||
# Change path of apk that you want to test. I use sample_apk that I provide in folder "example"
|
||||
volumes:
|
||||
- $PWD/example/sample_apk:/opt
|
||||
- ./video-nexus_7.1.1:/tmp/video
|
||||
environment:
|
||||
- DEVICE=Nexus 5
|
||||
- CONNECT_TO_GRID=true
|
||||
- APPIUM=true
|
||||
- SELENIUM_HOST=selenium_hub
|
||||
- AUTO_RECORD=true
|
||||
|
||||
# Docker-Android for mobile website testing with chrome browser
|
||||
# Chrome browser exists only for version 7.0 and 7.1.1
|
||||
samsung_galaxy_web_7.1.1:
|
||||
image: butomo1989/docker-android-x86-7.1.1
|
||||
privileged: true
|
||||
# Increase scale number if needed
|
||||
scale: 1
|
||||
depends_on:
|
||||
- selenium_hub
|
||||
- real_device
|
||||
ports:
|
||||
- 6080
|
||||
volumes:
|
||||
- ./video-samsung_7.1.1:/tmp/video
|
||||
environment:
|
||||
- DEVICE=Samsung Galaxy S6
|
||||
- CONNECT_TO_GRID=true
|
||||
- APPIUM=true
|
||||
- SELENIUM_HOST=selenium_hub
|
||||
- MOBILE_WEB_TEST=true
|
||||
- AUTO_RECORD=true
|
||||
|
||||
# Docker-Android for mobile website testing with default browser
|
||||
# Default browser exists only for version 5.0.1, 5.1.1 and 6.0
|
||||
samsung_galaxy_web_5.1.1:
|
||||
image: butomo1989/docker-android-x86-5.1.1
|
||||
privileged: true
|
||||
# Increase scale number if needed
|
||||
scale: 1
|
||||
depends_on:
|
||||
- selenium_hub
|
||||
- real_device
|
||||
ports:
|
||||
- 6080
|
||||
volumes:
|
||||
- ./video-samsung_5.1.1:/tmp/video
|
||||
environment:
|
||||
- DEVICE=Samsung Galaxy S6
|
||||
- CONNECT_TO_GRID=true
|
||||
- APPIUM=true
|
||||
- SELENIUM_HOST=selenium_hub
|
||||
- MOBILE_WEB_TEST=true
|
||||
- AUTO_RECORD=true
|
||||
@@ -1,146 +0,0 @@
|
||||
FROM appium/appium:1.8.1-p2
|
||||
|
||||
LABEL maintainer "Budi Utomo <budi.ut.1989@gmail.com>"
|
||||
|
||||
#=============
|
||||
# Set WORKDIR
|
||||
#=============
|
||||
WORKDIR /root
|
||||
|
||||
#==================
|
||||
# General Packages
|
||||
#------------------
|
||||
# xterm
|
||||
# Terminal emulator
|
||||
# supervisor
|
||||
# Process manager
|
||||
# socat
|
||||
# Port forwarder
|
||||
#------------------
|
||||
# NoVNC Packages
|
||||
#------------------
|
||||
# x11vnc
|
||||
# VNC server for X display
|
||||
# openbox
|
||||
# Windows manager
|
||||
# menu
|
||||
# Debian menu
|
||||
# python-numpy
|
||||
# Numpy, For faster performance: https://github.com/novnc/websockify/issues/77
|
||||
# net-tools
|
||||
# Netstat
|
||||
#------------------
|
||||
# Video Recording
|
||||
#------------------
|
||||
# ffmpeg
|
||||
# Video recorder
|
||||
# jq
|
||||
# Sed for JSON data
|
||||
#==================
|
||||
RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \
|
||||
xterm \
|
||||
supervisor \
|
||||
socat \
|
||||
x11vnc \
|
||||
openbox \
|
||||
menu \
|
||||
python-numpy \
|
||||
net-tools \
|
||||
ffmpeg \
|
||||
jq \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
#=======
|
||||
# noVNC
|
||||
# Use same commit id that docker-selenium uses
|
||||
# https://github.com/elgalu/docker-selenium/blob/236b861177bd2917d864e52291114b1f5e4540d7/Dockerfile#L412-L413
|
||||
#=======
|
||||
ENV NOVNC_SHA="b403cb92fb8de82d04f305b4f14fa978003890d7" \
|
||||
WEBSOCKIFY_SHA="558a6439f14b0d85a31145541745e25c255d576b"
|
||||
RUN wget -nv -O noVNC.zip "https://github.com/kanaka/noVNC/archive/${NOVNC_SHA}.zip" \
|
||||
&& unzip -x noVNC.zip \
|
||||
&& rm noVNC.zip \
|
||||
&& mv noVNC-${NOVNC_SHA} noVNC \
|
||||
&& wget -nv -O websockify.zip "https://github.com/kanaka/websockify/archive/${WEBSOCKIFY_SHA}.zip" \
|
||||
&& unzip -x websockify.zip \
|
||||
&& mv websockify-${WEBSOCKIFY_SHA} ./noVNC/utils/websockify \
|
||||
&& rm websockify.zip \
|
||||
&& ln noVNC/vnc_auto.html noVNC/index.html
|
||||
|
||||
#======================
|
||||
# Install SDK packages
|
||||
#======================
|
||||
ARG ANDROID_VERSION=5.0.1
|
||||
ARG API_LEVEL=21
|
||||
ARG PROCESSOR=x86
|
||||
ARG SYS_IMG=x86_64
|
||||
ARG IMG_TYPE=google_apis
|
||||
ARG BROWSER=android
|
||||
ENV ANDROID_VERSION=$ANDROID_VERSION \
|
||||
API_LEVEL=$API_LEVEL \
|
||||
PROCESSOR=$PROCESSOR \
|
||||
SYS_IMG=$SYS_IMG \
|
||||
IMG_TYPE=$IMG_TYPE \
|
||||
BROWSER=$BROWSER
|
||||
ENV PATH ${PATH}:${ANDROID_HOME}/build-tools
|
||||
RUN echo y | sdkmanager "platforms;android-${API_LEVEL}" && \
|
||||
echo y | sdkmanager "system-images;android-${API_LEVEL};${IMG_TYPE};${SYS_IMG}" && \
|
||||
echo y | sdkmanager "emulator"
|
||||
RUN rm ${ANDROID_HOME}/tools/emulator \
|
||||
&& ln -s ${ANDROID_HOME}/emulator/emulator64-${PROCESSOR} ${ANDROID_HOME}/tools/emulator
|
||||
ENV LD_LIBRARY_PATH=$ANDROID_HOME/emulator/lib64:$ANDROID_HOME/emulator/lib64/qt/lib
|
||||
|
||||
#==============================================
|
||||
# Download chrome driver v2.26
|
||||
# to be able to use chrome browser in emulator
|
||||
# Issue: https://github.com/butomo1989/docker-android/commit/6406504f944dae73d0a0c5d8e71a17a47dff9b33
|
||||
#==============================================
|
||||
RUN wget -nv -O chrome.zip "https://chromedriver.storage.googleapis.com/2.26/chromedriver_linux64.zip" \
|
||||
&& unzip -x chrome.zip \
|
||||
&& rm chrome.zip
|
||||
|
||||
#================================================
|
||||
# noVNC Default Configurations
|
||||
# These Configurations can be changed through -e
|
||||
#================================================
|
||||
ENV DISPLAY=:0 \
|
||||
SCREEN=0 \
|
||||
SCREEN_WIDTH=1600 \
|
||||
SCREEN_HEIGHT=900 \
|
||||
SCREEN_DEPTH=16 \
|
||||
LOCAL_PORT=5900 \
|
||||
TARGET_PORT=6080 \
|
||||
TIMEOUT=1 \
|
||||
VIDEO_PATH=/tmp/video \
|
||||
LOG_PATH=/var/log/supervisor
|
||||
|
||||
#===============
|
||||
# Expose Ports
|
||||
#---------------
|
||||
# 4723
|
||||
# Appium port
|
||||
# 6080
|
||||
# noVNC port
|
||||
# 5554
|
||||
# Emulator port
|
||||
# 5555
|
||||
# ADB connection port
|
||||
#===============
|
||||
EXPOSE 4723 6080 5554 5555
|
||||
|
||||
#======================
|
||||
# Add Emulator Devices
|
||||
#======================
|
||||
COPY devices /root/devices
|
||||
|
||||
#===================
|
||||
# Run docker-appium
|
||||
#===================
|
||||
COPY src /root/src
|
||||
COPY supervisord.conf /root/
|
||||
RUN chmod -R +x /root/src && chmod +x /root/supervisord.conf
|
||||
|
||||
HEALTHCHECK --interval=2s --timeout=40s --retries=1 \
|
||||
CMD adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done'
|
||||
|
||||
CMD /usr/bin/supervisord --configuration supervisord.conf
|
||||
@@ -1,160 +0,0 @@
|
||||
FROM appium/appium:1.8.1-p2
|
||||
|
||||
LABEL maintainer "Budi Utomo <budi.ut.1989@gmail.com>"
|
||||
|
||||
#=============
|
||||
# Set WORKDIR
|
||||
#=============
|
||||
WORKDIR /root
|
||||
|
||||
#==================
|
||||
# General Packages
|
||||
#------------------
|
||||
# xterm
|
||||
# Terminal emulator
|
||||
# supervisor
|
||||
# Process manager
|
||||
# socat
|
||||
# Port forwarder
|
||||
#------------------
|
||||
# NoVNC Packages
|
||||
#------------------
|
||||
# x11vnc
|
||||
# VNC server for X display
|
||||
# openbox
|
||||
# Windows manager
|
||||
# menu
|
||||
# Debian menu
|
||||
# python-numpy
|
||||
# Numpy, For faster performance: https://github.com/novnc/websockify/issues/77
|
||||
# net-tools
|
||||
# Netstat
|
||||
#------------------
|
||||
# Video Recording
|
||||
#------------------
|
||||
# ffmpeg
|
||||
# Video recorder
|
||||
# jq
|
||||
# Sed for JSON data
|
||||
#------------------
|
||||
# KVM Package
|
||||
# for emulator x86
|
||||
# https://help.ubuntu.com/community/KVM/Installation
|
||||
#------------------
|
||||
# qemu-kvm
|
||||
# libvirt-bin
|
||||
# ubuntu-vm-builder
|
||||
# bridge-utils
|
||||
#==================
|
||||
RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \
|
||||
xterm \
|
||||
supervisor \
|
||||
socat \
|
||||
x11vnc \
|
||||
openbox \
|
||||
menu \
|
||||
python-numpy \
|
||||
net-tools \
|
||||
ffmpeg \
|
||||
jq \
|
||||
qemu-kvm \
|
||||
libvirt-bin \
|
||||
ubuntu-vm-builder \
|
||||
bridge-utils \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
#=======
|
||||
# noVNC
|
||||
# Use same commit id that docker-selenium uses
|
||||
# https://github.com/elgalu/docker-selenium/blob/236b861177bd2917d864e52291114b1f5e4540d7/Dockerfile#L412-L413
|
||||
#=======
|
||||
ENV NOVNC_SHA="b403cb92fb8de82d04f305b4f14fa978003890d7" \
|
||||
WEBSOCKIFY_SHA="558a6439f14b0d85a31145541745e25c255d576b"
|
||||
RUN wget -nv -O noVNC.zip "https://github.com/kanaka/noVNC/archive/${NOVNC_SHA}.zip" \
|
||||
&& unzip -x noVNC.zip \
|
||||
&& rm noVNC.zip \
|
||||
&& mv noVNC-${NOVNC_SHA} noVNC \
|
||||
&& wget -nv -O websockify.zip "https://github.com/kanaka/websockify/archive/${WEBSOCKIFY_SHA}.zip" \
|
||||
&& unzip -x websockify.zip \
|
||||
&& mv websockify-${WEBSOCKIFY_SHA} ./noVNC/utils/websockify \
|
||||
&& rm websockify.zip \
|
||||
&& ln noVNC/vnc_auto.html noVNC/index.html
|
||||
|
||||
#======================
|
||||
# Install SDK packages
|
||||
#======================
|
||||
ARG ANDROID_VERSION=5.0.1
|
||||
ARG API_LEVEL=21
|
||||
ARG PROCESSOR=x86
|
||||
ARG SYS_IMG=x86_64
|
||||
ARG IMG_TYPE=google_apis
|
||||
ARG BROWSER=android
|
||||
ENV ANDROID_VERSION=$ANDROID_VERSION \
|
||||
API_LEVEL=$API_LEVEL \
|
||||
PROCESSOR=$PROCESSOR \
|
||||
SYS_IMG=$SYS_IMG \
|
||||
IMG_TYPE=$IMG_TYPE \
|
||||
BROWSER=$BROWSER
|
||||
ENV PATH ${PATH}:${ANDROID_HOME}/build-tools
|
||||
RUN echo y | sdkmanager "platforms;android-${API_LEVEL}" && \
|
||||
echo y | sdkmanager "system-images;android-${API_LEVEL};${IMG_TYPE};${SYS_IMG}" && \
|
||||
echo y | sdkmanager "emulator"
|
||||
RUN rm ${ANDROID_HOME}/tools/emulator \
|
||||
&& ln -s ${ANDROID_HOME}/emulator/emulator64-${PROCESSOR} ${ANDROID_HOME}/tools/emulator
|
||||
ENV LD_LIBRARY_PATH=$ANDROID_HOME/emulator/lib64:$ANDROID_HOME/emulator/lib64/qt/lib
|
||||
|
||||
|
||||
#==============================================
|
||||
# Download chrome driver v2.26
|
||||
# to be able to use chrome browser in emulator
|
||||
# Issue: https://github.com/butomo1989/docker-android/commit/6406504f944dae73d0a0c5d8e71a17a47dff9b33
|
||||
#==============================================
|
||||
RUN wget -nv -O chrome.zip "https://chromedriver.storage.googleapis.com/2.26/chromedriver_linux64.zip" \
|
||||
&& unzip -x chrome.zip \
|
||||
&& rm chrome.zip
|
||||
|
||||
#================================================
|
||||
# noVNC Default Configurations
|
||||
# These Configurations can be changed through -e
|
||||
#================================================
|
||||
ENV DISPLAY=:0 \
|
||||
SCREEN=0 \
|
||||
SCREEN_WIDTH=1600 \
|
||||
SCREEN_HEIGHT=900 \
|
||||
SCREEN_DEPTH=16 \
|
||||
LOCAL_PORT=5900 \
|
||||
TARGET_PORT=6080 \
|
||||
TIMEOUT=1 \
|
||||
VIDEO_PATH=/tmp/video \
|
||||
LOG_PATH=/var/log/supervisor
|
||||
|
||||
#===============
|
||||
# Expose Ports
|
||||
#---------------
|
||||
# 4723
|
||||
# Appium port
|
||||
# 6080
|
||||
# noVNC port
|
||||
# 5554
|
||||
# Emulator port
|
||||
# 5555
|
||||
# ADB connection port
|
||||
#===============
|
||||
EXPOSE 4723 6080 5554 5555
|
||||
|
||||
#======================
|
||||
# Add Emulator Devices
|
||||
#======================
|
||||
COPY devices /root/devices
|
||||
|
||||
#===================
|
||||
# Run docker-appium
|
||||
#===================
|
||||
COPY src /root/src
|
||||
COPY supervisord.conf /root/
|
||||
RUN chmod -R +x /root/src && chmod +x /root/supervisord.conf
|
||||
|
||||
HEALTHCHECK --interval=2s --timeout=40s --retries=1 \
|
||||
CMD adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done'
|
||||
|
||||
CMD /usr/bin/supervisord --configuration supervisord.conf
|
||||