Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
48eb6bf9ae | ||
|
|
f8940c79f5 | ||
|
|
4b7d2aa125 | ||
|
|
d4832ad2b8 | ||
|
|
54d5365907 | ||
|
|
2922e3ba92 | ||
|
|
820b6e0e0e | ||
|
|
75514ef1f0 | ||
|
|
ab34ca36d9 | ||
|
|
15f6541621 | ||
|
|
99c1b1f6b6 | ||
|
|
32258461be | ||
|
|
b7f332fd3b | ||
|
|
09068f20c5 | ||
|
|
59bf049159 | ||
|
|
d6b69863ca | ||
|
|
68d0c2fc81 | ||
|
|
5b89a28198 | ||
|
|
705be0e3c9 | ||
|
|
b5f8c28fc1 | ||
|
|
79f797213c | ||
|
|
424b6bb2ec | ||
|
|
efccb144a4 | ||
|
|
a960f34381 | ||
|
|
11e3428145 | ||
|
|
cde35287c7 | ||
|
|
29898ba91e | ||
|
|
2d25517bfa | ||
|
|
e3219ac24b | ||
|
|
c4fb6243c5 | ||
|
|
d021fd69e6 | ||
|
|
cacfe568a2 | ||
|
|
9d0c66fb2b | ||
|
|
cb100330ad | ||
|
|
bc0972318f | ||
|
|
2b02843cfd | ||
|
|
3a88fa4ae4 | ||
|
|
398a694ccd | ||
|
|
14a29344b8 | ||
|
|
47621a7ccb | ||
|
|
c1d66496fb | ||
|
|
1365ec736b | ||
|
|
4aee17de2d | ||
|
|
5c9ad32522 | ||
|
|
366aa8b3b3 | ||
|
|
905f2c723b | ||
|
|
0e028d9a4a | ||
|
|
ce61b992f9 | ||
|
|
e62573036c | ||
|
|
e27b2e5fdf | ||
|
|
fdd4a86c40 | ||
|
|
15012fd3b4 | ||
|
|
1f440e1a07 | ||
|
|
567a494ccb | ||
|
|
d28c4dc5e0 | ||
|
|
7a052b7e2f | ||
|
|
988397318f | ||
|
|
0d6356ba47 | ||
|
|
0ea71ea6b8 | ||
|
|
08ff64d950 | ||
|
|
fcffca21ff | ||
|
|
95adfd1fbd | ||
|
|
5029d33528 | ||
|
|
c9ab42ecfb | ||
|
|
7c48af9b84 | ||
|
|
e1d6e3cdbe | ||
|
|
648010d519 | ||
|
|
9d3cb60f41 | ||
|
|
e2ad6b75d2 | ||
|
|
486fb5825b | ||
|
|
e56eb0e3ab | ||
|
|
6fe6a80f40 | ||
|
|
f7b30c3129 | ||
|
|
1062da3dcc | ||
|
|
c431118465 | ||
|
|
b6a1a57bed | ||
|
|
83baa09384 | ||
|
|
8a69c64de3 | ||
|
|
488e53149c | ||
|
|
2bc30edf4c | ||
|
|
8d544448f1 | ||
|
|
f7b560a28b | ||
|
|
0e578710f3 | ||
|
|
65df456066 | ||
|
|
5b694c2c55 | ||
|
|
6406504f94 | ||
|
|
b7c4538896 | ||
|
|
c7d988bd61 | ||
|
|
47e968927a | ||
|
|
dcf196ec4a | ||
|
|
aff1b062e1 | ||
|
|
59f6e4bd33 | ||
|
|
0b9af7e6b2 | ||
|
|
d9b5f8d86c | ||
|
|
0360c181c0 | ||
|
|
47ff7bf223 | ||
|
|
bedf77e83d | ||
|
|
151e3a8d6f | ||
|
|
7170ee20d4 | ||
|
|
768d793ba0 | ||
|
|
5501a20426 | ||
|
|
1a7453d6b6 | ||
|
|
d379133801 | ||
|
|
333c2b2a90 | ||
|
|
ab45f6bb52 | ||
|
|
a2e59992d9 | ||
|
|
e9ed10d08c | ||
|
|
d1a1bb5fa7 | ||
|
|
c3c7f9506f |
@@ -0,0 +1 @@
|
|||||||
|
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
**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,12 @@
|
|||||||
|
### 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. -->
|
||||||
@@ -6,4 +6,4 @@
|
|||||||
.coverage
|
.coverage
|
||||||
coverage.xml
|
coverage.xml
|
||||||
xunit.xml
|
xunit.xml
|
||||||
coverage/*
|
coverage/*
|
||||||
|
|||||||
@@ -11,12 +11,16 @@ services:
|
|||||||
install: "pip install -r requirements.txt"
|
install: "pip install -r requirements.txt"
|
||||||
|
|
||||||
env:
|
env:
|
||||||
matrix:
|
- ANDROID_VERSION=5.0.1
|
||||||
- ANDROID_VERSION=5.0.1
|
- ANDROID_VERSION=5.1.1
|
||||||
- ANDROID_VERSION=5.1.1
|
- ANDROID_VERSION=6.0
|
||||||
- ANDROID_VERSION=6.0
|
- ANDROID_VERSION=7.0
|
||||||
- ANDROID_VERSION=7.0
|
- ANDROID_VERSION=7.1.1
|
||||||
- ANDROID_VERSION=7.1.1
|
- ANDROID_VERSION=8.0
|
||||||
|
- ANDROID_VERSION=8.1
|
||||||
|
- ANDROID_VERSION=9.0
|
||||||
|
- REAL_DEVICE=True
|
||||||
|
- GENYMOTION=True
|
||||||
|
|
||||||
script: bash travis.sh
|
script: bash travis.sh
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
# Docker-Android's Anonymous Aggregate User Behaviour Analytics
|
||||||
|
Docker-Android has begun gathering anonymous aggregate user behaviour analytics and reporting these to Google Analytics. You are notified about this when you start Docker-Android.
|
||||||
|
|
||||||
|
## Why?
|
||||||
|
Docker-Android is provided free of charge for our internal and external users and we don't have direct communication with its users nor time resources to ask directly for their feedback. As a result, we now use anonymous aggregate user analytics to help us understand how Docker-Android is being used, the most common used features based on how, where and when people use it. With this information we can prioritize some features over other ones.
|
||||||
|
|
||||||
|
## What?
|
||||||
|
Docker-Android's analytics record some shared information for every event:
|
||||||
|
|
||||||
|
- The Google Analytics version i.e. `1` (https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#v)
|
||||||
|
- The Google Analytics anonymous IP setting is enabled i.e. `1` (https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#aip)
|
||||||
|
- The Docker-Android analytics tracking ID e.g. `UA-128205228-1` (https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#tid)
|
||||||
|
- The release version of machine, e.g. `Linux_version_4.4.16-boot2docker_(gcc_version_4.9.2_(Debian_4.9.2-10)_)_#1_SMP_Fri_Jul_29_00:13:24_UTC_2016` This does not allow us to track individual users but does enable us to accurately measure user counts vs. event counts (https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#cid)
|
||||||
|
- Docker-Android analytics hit type, e.g. `event` (https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#t)
|
||||||
|
- Application type, e.g. `Emulator` (https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#ec)
|
||||||
|
- Description will contains information about Emulator configuration, e.g. `Processor type`. (https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#el)
|
||||||
|
- Docker-Android application name, e.g. `docker-android` (https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#an)
|
||||||
|
- Docker-Android application version, e.g. `1.5-p0` (https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#av)
|
||||||
|
|
||||||
|
With the recorded information, it is not possible for us to match any particular real user.
|
||||||
|
|
||||||
|
As far as we can tell it would be impossible for Google to match the randomly generated analytics user ID to any other Google Analytics user ID. If Google turned evil the only thing they could do would be to lie about anonymising IP addresses and attempt to match users based on IP addresses.
|
||||||
|
|
||||||
|
## When/Where?
|
||||||
|
Docker-Android's analytics are sent throughout Docker-Android's execution to Google Analytics over HTTPS.
|
||||||
|
|
||||||
|
## Who?
|
||||||
|
Docker-Android's analytics are accessible to Docker-Android's current maintainers. Contact [@butomo1989](https://github.com/butomo1989) if you are a maintainer and need access.
|
||||||
|
|
||||||
|
## How?
|
||||||
|
The code is viewable in [this lines](./src/appium.sh#L225-L247).
|
||||||
|
|
||||||
|
## Opting out before starting Docker-Android
|
||||||
|
Docker-Android analytics helps us, maintainers and leaving it on is appreciated. However, if you want to opt out and not send any information, you can do this by using passing environment variable GA=false to the Docker container.
|
||||||
|
|
||||||
|
## Disclaimer
|
||||||
|
This document and the implementation are based on the great idea implemented by [Homebrew](https://github.com/Homebrew/brew/blob/master/docs/Analytics.md)
|
||||||
@@ -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,36 @@
|
|||||||
|
## License Information
|
||||||
|
|
||||||
|
Copyright 2016 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 Analytics tracking ID: UA-128205228-1 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. Anonymisation with respect of the IP address means that only the first two octets of the IP address are collected.
|
||||||
|
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
* Release version of Docker-Android
|
||||||
|
* Anonymized IP address (only first two octets)
|
||||||
|
* Country and city
|
||||||
|
* Date and time when Docker-Android started
|
||||||
|
* User (it will collect the information about Release Version of Machine)
|
||||||
|
* Application type, e.g. Emulator or Device or Genymotion
|
||||||
|
* Emulator configuration, e.g. Processor type, Device name, Appium mode, Selenium grid mode and mobile test mode
|
||||||
|
|
||||||
|
## End of License Information
|
||||||
|
|
||||||
|
More information about anonymized data collection can be seen [here](Analytics.md)
|
||||||
@@ -1,19 +1,23 @@
|
|||||||
Docker-Android
|
<p align="center">
|
||||||
==============
|
<img id="header" src="./images/logo_dockerandroid_small.png" />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
[](https://github.com/igrigorik/ga-beacon "Analytics")
|
||||||
|
[](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://travis-ci.org/butomo1989/docker-android)
|
||||||
[](https://codecov.io/gh/butomo1989/docker-android)
|
[](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)
|
||||||
|
|
||||||
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 mobile website testing and Android project.
|
||||||
|
|
||||||
Samsung Device | Google Device
|
Emulator - Samsung Device | Emulator - Nexus Device | Real Device
|
||||||
:---------------------------:|:---------------------------:
|
:---------------------------:|:---------------------------:|:---------------------------:
|
||||||
![][docker android samsung] | ![][docker android nexus]
|
![][emulator samsung] |![][emulator nexus] |![][real device]
|
||||||
|
|
||||||
Purpose
|
Purposes
|
||||||
-------
|
--------
|
||||||
|
|
||||||
1. Run UI tests for mobile websites with ([appium])
|
1. Run UI tests for mobile websites with [appium]
|
||||||
2. Build Android project and run unit tests with the latest build-tools
|
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.)
|
3. Run UI tests for Android applications with different frameworks ([appium], [espresso], [robotium], etc.)
|
||||||
4. Run monkey / stress tests
|
4. Run monkey / stress tests
|
||||||
@@ -26,23 +30,26 @@ Advantages compare with other docker-android projects
|
|||||||
2. Emulator for different devices / skins, such as Samsung Galaxy S6, LG Nexus 4, HTC Nexus One and more.
|
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
|
3. Ability to connect to Selenium Grid
|
||||||
4. Ability to control emulator from outside container by using adb connect
|
4. Ability to control emulator from outside container by using adb connect
|
||||||
5. Open source with more features coming (monkey test, support real devices with screen mirroring and video recording)
|
5. Support real devices with screen mirroring
|
||||||
|
6. Ability to record video during test execution for debugging
|
||||||
|
7. Integrated with other cloud solutions, e.g. [Genymotion Cloud](https://www.genymotion.com/cloud/)
|
||||||
|
8. Open source with more features coming
|
||||||
|
|
||||||
List of Docker images
|
List of Docker images
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
|Supported OS |Android version |API level |Image name |Image status |
|
|OS |Android |API |Browser |Browser version |Chromedriver |Image |Size |
|
||||||
|:---|:---|:---|:---|:---:|
|
|:---|:---|:---|:---|:---|:---|:---|:---|
|
||||||
|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.0.1|21|browser|37.0|2.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|5.1.1|22|browser|39.0|2.13|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|6.0|23|browser|44.0|2.18|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.0|24|chrome|51.0|2.23|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")|
|
|Linux|7.1.1|25|chrome|55.0|2.28|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")|
|
|Linux|8.0|26|chrome|58.0|2.31|butomo1989/docker-android-x86-8.0|[](https://microbadger.com/images/butomo1989/docker-android-x86-8.0 "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")|
|
|Linux|8.1|27|chrome|61.0|2.33|butomo1989/docker-android-x86-8.1|[](https://microbadger.com/images/butomo1989/docker-android-x86-8.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")|
|
|Linux|9.0|28|chrome|66.0|2.40|butomo1989/docker-android-x86-9.0|[](https://microbadger.com/images/butomo1989/docker-android-x86-9.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")|
|
|All |-|-|-|-|-|butomo1989/docker-android-real-device|[](https://microbadger.com/images/butomo1989/docker-android-real-device "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")|
|
|Linux|All|All|All|All|All|butomo1989/docker-android-genymotion|[](https://microbadger.com/images/butomo1989/docker-android-genymotion "Get your own image badge on microbadger.com")|
|
||||||
|
|
||||||
List of Devices
|
List of Devices
|
||||||
---------------
|
---------------
|
||||||
@@ -64,19 +71,16 @@ Docker is installed in your system.
|
|||||||
Quick Start
|
Quick Start
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
1. Run docker-android
|
1. Run Docker-Android
|
||||||
|
|
||||||
- For ***Linux OS***, please use image name that contains "x86"
|
- For ***Linux OS***, please use image name that contains "x86"
|
||||||
|
|
||||||
```bash
|
```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
|
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-8.1
|
||||||
```
|
```
|
||||||
|
|
||||||
- For ***OSX*** and ***Windows OS***, please use image name that contains "arm"
|
- For ***OSX*** and ***Windows OS***, please use Virtual Machine that support Virtualization with Ubuntu OS
|
||||||
|
|
||||||
```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
|
|
||||||
```
|
|
||||||
|
|
||||||
2. Verify the ip address of docker host.
|
2. Verify the ip address of docker host.
|
||||||
|
|
||||||
@@ -90,39 +94,59 @@ Quick Start
|
|||||||
|
|
||||||
3. Open ***http://docker-host-ip-address:6080*** from web browser.
|
3. Open ***http://docker-host-ip-address:6080*** from web browser.
|
||||||
|
|
||||||
Run Appium Server
|
Custom configurations
|
||||||
-----------------
|
---------------------
|
||||||
|
|
||||||
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***.
|
[This document](README_CUSTOM_CONFIG.md) contains custom configurations of Docker-Android that you might need, e.g. Proxy, Changing language on fly, etc.
|
||||||
|
|
||||||
```bash
|
Build Android project
|
||||||
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
|
---------------------
|
||||||
```
|
|
||||||
|
|
||||||
### Connect to Selenium Grid
|
Docker-Android can be used for building Android project and executing its unit test. This following steps will illustrate how to build Android project:
|
||||||
|
|
||||||
![][selenium grid]
|
1. Clone [this sample test project](https://github.com/googlesamples/android-testing).
|
||||||
![][devices are connected with selenium grid]
|
|
||||||
|
|
||||||
It is also possible to connect appium server that run inside docker-android with selenium grid by passing following environment variables:
|
```bash
|
||||||
|
git clone git@github.com:googlesamples/android-testing.git
|
||||||
|
```
|
||||||
|
|
||||||
- CONNECT\_TO\_GRID=True
|
2. Build the project
|
||||||
- APPIUM_HOST="\<host\_ip\_address>"
|
|
||||||
- APPIUM_PORT=\<port\_number>
|
|
||||||
- SELENIUM_HOST="\<host\_ip\_address>"
|
|
||||||
- SELENIUM_PORT=\<port\_number>
|
|
||||||
|
|
||||||
```bash
|
```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 --name android-container butomo1989/docker-android-x86-7.1.1
|
docker run -it --rm -v $PWD/android-testing/ui/espresso/BasicSample:/root/tmp butomo1989/docker-android-x86-8.1 tmp/gradlew build
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Control Android connected to host (Emulator or Real Device)
|
||||||
|
-----------------------------------------------------------
|
||||||
|
1. Create a docker container with this command
|
||||||
|
|
||||||
### Share Volume
|
```
|
||||||
|
$ docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -p 4723:4723 --name android-container-appium butomo1989/docker-android-real-device
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Open noVNC [http://localhost:6080](http://localhost:6080)
|
||||||
|
|
||||||
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***.
|
3. Open terminal by clicking right on **noVNC** window >> **Terminal emulator**
|
||||||
|
|
||||||
```bash
|
4. To connect to host's adb (make sure your host have adb and connected to the device.)
|
||||||
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
|
|
||||||
```
|
```
|
||||||
|
$ adb -H host.docker.internal devices
|
||||||
|
```
|
||||||
|
|
||||||
|
To specify port, just add `-P port_number`
|
||||||
|
|
||||||
|
```
|
||||||
|
$ adb -H host.docker.internal -P 5037 devices
|
||||||
|
```
|
||||||
|
|
||||||
|
5. Now your container can access your host devices. But, you need to add `remoteAdbHost` and `adbPort` desired capabilities to make **Appium** can recognise those devices.
|
||||||
|
|
||||||
|
|
||||||
|
Appium and Selenium Grid
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
If you want to use Appium and Selenium Grid, you can follow [this document](README_APPIUM_AND_SELENIUM.md). It also contains sample and use cases.
|
||||||
|
|
||||||
Control android emulator outside container
|
Control android emulator outside container
|
||||||
------------------------------------------
|
------------------------------------------
|
||||||
@@ -173,6 +197,30 @@ SMS Simulation
|
|||||||
|
|
||||||
![][sms]
|
![][sms]
|
||||||
|
|
||||||
|
Google Play Services and Google Play Store
|
||||||
|
------------------------------------------
|
||||||
|
|
||||||
|
Docker-Android contains Google Play Service (v12.8.74) and Google Play Store (v11.0.50). Both applications are downloaded from [apklinker](https://www.apklinker.com/), so please be aware of it in case you use private/company account to that applications.
|
||||||
|
|
||||||
|
VMWARE
|
||||||
|
------
|
||||||
|
|
||||||
|
This [document](README_VMWARE.md) shows you how to configure Virtual Machine on VMWARE to be able to run Docker-Android.
|
||||||
|
|
||||||
|
Cloud
|
||||||
|
-----
|
||||||
|
|
||||||
|
This [document](README_CLOUD.md) contains information about deploying Docker-Android on cloud services.
|
||||||
|
|
||||||
|
Genymotion
|
||||||
|
----------
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img id="geny" src="./images/logo_genymotion_and_dockerandroid.png" />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
For you who do not have ressources to maintain the simulator or to buy machines or need different device profiles, you need to give a try to [Genymotion Cloud](https://www.genymotion.com/cloud/). Docker-Android is integrated with Genymotion on different cloud services, e.g. Genymotion Cloud, AWS, GCP, Alibaba Cloud. Please follow [this document](README_GENYMOTION.md) or [this blog](https://medium.com/genymobile/run-your-appium-tests-using-docker-android-genymotion-cloud-e4817132ccd8) for more detail.
|
||||||
|
|
||||||
Troubleshooting
|
Troubleshooting
|
||||||
---------------
|
---------------
|
||||||
All logs inside container are stored under folder **/var/log/supervisor**. you can print out log file by using **docker exec**. Example:
|
All logs inside container are stored under folder **/var/log/supervisor**. you can print out log file by using **docker exec**. Example:
|
||||||
@@ -181,12 +229,20 @@ All logs inside container are stored under folder **/var/log/supervisor**. you c
|
|||||||
docker exec -it android-container tail -f /var/log/supervisor/docker-android.stdout.log
|
docker exec -it android-container tail -f /var/log/supervisor/docker-android.stdout.log
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Special Thanks
|
||||||
|
--------------
|
||||||
|
- [Gian Christanto] for creating a great logo!
|
||||||
|
|
||||||
|
LICENSE
|
||||||
|
--------------
|
||||||
|
See [License](LICENSE.md)
|
||||||
|
|
||||||
[appium]: <https://appium.io>
|
[appium]: <https://appium.io>
|
||||||
[espresso]: <https://google.github.io/android-testing-support-library/docs/espresso/>
|
[espresso]: <https://developer.android.com/training/testing/espresso/>
|
||||||
[robotium]: <https://github.com/RobotiumTech/robotium>
|
[robotium]: <https://github.com/RobotiumTech/robotium>
|
||||||
[docker android samsung]: <images/docker_android_samsung.png>
|
[emulator samsung]: <images/emulator_samsung_galaxy_s6.png>
|
||||||
[docker android nexus]: <images/docker_android_nexus.png>
|
[emulator nexus]: <images/emulator_nexus_5.png>
|
||||||
[selenium grid]: <images/selenium_grid.png>
|
[real device]: <images/real_device.png>
|
||||||
[devices are connected with selenium grid]: <images/connected_with_grid.png>
|
|
||||||
[adb_connection]: <images/adb_connection.png>
|
[adb_connection]: <images/adb_connection.png>
|
||||||
[sms]: <images/SMS.png>
|
[sms]: <images/SMS.png>
|
||||||
|
[gian christanto]: <https://www.linkedin.com/in/gian-christanto-0b398b131/>
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
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***.
|
||||||
|
|
||||||
|
```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-8.1
|
||||||
|
```
|
||||||
|
|
||||||
|
### 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-8.1
|
||||||
|
```
|
||||||
|
|
||||||
|
### Connect to Selenium Grid
|
||||||
|
|
||||||
|
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>
|
||||||
|
|
||||||
|
To run tests for mobile browser, following parameter can be passed:
|
||||||
|
|
||||||
|
- MOBILE\_WEB\_TEST=true
|
||||||
|
|
||||||
|
```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-8.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.yml#L70).
|
||||||
|
|
||||||
|
### Relaxed Security
|
||||||
|
|
||||||
|
Pass environment variable RELAXED_SECURITY=true to disable additional security check to use some advanced features.
|
||||||
|
|
||||||
|
### Docker-Compose
|
||||||
|
|
||||||
|
![][compose]
|
||||||
|
|
||||||
|
There is [example of compose file](docker-compose.yml) to run complete selenium grid and docker-android container as nodes. [docker-compose](https://docs.docker.com/compose/install/) version [1.13.0](https://github.com/docker/compose/releases/tag/1.13.0) or higher is required to be able to execute that compose file.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
[compose]: <images/compose.png>
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
Azure
|
||||||
|
-----
|
||||||
|
|
||||||
|
Make sure that the nodes, pods, containers for your emulators are generated within a **VM** of series **Dv3** or **Ev3**.
|
||||||
|
Reference: https://docs.microsoft.com/en-us/azure/virtual-machines/windows/nested-virtualization
|
||||||
|
|
||||||
|
AWS
|
||||||
|
-----
|
||||||
|
Make sure that containers for your emulators are generated within a EC2 Bare Metal Instance(i3.metal)
|
||||||
|
Reference: https://aws.amazon.com/jp/blogs/aws/new-amazon-ec2-bare-metal-instances-with-direct-access-to-hardware/
|
||||||
|
|
||||||
|
Google Cloud (GCE)
|
||||||
|
------------------
|
||||||
|
Make sure your instances for your emulators have Nested Virtualization enabled
|
||||||
|
Reference: https://cloud.google.com/compute/docs/instances/enable-nested-virtualization-vm-instances
|
||||||
|
|
||||||
|
One the disk and instance are created as [specified here](https://cloud.google.com/compute/docs/instances/enable-nested-virtualization-vm-instances#enablenestedvirt),
|
||||||
|
the emulator can be brought up as follows:
|
||||||
|
|
||||||
|
# Assume app.apk is in /tmp
|
||||||
|
docker run --privileged -d -e DEVICE="Samsung Galaxy S6" --volume /tmp:/APK \
|
||||||
|
--name android_em butomo1989/docker-android-x86-8.1
|
||||||
|
|
||||||
|
docker exec android_em adb wait-for-device
|
||||||
|
docker exec android_em adb install /APK/app.apk
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
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"
|
||||||
|
|
||||||
|
Language
|
||||||
|
--------
|
||||||
|
|
||||||
|
You can change the language setting of Android Emulator on the fly by passing following environment variable:
|
||||||
|
|
||||||
|
- LANGUAGE="\<language>"
|
||||||
|
- COUNTRY="\<country>"
|
||||||
|
|
||||||
|
Camera
|
||||||
|
------
|
||||||
|
|
||||||
|
Passing following environment variable to be able to connect laptop / pc camera to Android emulator:
|
||||||
|
|
||||||
|
- EMULATOR_ARGS="-camera-back webcam0"
|
||||||
|
|
||||||
|
Custom Emulator Arguments
|
||||||
|
-------------------------
|
||||||
|
|
||||||
|
If you want to add more arguments for running emulator, you can ***pass an environment variable EMULATOR_ARGS*** while running docker command.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run --privileged -d -p 6080:6080 -p 4723:4723 -p 5554:5554 -p 5555:5555 -e DEVICE="Samsung Galaxy S6" -e EMULATOR_ARGS="-no-snapshot-load -partition-size 512" --name android-container butomo1989/docker-android-x86-8.1
|
||||||
|
```
|
||||||
|
|
||||||
|
Back & Restore
|
||||||
|
--------------
|
||||||
|
|
||||||
|
If you want to backup/reuse the avds created with furture upgrades or for replication, run the container with two extra mounts
|
||||||
|
|
||||||
|
- -v local_backup/.android:/root/.android
|
||||||
|
- -v local_backup/android_emulator:/root/android_emulator
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run --privileged -d -p 6080:6080 -p 4723:4723 -p 5554:5554 -p 5555:5555 -v local_backup/.android:/root/.android -v local_backup/android_emulator:local_backup/android_emulator -e DEVICE="Nexus 5" --name android-container butomo1989/docker-android-x86-8.1
|
||||||
|
```
|
||||||
|
|
||||||
|
For the first run, this will create a new avd and all the changes will be accessible in the `local_backup` directory. Now for all future runs, it will reuse the avds. Even this should work with new releases of `docker-android`
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
Genymotion Cloud
|
||||||
|
----------------
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
You can easily scale your Appium tests on Genymotion Android virtual devices in the cloud. They are available on SaaS or as virtual images on AWS, GCP or Alibaba Cloud.
|
||||||
|
|
||||||
|
1. On SaaS <br />
|
||||||
|
Use [device.json](genymotion/example/sample_devices/devices.json) to define the device to start. You can specify the port on which the device will start so you don't need to change the device name in your tests every time you need to run those tests. Then run following command
|
||||||
|
|
||||||
|
```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 TYPE=SaaS -e USER=$USER -e PASS=$PASS -e LICENSE=$LICENSE butomo1989/docker-android-genymotion
|
||||||
|
```
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<a href="https://youtu.be/jXhUEyaVeMY"><img src="./images/Genymotion_cloud.png" alt="Docker-Android supports Genymotion Cloud" width="600"></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
2. On PaaS (AWS) <br />
|
||||||
|
Use [aws.json](genymotion/example/sample_devices/aws.json) to define configuration of EC2 instance and run following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run -it --rm -p 4723:4723 -v $PWD/genymotion/example/sample_devices:/root/tmp -v ~/.aws:/root/.aws -e TYPE=aws butomo1989/docker-android-genymotion
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also use [this docker-compose file](genymotion/example/geny.yml).
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
VMWare Fusion on OSX
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
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-8.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.
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
# Kubernetes & Azure (AKS, Terraform, Kompose, Kubectl, Azure CLI)
|
||||||
|
|
||||||
|
- Azure CLI configuration
|
||||||
|
- Infrastructure as code for Azure
|
||||||
|
- Generating Kubernetes configuration files with Kompose (Services, Deployments, Pods & Persistent volumes)
|
||||||
|
- Terraform with Azure Provider
|
||||||
|
- Kubectl configuration
|
||||||
|
|
||||||
|
## Setting up Azure CLI
|
||||||
|
|
||||||
|
- Install Azure CLI -> https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest
|
||||||
|
- Execute ```sh $ az login ``` and authenticate with your Azure account
|
||||||
|
- Execute ```sh $ az account show --query "{subscriptionId:id, tenantId:tenantId" ``` . Then copy subscriptionId and tenantId
|
||||||
|
- Execute ```sh $ az account set --subscription="${SUBSCRIPTION_ID}" ``` . Replace ${SUBSCRIPTION_ID} for your subscriptionId copied
|
||||||
|
|
||||||
|
## Create infrastucture in Azure (AKS Service with node master)
|
||||||
|
|
||||||
|
Terraform version >= v0.11.7
|
||||||
|
|
||||||
|
- Install Terraform -> https://www.terraform.io/downloads.html
|
||||||
|
- Edit vars with Azure Account values in ```sh terraform.tfvars ```
|
||||||
|
- After that:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ terraform init
|
||||||
|
$ terraform plan
|
||||||
|
$ terraform apply
|
||||||
|
```
|
||||||
|
|
||||||
|
## Setting up Kubectl with Azure account
|
||||||
|
|
||||||
|
- For apply Kubernetes files:
|
||||||
|
|
||||||
|
First configurate azure-cli with Azure account and install kubernetes tools with az:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ az aks install-cli
|
||||||
|
```
|
||||||
|
|
||||||
|
Then log in in to the Azure Container Registry (if you're using it, but dockerhub or other):
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ az acr login
|
||||||
|
```
|
||||||
|
|
||||||
|
After that, connect to cluster with Kubectl:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ az aks get-credentials --resource-group docker-android --name k8s-docker-android
|
||||||
|
```
|
||||||
|
|
||||||
|
## Running with custom K8s files (Recommended)
|
||||||
|
|
||||||
|
- You can use this approach or Kompose (Next 2 steps)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ kubectl create -f volumes.yaml
|
||||||
|
$ kubectl create -f services_deployments.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
## Generate Kube files with Kompose
|
||||||
|
|
||||||
|
- Install Kompose -> https://github.com/kubernetes/kompose
|
||||||
|
|
||||||
|
Kompose version: >= 1.1.0
|
||||||
|
|
||||||
|
- For convert to Kompose:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ cd kompose
|
||||||
|
$ kompose convert -f ../kompose.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
## Execute Kube files (Kompose)
|
||||||
|
|
||||||
|
- First create Persistent Volume Claims, then Services; finally Deployments files. For example:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ cd kompose
|
||||||
|
$ kubectl create -f nexus-7.1.1-claim0-persistentvolumeclaim.yaml
|
||||||
|
$ kubectl create -f nexus-7.1.1-claim1-persistentvolumeclaim.yaml
|
||||||
|
$ kubectl create -f nexus-7.1.1-service.yaml
|
||||||
|
$ kubectl create -f nexus-7.1.1-deployment.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
# Note: It requires docker-compose 1.13.0
|
||||||
|
#
|
||||||
|
# Usage: docker-compose up -d
|
||||||
|
version: "3"
|
||||||
|
|
||||||
|
services:
|
||||||
|
# Selenium hub
|
||||||
|
selenium_hub:
|
||||||
|
image: selenium/hub:3.14.0-curium
|
||||||
|
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
|
||||||
|
- ../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:
|
||||||
|
- ../example/sample_apk:/root/tmp/sample_apk
|
||||||
|
- ../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-8.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
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
creationTimestamp: null
|
||||||
|
labels:
|
||||||
|
io.kompose.service: nexus-7.1.1-claim0
|
||||||
|
name: nexus-7.1.1-claim0
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 100Mi
|
||||||
|
status: {}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
creationTimestamp: null
|
||||||
|
labels:
|
||||||
|
io.kompose.service: nexus-7.1.1-claim1
|
||||||
|
name: nexus-7.1.1-claim1
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 100Mi
|
||||||
|
status: {}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
apiVersion: extensions/v1beta1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
kompose.cmd: kompose convert -f ../kompose.yml
|
||||||
|
kompose.version: 1.1.0 (36652f6)
|
||||||
|
creationTimestamp: null
|
||||||
|
labels:
|
||||||
|
io.kompose.service: nexus-7.1.1
|
||||||
|
name: nexus-7.1.1
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
strategy:
|
||||||
|
type: Recreate
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
creationTimestamp: null
|
||||||
|
labels:
|
||||||
|
io.kompose.service: nexus-7.1.1
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- env:
|
||||||
|
- name: APPIUM
|
||||||
|
value: "true"
|
||||||
|
- name: AUTO_RECORD
|
||||||
|
value: "true"
|
||||||
|
- name: CONNECT_TO_GRID
|
||||||
|
value: "true"
|
||||||
|
- name: DEVICE
|
||||||
|
value: Nexus 5
|
||||||
|
- name: SELENIUM_HOST
|
||||||
|
value: selenium_hub
|
||||||
|
image: butomo1989/docker-android-x86-7.1.1
|
||||||
|
name: nexus-7.1.1
|
||||||
|
ports:
|
||||||
|
- containerPort: 6080
|
||||||
|
resources: {}
|
||||||
|
securityContext:
|
||||||
|
privileged: true
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /root/tmp/sample_apk
|
||||||
|
name: nexus-7.1.1-claim0
|
||||||
|
- mountPath: /tmp/video
|
||||||
|
name: nexus-7.1.1-claim1
|
||||||
|
restartPolicy: Always
|
||||||
|
volumes:
|
||||||
|
- name: nexus-7.1.1-claim0
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: nexus-7.1.1-claim0
|
||||||
|
- name: nexus-7.1.1-claim1
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: nexus-7.1.1-claim1
|
||||||
|
status: {}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
kompose.cmd: kompose convert -f ../kompose.yml
|
||||||
|
kompose.version: 1.1.0 (36652f6)
|
||||||
|
creationTimestamp: null
|
||||||
|
labels:
|
||||||
|
io.kompose.service: nexus-7.1.1
|
||||||
|
name: nexus-7.1.1
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- name: "6080"
|
||||||
|
port: 6080
|
||||||
|
targetPort: 6080
|
||||||
|
selector:
|
||||||
|
io.kompose.service: nexus-7.1.1
|
||||||
|
status:
|
||||||
|
loadBalancer: {}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
creationTimestamp: null
|
||||||
|
labels:
|
||||||
|
io.kompose.service: real-device-claim0
|
||||||
|
name: real-device-claim0
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 100Mi
|
||||||
|
status: {}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
creationTimestamp: null
|
||||||
|
labels:
|
||||||
|
io.kompose.service: real-device-claim1
|
||||||
|
name: real-device-claim1
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 100Mi
|
||||||
|
status: {}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
creationTimestamp: null
|
||||||
|
labels:
|
||||||
|
io.kompose.service: real-device-claim2
|
||||||
|
name: real-device-claim2
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 100Mi
|
||||||
|
status: {}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
apiVersion: extensions/v1beta1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
kompose.cmd: kompose convert -f ../kompose.yml
|
||||||
|
kompose.version: 1.1.0 (36652f6)
|
||||||
|
creationTimestamp: null
|
||||||
|
labels:
|
||||||
|
io.kompose.service: real-device
|
||||||
|
name: real-device
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
strategy:
|
||||||
|
type: Recreate
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
creationTimestamp: null
|
||||||
|
labels:
|
||||||
|
io.kompose.service: real-device
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- env:
|
||||||
|
- name: CONNECT_TO_GRID
|
||||||
|
value: "true"
|
||||||
|
- name: SELENIUM_HOST
|
||||||
|
value: selenium_hub
|
||||||
|
image: appium/appium
|
||||||
|
name: real-device
|
||||||
|
resources: {}
|
||||||
|
securityContext:
|
||||||
|
privileged: true
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /dev/bus/usb
|
||||||
|
name: real-device-claim0
|
||||||
|
- mountPath: /root/.android
|
||||||
|
name: real-device-claim1
|
||||||
|
- mountPath: /root/tmp
|
||||||
|
name: real-device-claim2
|
||||||
|
restartPolicy: Always
|
||||||
|
volumes:
|
||||||
|
- name: real-device-claim0
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: real-device-claim0
|
||||||
|
- name: real-device-claim1
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: real-device-claim1
|
||||||
|
- name: real-device-claim2
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: real-device-claim2
|
||||||
|
status: {}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
kompose.cmd: kompose convert -f ../kompose.yml
|
||||||
|
kompose.version: 1.1.0 (36652f6)
|
||||||
|
creationTimestamp: null
|
||||||
|
labels:
|
||||||
|
io.kompose.service: real-device
|
||||||
|
name: real-device
|
||||||
|
spec:
|
||||||
|
clusterIP: None
|
||||||
|
ports:
|
||||||
|
- name: headless
|
||||||
|
port: 55555
|
||||||
|
targetPort: 0
|
||||||
|
selector:
|
||||||
|
io.kompose.service: real-device
|
||||||
|
status:
|
||||||
|
loadBalancer: {}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
creationTimestamp: null
|
||||||
|
labels:
|
||||||
|
io.kompose.service: samsung-galaxy-web-5.1.1-claim0
|
||||||
|
name: samsung-galaxy-web-5.1.1-claim0
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 100Mi
|
||||||
|
status: {}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
apiVersion: extensions/v1beta1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
kompose.cmd: kompose convert -f ../kompose.yml
|
||||||
|
kompose.version: 1.1.0 (36652f6)
|
||||||
|
creationTimestamp: null
|
||||||
|
labels:
|
||||||
|
io.kompose.service: samsung-galaxy-web-5.1.1
|
||||||
|
name: samsung-galaxy-web-5.1.1
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
strategy:
|
||||||
|
type: Recreate
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
creationTimestamp: null
|
||||||
|
labels:
|
||||||
|
io.kompose.service: samsung-galaxy-web-5.1.1
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- env:
|
||||||
|
- name: APPIUM
|
||||||
|
value: "true"
|
||||||
|
- name: AUTO_RECORD
|
||||||
|
value: "true"
|
||||||
|
- name: CONNECT_TO_GRID
|
||||||
|
value: "true"
|
||||||
|
- name: DEVICE
|
||||||
|
value: Samsung Galaxy S6
|
||||||
|
- name: MOBILE_WEB_TEST
|
||||||
|
value: "true"
|
||||||
|
- name: SELENIUM_HOST
|
||||||
|
value: selenium_hub
|
||||||
|
image: butomo1989/docker-android-x86-5.1.1
|
||||||
|
name: samsung-galaxy-web-5.1.1
|
||||||
|
ports:
|
||||||
|
- containerPort: 6080
|
||||||
|
resources: {}
|
||||||
|
securityContext:
|
||||||
|
privileged: true
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /tmp/video
|
||||||
|
name: samsung-galaxy-web-5.1.1-claim0
|
||||||
|
restartPolicy: Always
|
||||||
|
volumes:
|
||||||
|
- name: samsung-galaxy-web-5.1.1-claim0
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: samsung-galaxy-web-5.1.1-claim0
|
||||||
|
status: {}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
kompose.cmd: kompose convert -f ../kompose.yml
|
||||||
|
kompose.version: 1.1.0 (36652f6)
|
||||||
|
creationTimestamp: null
|
||||||
|
labels:
|
||||||
|
io.kompose.service: samsung-galaxy-web-5.1.1
|
||||||
|
name: samsung-galaxy-web-5.1.1
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- name: "6080"
|
||||||
|
port: 6080
|
||||||
|
targetPort: 6080
|
||||||
|
selector:
|
||||||
|
io.kompose.service: samsung-galaxy-web-5.1.1
|
||||||
|
status:
|
||||||
|
loadBalancer: {}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
creationTimestamp: null
|
||||||
|
labels:
|
||||||
|
io.kompose.service: samsung-galaxy-web-7.1.1-claim0
|
||||||
|
name: samsung-galaxy-web-7.1.1-claim0
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 100Mi
|
||||||
|
status: {}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
apiVersion: extensions/v1beta1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
kompose.cmd: kompose convert -f ../kompose.yml
|
||||||
|
kompose.version: 1.1.0 (36652f6)
|
||||||
|
creationTimestamp: null
|
||||||
|
labels:
|
||||||
|
io.kompose.service: samsung-galaxy-web-7.1.1
|
||||||
|
name: samsung-galaxy-web-7.1.1
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
strategy:
|
||||||
|
type: Recreate
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
creationTimestamp: null
|
||||||
|
labels:
|
||||||
|
io.kompose.service: samsung-galaxy-web-7.1.1
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- env:
|
||||||
|
- name: APPIUM
|
||||||
|
value: "true"
|
||||||
|
- name: AUTO_RECORD
|
||||||
|
value: "true"
|
||||||
|
- name: CONNECT_TO_GRID
|
||||||
|
value: "true"
|
||||||
|
- name: DEVICE
|
||||||
|
value: Samsung Galaxy S6
|
||||||
|
- name: MOBILE_WEB_TEST
|
||||||
|
value: "true"
|
||||||
|
- name: SELENIUM_HOST
|
||||||
|
value: selenium_hub
|
||||||
|
image: butomo1989/docker-android-x86-8.1
|
||||||
|
name: samsung-galaxy-web-7.1.1
|
||||||
|
ports:
|
||||||
|
- containerPort: 6080
|
||||||
|
resources: {}
|
||||||
|
securityContext:
|
||||||
|
privileged: true
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /tmp/video
|
||||||
|
name: samsung-galaxy-web-7.1.1-claim0
|
||||||
|
restartPolicy: Always
|
||||||
|
volumes:
|
||||||
|
- name: samsung-galaxy-web-7.1.1-claim0
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: samsung-galaxy-web-7.1.1-claim0
|
||||||
|
status: {}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
kompose.cmd: kompose convert -f ../kompose.yml
|
||||||
|
kompose.version: 1.1.0 (36652f6)
|
||||||
|
creationTimestamp: null
|
||||||
|
labels:
|
||||||
|
io.kompose.service: samsung-galaxy-web-7.1.1
|
||||||
|
name: samsung-galaxy-web-7.1.1
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- name: "6080"
|
||||||
|
port: 6080
|
||||||
|
targetPort: 6080
|
||||||
|
selector:
|
||||||
|
io.kompose.service: samsung-galaxy-web-7.1.1
|
||||||
|
status:
|
||||||
|
loadBalancer: {}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
apiVersion: extensions/v1beta1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
kompose.cmd: kompose convert -f ../kompose.yml
|
||||||
|
kompose.version: 1.1.0 (36652f6)
|
||||||
|
creationTimestamp: null
|
||||||
|
labels:
|
||||||
|
io.kompose.service: selenium-hub
|
||||||
|
name: selenium-hub
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
strategy: {}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
creationTimestamp: null
|
||||||
|
labels:
|
||||||
|
io.kompose.service: selenium-hub
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- image: selenium/hub:3.14.0-curium
|
||||||
|
name: selenium-hub
|
||||||
|
ports:
|
||||||
|
- containerPort: 4444
|
||||||
|
resources: {}
|
||||||
|
restartPolicy: Always
|
||||||
|
status: {}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
kompose.cmd: kompose convert -f ../kompose.yml
|
||||||
|
kompose.version: 1.1.0 (36652f6)
|
||||||
|
creationTimestamp: null
|
||||||
|
labels:
|
||||||
|
io.kompose.service: selenium-hub
|
||||||
|
name: selenium-hub
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- name: "4444"
|
||||||
|
port: 4444
|
||||||
|
targetPort: 4444
|
||||||
|
selector:
|
||||||
|
io.kompose.service: selenium-hub
|
||||||
|
status:
|
||||||
|
loadBalancer: {}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
|
||||||
|
resource "azurerm_container_service" "container_service" {
|
||||||
|
name = "k8s-docker-android"
|
||||||
|
resource_group_name = "${var.resource_group_name}"
|
||||||
|
location = "${var.resource_group_location}"
|
||||||
|
orchestration_platform = "Kubernetes"
|
||||||
|
|
||||||
|
master_profile {
|
||||||
|
count = "${var.master_count}"
|
||||||
|
dns_prefix = "${var.dns_name_prefix}-master"
|
||||||
|
}
|
||||||
|
|
||||||
|
agent_pool_profile {
|
||||||
|
name = "agentpools"
|
||||||
|
count = "${var.linux_agent_count}"
|
||||||
|
dns_prefix = "${var.dns_name_prefix}-agent"
|
||||||
|
vm_size = "${var.linux_agent_vm_size}"
|
||||||
|
}
|
||||||
|
|
||||||
|
linux_profile {
|
||||||
|
admin_username = "${var.linux_admin_username}"
|
||||||
|
|
||||||
|
ssh_key {
|
||||||
|
key_data = "${var.linux_admin_ssh_publickey}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
service_principal {
|
||||||
|
client_id = "${var.service_principal_client_id}"
|
||||||
|
client_secret = "${var.service_principal_client_secret}"
|
||||||
|
}
|
||||||
|
|
||||||
|
diagnostics_profile {
|
||||||
|
enabled = false
|
||||||
|
}
|
||||||
|
|
||||||
|
tags {
|
||||||
|
Source = "K8s with Terraform"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
output "master_fqdn" {
|
||||||
|
value = "${azurerm_container_service.container_service.master_profile.fqdn}"
|
||||||
|
}
|
||||||
|
|
||||||
|
output "ssh_command_master0" {
|
||||||
|
value = "ssh ${var.linux_admin_username}@${azurerm_container_service.container_service.master_profile.fqdn} -A -p 22"
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
# Use this if you can't specify your credentials in file but you need ingress in the UI console.
|
||||||
|
provider "azurerm" {}
|
||||||
|
|
||||||
|
#Use this if you can specify your credentials and no more configuration is necessary
|
||||||
|
#provider "azurerm" {
|
||||||
|
# subscription_id = "${var.subscription_id}"
|
||||||
|
# client_id = "${var.service_principal_client_id}"
|
||||||
|
# client_secret = "${var.service_principal_client_secret}"
|
||||||
|
# tenant_id = "${var.tenant_id}"
|
||||||
|
#}
|
||||||
@@ -0,0 +1,147 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: selenium
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- name: "4444"
|
||||||
|
port: 4444
|
||||||
|
targetPort: 4444
|
||||||
|
selector:
|
||||||
|
app: selenium
|
||||||
|
type: LoadBalancer
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: selenium-deployment
|
||||||
|
labels:
|
||||||
|
app: selenium
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: selenium
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- image: selenium/hub:3.14.0-curium
|
||||||
|
name: selenium-hub
|
||||||
|
ports:
|
||||||
|
- containerPort: 4444
|
||||||
|
resources: {}
|
||||||
|
restartPolicy: Always
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: real-device
|
||||||
|
spec:
|
||||||
|
clusterIP: None
|
||||||
|
ports:
|
||||||
|
- name: headless
|
||||||
|
port: 55555
|
||||||
|
targetPort: 0
|
||||||
|
selector:
|
||||||
|
app: real-device
|
||||||
|
type: LoadBalancer
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: real-device
|
||||||
|
name: real-device
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: real-device
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- env:
|
||||||
|
- name: CONNECT_TO_GRID
|
||||||
|
value: "true"
|
||||||
|
- name: SELENIUM_HOST
|
||||||
|
value: selenium_hub
|
||||||
|
image: appium/appium
|
||||||
|
name: real-device
|
||||||
|
securityContext:
|
||||||
|
privileged: true
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /dev/bus/usb
|
||||||
|
name: real-device-claim0
|
||||||
|
- mountPath: /root/.android
|
||||||
|
name: real-device-claim1
|
||||||
|
- mountPath: /root/tmp
|
||||||
|
name: real-device-claim2
|
||||||
|
restartPolicy: Always
|
||||||
|
volumes:
|
||||||
|
- name: real-device-claim0
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: real-device-claim0
|
||||||
|
- name: real-device-claim1
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: real-device-claim1
|
||||||
|
- name: real-device-claim2
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: real-device-claim2
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: nexus-7.1.1
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- name: "6080"
|
||||||
|
port: 6080
|
||||||
|
targetPort: 6080
|
||||||
|
selector:
|
||||||
|
app: nexus-7.1.1
|
||||||
|
type: LoadBalancer
|
||||||
|
---
|
||||||
|
apiVersion: extensions/v1beta1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: nexus-7.1.1
|
||||||
|
name: nexus-7.1.1
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: nexus-7.1.1
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- env:
|
||||||
|
- name: APPIUM
|
||||||
|
value: "true"
|
||||||
|
- name: AUTO_RECORD
|
||||||
|
value: "true"
|
||||||
|
- name: CONNECT_TO_GRID
|
||||||
|
value: "true"
|
||||||
|
- name: DEVICE
|
||||||
|
value: Nexus 5
|
||||||
|
- name: SELENIUM_HOST
|
||||||
|
value: selenium_hub
|
||||||
|
image: butomo1989/docker-android-x86-7.1.1
|
||||||
|
name: nexus-7.1.1
|
||||||
|
ports:
|
||||||
|
- containerPort: 6080
|
||||||
|
securityContext:
|
||||||
|
privileged: true
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /root/tmp/sample_apk
|
||||||
|
name: nexus-7.1.1-claim0
|
||||||
|
- mountPath: /tmp/video
|
||||||
|
name: nexus-7.1.1-claim1
|
||||||
|
restartPolicy: Always
|
||||||
|
volumes:
|
||||||
|
- name: nexus-7.1.1-claim0
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: nexus-7.1.1-claim0
|
||||||
|
- name: nexus-7.1.1-claim1
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: nexus-7.1.1-claim1
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
|
||||||
|
resource_group_name = "docker-android"
|
||||||
|
resource_group_location = "West US"
|
||||||
|
dns_name_prefix = "docker-android"
|
||||||
|
linux_agent_count = "1"
|
||||||
|
|
||||||
|
#Only use Dv3 or Ev3 series
|
||||||
|
linux_agent_vm_size = "Standard_D2_v3"
|
||||||
|
|
||||||
|
linux_admin_username = "(Insert any username here!)"
|
||||||
|
linux_admin_ssh_publickey = "(Insert ssh key here!)"
|
||||||
|
master_count = "1"
|
||||||
|
|
||||||
|
|
||||||
|
# Azure credentials
|
||||||
|
service_principal_client_id = "(Insert principal key client id here!)"
|
||||||
|
service_principal_client_secret = "(Insert principal key client secret here!)"
|
||||||
|
subscription_id = "(Insert subscription id here!)"
|
||||||
|
tenant_id = "(Insert tenant id here!)"
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
variable "resource_group_name" {
|
||||||
|
type = "string"
|
||||||
|
description = "Name of the azure resource group."
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "resource_group_location" {
|
||||||
|
type = "string"
|
||||||
|
description = "Location of the azure resource group."
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "dns_name_prefix" {
|
||||||
|
type = "string"
|
||||||
|
description = "Sets the domain name prefix for the cluster. The suffix 'master' will be added to address the master agents and the suffix 'agent' will be added to address the linux agents."
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "linux_agent_count" {
|
||||||
|
type = "string"
|
||||||
|
default = "1"
|
||||||
|
description = "The number of Kubernetes linux agents in the cluster. Allowed values are 1-100 (inclusive). The default value is 1."
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "linux_agent_vm_size" {
|
||||||
|
type = "string"
|
||||||
|
default = "Standard_D2_v2"
|
||||||
|
description = "The size of the virtual machine used for the Kubernetes linux agents in the cluster."
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "linux_admin_username" {
|
||||||
|
type = "string"
|
||||||
|
description = "User name for authentication to the Kubernetes linux agent virtual machines in the cluster."
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "linux_admin_ssh_publickey" {
|
||||||
|
type = "string"
|
||||||
|
description = "Configure all the linux virtual machines in the cluster with the SSH RSA public key string. The key should include three parts, for example 'ssh-rsa AAAAB...snip...UcyupgH azureuser@linuxvm'"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "master_count" {
|
||||||
|
type = "string"
|
||||||
|
default = "1"
|
||||||
|
description = "The number of Kubernetes masters for the cluster. Allowed values are 1, 3, and 5. The default value is 1."
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "service_principal_client_id" {
|
||||||
|
type = "string"
|
||||||
|
description = "The client id of the azure service principal used by Kubernetes to interact with Azure APIs."
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "service_principal_client_secret" {
|
||||||
|
type = "string"
|
||||||
|
description = "The client secret of the azure service principal used by Kubernetes to interact with Azure APIs."
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "subscription_id" {
|
||||||
|
type = "string"
|
||||||
|
description = "Your Azure subscription"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "tenant_id" {
|
||||||
|
type = "string"
|
||||||
|
description = "Your Azure Tenant id"
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
creationTimestamp: null
|
||||||
|
labels:
|
||||||
|
app: real-device-claim0
|
||||||
|
name: real-device-claim0
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 100Mi
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
creationTimestamp: null
|
||||||
|
labels:
|
||||||
|
app: real-device-claim1
|
||||||
|
name: real-device-claim1
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 100Mi
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
creationTimestamp: null
|
||||||
|
labels:
|
||||||
|
app: real-device-claim2
|
||||||
|
name: real-device-claim2
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 100Mi
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
creationTimestamp: null
|
||||||
|
labels:
|
||||||
|
app: nexus-7.1.1-claim0
|
||||||
|
name: nexus-7.1.1-claim0
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 100Mi
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
creationTimestamp: null
|
||||||
|
labels:
|
||||||
|
app: nexus-7.1.1-claim1
|
||||||
|
name: nexus-7.1.1-claim1
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 100Mi
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
# 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.14.0-curium
|
||||||
|
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:/root/tmp/sample_apk
|
||||||
|
- ./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-8.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
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
provider "docker" {
|
||||||
|
host = "unix:///var/run/docker.sock"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "docker_image" "selenium_hub_img" {
|
||||||
|
name = "selenium/hub:3.14.0-curium"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "docker_image" "docker_android_img" {
|
||||||
|
name = "butomo1989/docker-android-x86-8.1:latest"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "docker_network" "private_network" {
|
||||||
|
name = "private_network"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "docker_container" "selenium_hub_con" {
|
||||||
|
image = "${docker_image.selenium_hub_img.latest}"
|
||||||
|
name = "selenium_hub_con"
|
||||||
|
networks = ["${docker_network.private_network.id}"]
|
||||||
|
ports {
|
||||||
|
internal = 4444
|
||||||
|
external = 4444
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "docker_container" "samsung_s6_con" {
|
||||||
|
image = "${docker_image.docker_android_img.latest}"
|
||||||
|
name = "samsung_s6_con"
|
||||||
|
privileged = true
|
||||||
|
depends_on = ["docker_container.selenium_hub_con"]
|
||||||
|
networks = ["${docker_network.private_network.id}"]
|
||||||
|
ports {
|
||||||
|
internal = 6080
|
||||||
|
external = 6080
|
||||||
|
}
|
||||||
|
env = [
|
||||||
|
"DEVICE=Samsung Galaxy S6",
|
||||||
|
"CONNECT_TO_GRID=true",
|
||||||
|
"APPIUM=true",
|
||||||
|
"MOBILE_WEB_TEST=true",
|
||||||
|
"AUTO_RECORD=true"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
FROM ubuntu:16.04
|
FROM appium/appium:1.10.1-p0
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND noninteractive
|
LABEL maintainer "Budi Utomo <budi.ut.1989@gmail.com>"
|
||||||
|
|
||||||
#=============
|
#=============
|
||||||
# Set WORKDIR
|
# Set WORKDIR
|
||||||
@@ -10,29 +10,15 @@ WORKDIR /root
|
|||||||
#==================
|
#==================
|
||||||
# General Packages
|
# General Packages
|
||||||
#------------------
|
#------------------
|
||||||
# wget
|
|
||||||
# Network downloader
|
|
||||||
# unzip
|
|
||||||
# Unzip zip file
|
|
||||||
# curl
|
|
||||||
# Transfer data from or to a server
|
|
||||||
# xterm
|
# xterm
|
||||||
# Terminal emulator
|
# Terminal emulator
|
||||||
# supervisor
|
# supervisor
|
||||||
# Process manager
|
# Process manager
|
||||||
# openjdk-8-jdk
|
|
||||||
# Java
|
|
||||||
# libqt5webkit5
|
|
||||||
# Web content engine (Fix issue in Android)
|
|
||||||
# socat
|
# socat
|
||||||
# Port forwarder
|
# Port forwarder
|
||||||
# libgconf-2-4
|
|
||||||
# Required package for chrome and chromedriver to run on Linux
|
|
||||||
#------------------
|
#------------------
|
||||||
# NoVNC Packages
|
# NoVNC Packages
|
||||||
#------------------
|
#------------------
|
||||||
# xvfb
|
|
||||||
# X virtual framebuffer
|
|
||||||
# x11vnc
|
# x11vnc
|
||||||
# VNC server for X display
|
# VNC server for X display
|
||||||
# openbox
|
# openbox
|
||||||
@@ -44,6 +30,13 @@ WORKDIR /root
|
|||||||
# net-tools
|
# net-tools
|
||||||
# Netstat
|
# Netstat
|
||||||
#------------------
|
#------------------
|
||||||
|
# Video Recording
|
||||||
|
#------------------
|
||||||
|
# ffmpeg
|
||||||
|
# Video recorder
|
||||||
|
# jq
|
||||||
|
# Sed for JSON data
|
||||||
|
#------------------
|
||||||
# KVM Package
|
# KVM Package
|
||||||
# for emulator x86
|
# for emulator x86
|
||||||
# https://help.ubuntu.com/community/KVM/Installation
|
# https://help.ubuntu.com/community/KVM/Installation
|
||||||
@@ -54,21 +47,16 @@ WORKDIR /root
|
|||||||
# bridge-utils
|
# bridge-utils
|
||||||
#==================
|
#==================
|
||||||
RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \
|
RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \
|
||||||
wget \
|
|
||||||
unzip \
|
|
||||||
curl \
|
|
||||||
xterm \
|
xterm \
|
||||||
supervisor \
|
supervisor \
|
||||||
openjdk-8-jdk \
|
|
||||||
libqt5webkit5 \
|
|
||||||
socat \
|
socat \
|
||||||
libgconf-2-4 \
|
|
||||||
xvfb \
|
|
||||||
x11vnc \
|
x11vnc \
|
||||||
openbox \
|
openbox \
|
||||||
menu \
|
menu \
|
||||||
python-numpy \
|
python-numpy \
|
||||||
net-tools \
|
net-tools \
|
||||||
|
ffmpeg \
|
||||||
|
jq \
|
||||||
qemu-kvm \
|
qemu-kvm \
|
||||||
libvirt-bin \
|
libvirt-bin \
|
||||||
ubuntu-vm-builder \
|
ubuntu-vm-builder \
|
||||||
@@ -92,49 +80,52 @@ RUN wget -nv -O noVNC.zip "https://github.com/kanaka/noVNC/archive/${NOVNC_SHA}
|
|||||||
&& rm websockify.zip \
|
&& rm websockify.zip \
|
||||||
&& ln noVNC/vnc_auto.html noVNC/index.html
|
&& ln noVNC/vnc_auto.html noVNC/index.html
|
||||||
|
|
||||||
#=====================
|
|
||||||
# Install Android SDK
|
|
||||||
#=====================
|
|
||||||
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/jre
|
|
||||||
ENV PATH ${PATH}:${JAVA_HOME}/bin
|
|
||||||
|
|
||||||
ENV SDK_VERSION=25.2.3 \
|
|
||||||
ANDROID_HOME=/root
|
|
||||||
RUN wget -nv -O android.zip https://dl.google.com/android/repository/tools_r${SDK_VERSION}-linux.zip \
|
|
||||||
&& unzip android.zip && rm android.zip
|
|
||||||
ENV PATH ${PATH}:${ANDROID_HOME}/tools
|
|
||||||
RUN echo y | android update sdk --no-ui -a --filter platform-tools
|
|
||||||
ENV PATH ${PATH}:${ANDROID_HOME}/platform-tools
|
|
||||||
|
|
||||||
#====================================
|
|
||||||
# Install latest nodejs, npm, appium
|
|
||||||
#====================================
|
|
||||||
RUN curl -sL https://deb.nodesource.com/setup_7.x | bash - \
|
|
||||||
&& apt-get -qqy update && apt-get -qqy install nodejs && rm -rf /var/lib/apt/lists/*
|
|
||||||
ENV APPIUM_VERSION 1.6.3
|
|
||||||
RUN npm install -g appium@$APPIUM_VERSION && npm cache clean
|
|
||||||
|
|
||||||
#======================
|
#======================
|
||||||
# Install SDK packages
|
# Install SDK packages
|
||||||
#======================
|
#======================
|
||||||
ARG ANDROID_VERSION=5.0.1
|
ARG ANDROID_VERSION=5.0.1
|
||||||
ARG BUILD_TOOL=25.0.3
|
|
||||||
ARG API_LEVEL=21
|
ARG API_LEVEL=21
|
||||||
ARG PROCESSOR=x86
|
ARG PROCESSOR=x86
|
||||||
ARG SYS_IMG=x86_64
|
ARG SYS_IMG=x86
|
||||||
ARG IMG_TYPE=google_apis
|
ARG IMG_TYPE=google_apis
|
||||||
|
ARG BROWSER=android
|
||||||
|
ARG CHROME_DRIVER=2.40
|
||||||
|
ARG GOOGLE_PLAY_SERVICE=12.8.74
|
||||||
|
ARG GOOGLE_PLAY_STORE=11.0.50
|
||||||
|
ARG APP_RELEASE_VERSION=1.5-p0
|
||||||
ENV ANDROID_VERSION=$ANDROID_VERSION \
|
ENV ANDROID_VERSION=$ANDROID_VERSION \
|
||||||
BUILD_TOOL=$BUILD_TOOL \
|
|
||||||
API_LEVEL=$API_LEVEL \
|
API_LEVEL=$API_LEVEL \
|
||||||
PROCESSOR=$PROCESSOR \
|
PROCESSOR=$PROCESSOR \
|
||||||
SYS_IMG=$SYS_IMG \
|
SYS_IMG=$SYS_IMG \
|
||||||
IMG_TYPE=$IMG_TYPE
|
IMG_TYPE=$IMG_TYPE \
|
||||||
RUN echo y | android update sdk --no-ui -a --filter build-tools-${BUILD_TOOL}
|
BROWSER=$BROWSER \
|
||||||
|
CHROME_DRIVER=$CHROME_DRIVER \
|
||||||
|
GOOGLE_PLAY_SERVICE=$GOOGLE_PLAY_SERVICE \
|
||||||
|
GOOGLE_PLAY_STORE=$GOOGLE_PLAY_STORE \
|
||||||
|
GA=true \
|
||||||
|
GA_ENDPOINT=https://www.google-analytics.com/collect \
|
||||||
|
GA_TRACKING_ID=UA-128205228-1 \
|
||||||
|
GA_API_VERSION="1" \
|
||||||
|
APP_RELEASE_VERSION=$APP_RELEASE_VERSION \
|
||||||
|
APP_TYPE=Emulator
|
||||||
ENV PATH ${PATH}:${ANDROID_HOME}/build-tools
|
ENV PATH ${PATH}:${ANDROID_HOME}/build-tools
|
||||||
|
|
||||||
RUN rm ${ANDROID_HOME}/tools/emulator \
|
RUN yes | sdkmanager --licenses && \
|
||||||
&& ln -s ${ANDROID_HOME}/tools/emulator64-${PROCESSOR} ${ANDROID_HOME}/tools/emulator
|
sdkmanager "platforms;android-${API_LEVEL}" "system-images;android-${API_LEVEL};${IMG_TYPE};${SYS_IMG}" "emulator"
|
||||||
RUN echo y | android update sdk --no-ui -a -t android-${API_LEVEL},sys-img-${SYS_IMG}-${IMG_TYPE}-${API_LEVEL}
|
|
||||||
|
#==============================================
|
||||||
|
# Download proper version of chromedriver
|
||||||
|
# to be able to use Chrome browser in emulator
|
||||||
|
#==============================================
|
||||||
|
RUN wget -nv -O chrome.zip "https://chromedriver.storage.googleapis.com/${CHROME_DRIVER}/chromedriver_linux64.zip" \
|
||||||
|
&& unzip -x chrome.zip \
|
||||||
|
&& rm chrome.zip
|
||||||
|
|
||||||
|
#================================================================
|
||||||
|
# Download Google Play Services APK and Play Store from apklinker
|
||||||
|
#================================================================
|
||||||
|
Run wget -nv -O google_play_services.apk "https://www.apklinker.com/wp-content/uploads/uploaded_apk/5b5155e5ef4f8/com.google.android.gms_${GOOGLE_PLAY_SERVICE}-020700-204998136_12874013_MinAPI21_(x86)(nodpi)_apklinker.com.apk"
|
||||||
|
Run wget -nv -O google_play_store.apk "https://www.apklinker.com/wp-content/uploads/uploaded_apk/5b632b1164e31/com.android.vending_${GOOGLE_PLAY_STORE}-all-0-PR-206665793_81105000_MinAPI16_(armeabi,armeabi-v7a,mips,mips64,x86,x86_64)(240,320,480dpi)_apklinker.com.apk"
|
||||||
|
|
||||||
#================================================
|
#================================================
|
||||||
# noVNC Default Configurations
|
# noVNC Default Configurations
|
||||||
@@ -148,6 +139,7 @@ ENV DISPLAY=:0 \
|
|||||||
LOCAL_PORT=5900 \
|
LOCAL_PORT=5900 \
|
||||||
TARGET_PORT=6080 \
|
TARGET_PORT=6080 \
|
||||||
TIMEOUT=1 \
|
TIMEOUT=1 \
|
||||||
|
VIDEO_PATH=/tmp/video \
|
||||||
LOG_PATH=/var/log/supervisor
|
LOG_PATH=/var/log/supervisor
|
||||||
|
|
||||||
#===============
|
#===============
|
||||||
@@ -176,7 +168,7 @@ COPY src /root/src
|
|||||||
COPY supervisord.conf /root/
|
COPY supervisord.conf /root/
|
||||||
RUN chmod -R +x /root/src && chmod +x /root/supervisord.conf
|
RUN chmod -R +x /root/src && chmod +x /root/supervisord.conf
|
||||||
|
|
||||||
HEALTHCHECK --interval=2s --timeout=600s --retries=1 \
|
HEALTHCHECK --interval=2s --timeout=40s --retries=1 \
|
||||||
CMD adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done'
|
CMD timeout 40 adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done'
|
||||||
|
|
||||||
CMD /usr/bin/supervisord --configuration supervisord.conf
|
CMD /usr/bin/supervisord --configuration supervisord.conf
|
||||||
@@ -0,0 +1,145 @@
|
|||||||
|
FROM appium/appium:1.10.1-p0
|
||||||
|
|
||||||
|
LABEL maintainer "Budi Utomo <budi.ut.1989@gmail.com>"
|
||||||
|
|
||||||
|
#=============
|
||||||
|
# Set WORKDIR
|
||||||
|
#=============
|
||||||
|
WORKDIR /root
|
||||||
|
|
||||||
|
#==================
|
||||||
|
# General Packages
|
||||||
|
#------------------
|
||||||
|
# xterm
|
||||||
|
# Terminal emulator
|
||||||
|
# supervisor
|
||||||
|
# Process manager
|
||||||
|
# socat
|
||||||
|
# Port forwarder
|
||||||
|
# keychain
|
||||||
|
# ssh-key creator
|
||||||
|
#------------------
|
||||||
|
# Genymotion spec
|
||||||
|
#------------------
|
||||||
|
# bzip2
|
||||||
|
# File compression
|
||||||
|
#------------------
|
||||||
|
# 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 \
|
||||||
|
keychain \
|
||||||
|
bzip2 \
|
||||||
|
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
|
||||||
|
|
||||||
|
#================================================
|
||||||
|
# noVNC Default Configurations
|
||||||
|
# These Configurations can be changed through -e
|
||||||
|
#================================================
|
||||||
|
ARG APP_RELEASE_VERSION=1.5-p0
|
||||||
|
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 \
|
||||||
|
GA=true \
|
||||||
|
GA_ENDPOINT=https://www.google-analytics.com/collect \
|
||||||
|
GA_TRACKING_ID=UA-128205228-1 \
|
||||||
|
GA_API_VERSION="1" \
|
||||||
|
APP_RELEASE_VERSION=$APP_RELEASE_VERSION \
|
||||||
|
APP_TYPE=Genymotion
|
||||||
|
|
||||||
|
#====================
|
||||||
|
# Install genymotion
|
||||||
|
#====================
|
||||||
|
RUN echo | ssh-keygen -q
|
||||||
|
ARG GENYMOTION_VERSION=2.12.1
|
||||||
|
ENV GENYMOTION=true \
|
||||||
|
GENYMOTION_VERSION=$GENYMOTION_VERSION \
|
||||||
|
PATH="${PATH}:/opt/genymobile/genymotion/" \
|
||||||
|
APPIUM_LOG=$LOG_PATH/appium.log
|
||||||
|
RUN wget -nv -O genymotion.bin "https://dl.genymotion.com/releases/genymotion-${GENYMOTION_VERSION}/genymotion-${GENYMOTION_VERSION}-linux_x64.bin" \
|
||||||
|
&& chmod +x ./genymotion.bin \
|
||||||
|
&& yes | ./genymotion.bin \
|
||||||
|
&& rm genymotion.bin
|
||||||
|
COPY genymotion/generate_config.sh genymotion/geny_start.sh genymotion/enable_adb.sh /root/
|
||||||
|
|
||||||
|
#===================
|
||||||
|
# Install Terraform
|
||||||
|
#===================
|
||||||
|
ARG TERRAFORM_VERSION=0.11.7
|
||||||
|
|
||||||
|
ENV TERRAFORM_VERSION=$TERRAFORM_VERSION
|
||||||
|
RUN wget -nv -O terraform.zip "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip" \
|
||||||
|
&& unzip -x terraform.zip \
|
||||||
|
&& rm terraform.zip
|
||||||
|
|
||||||
|
#===============
|
||||||
|
# Expose Ports
|
||||||
|
#---------------
|
||||||
|
# 4723
|
||||||
|
# Appium port
|
||||||
|
# 6080
|
||||||
|
# noVNC port
|
||||||
|
# 5555
|
||||||
|
# ADB connection port
|
||||||
|
#===============
|
||||||
|
EXPOSE 4723 6080 5555
|
||||||
|
|
||||||
|
#=======================
|
||||||
|
# Run docker-genymotion
|
||||||
|
#=======================
|
||||||
|
COPY src /root/src
|
||||||
|
COPY supervisord.conf /root/
|
||||||
|
RUN chmod -R +x /root/src && chmod +x /root/supervisord.conf /root/geny_start.sh
|
||||||
|
RUN gmtool --cloud config use_custom_sdk=on sdk_path=/root
|
||||||
|
CMD ["./geny_start.sh"]
|
||||||
@@ -0,0 +1,119 @@
|
|||||||
|
FROM appium/appium:1.10.1-p0
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
#================================================
|
||||||
|
# noVNC Default Configurations
|
||||||
|
# These Configurations can be changed through -e
|
||||||
|
#================================================
|
||||||
|
ARG APP_RELEASE_VERSION=1.5-p0
|
||||||
|
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 \
|
||||||
|
GA=true \
|
||||||
|
GA_ENDPOINT=https://www.google-analytics.com/collect \
|
||||||
|
GA_TRACKING_ID=UA-128205228-1 \
|
||||||
|
GA_API_VERSION="1" \
|
||||||
|
APP_RELEASE_VERSION=$APP_RELEASE_VERSION \
|
||||||
|
APP_TYPE=Device
|
||||||
|
|
||||||
|
#=========================
|
||||||
|
# Set default variables
|
||||||
|
#=========================
|
||||||
|
ENV APPIUM_LOG=$LOG_PATH/appium.log
|
||||||
|
ENV REAL_DEVICE=true
|
||||||
|
ENV BROWSER=android
|
||||||
|
|
||||||
|
#===============
|
||||||
|
# Expose Ports
|
||||||
|
#---------------
|
||||||
|
# 4723
|
||||||
|
# Appium port
|
||||||
|
# 6080
|
||||||
|
# noVNC port
|
||||||
|
# 5555
|
||||||
|
# ADB connection port
|
||||||
|
#===============
|
||||||
|
EXPOSE 4723 6080 5555
|
||||||
|
|
||||||
|
#===================
|
||||||
|
# Run docker-appium
|
||||||
|
#===================
|
||||||
|
COPY sm/asm.jar /root/
|
||||||
|
COPY src /root/src
|
||||||
|
COPY supervisord.conf /root/
|
||||||
|
RUN chmod -R +x /root/src && chmod +x /root/supervisord.conf
|
||||||
|
|
||||||
|
CMD /usr/bin/supervisord --configuration supervisord.conf
|
||||||
@@ -9,10 +9,12 @@ class SimpleAndroidUITests(unittest.TestCase):
|
|||||||
desired_caps = {
|
desired_caps = {
|
||||||
'platformName': 'Android',
|
'platformName': 'Android',
|
||||||
'deviceName': 'Android Emulator',
|
'deviceName': 'Android Emulator',
|
||||||
|
'automationName': 'UIAutomator2',
|
||||||
'app': '/root/tmp/sample_apk_debug.apk',
|
'app': '/root/tmp/sample_apk_debug.apk',
|
||||||
'avd': 'samsung_galaxy_s6_7.1.1'
|
'browserName': 'android',
|
||||||
|
'avd': 'nexus_5_7.1.1'
|
||||||
}
|
}
|
||||||
self.driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
|
self.driver = webdriver.Remote('http://127.0.0.1:4444/wd/hub', desired_caps)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
self.driver.quit()
|
self.driver.quit()
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
from time import sleep
|
||||||
|
|
||||||
from appium import webdriver
|
from appium import webdriver
|
||||||
|
|
||||||
|
|
||||||
@@ -13,12 +15,24 @@ class MSiteChromeAndroidUITests(unittest.TestCase):
|
|||||||
'deviceName': 'Android Emulator',
|
'deviceName': 'Android Emulator',
|
||||||
'appPackage': 'com.android.chrome',
|
'appPackage': 'com.android.chrome',
|
||||||
'appActivity': 'com.google.android.apps.chrome.Main',
|
'appActivity': 'com.google.android.apps.chrome.Main',
|
||||||
'avd': 'samsung_galaxy_s6_7.1.1'
|
'browserName': 'chrome'
|
||||||
}
|
}
|
||||||
self.driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
|
self.driver = webdriver.Remote('http://127.0.0.1:4444/wd/hub', desired_caps)
|
||||||
|
|
||||||
def test_open_url(self):
|
def test_open_url(self):
|
||||||
self.driver.get('http://targeturl.com')
|
self.driver.get('http://google.com')
|
||||||
|
|
||||||
|
# Handle Welcome Home
|
||||||
|
self.driver.switch_to.context('NATIVE_APP')
|
||||||
|
self.driver.find_element_by_id('terms_accept').click()
|
||||||
|
self.driver.find_element_by_id('negative_button').click()
|
||||||
|
|
||||||
|
# Search for Github
|
||||||
|
self.driver.switch_to.context('CHROMIUM')
|
||||||
|
search = self.driver.find_element_by_name('q')
|
||||||
|
search.send_keys('butomo1989 docker-android')
|
||||||
|
search.submit()
|
||||||
|
sleep(2)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
self.driver.quit()
|
self.driver.quit()
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
from time import sleep
|
||||||
|
|
||||||
from appium import webdriver
|
from appium import webdriver
|
||||||
|
|
||||||
|
|
||||||
@@ -13,12 +15,17 @@ class MSiteDefaultBrowserAndroidUITests(unittest.TestCase):
|
|||||||
'deviceName': 'Android Emulator',
|
'deviceName': 'Android Emulator',
|
||||||
'appPackage': 'com.android.browser',
|
'appPackage': 'com.android.browser',
|
||||||
'appActivity': 'com.android.browser.BrowserActivity',
|
'appActivity': 'com.android.browser.BrowserActivity',
|
||||||
'avd': 'samsung_galaxy_s6_6.0'
|
'browserName': 'browser'
|
||||||
}
|
}
|
||||||
self.driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
|
self.driver = webdriver.Remote('http://127.0.0.1:4444/wd/hub', desired_caps)
|
||||||
|
|
||||||
def test_open_url(self):
|
def test_open_url(self):
|
||||||
self.driver.get('http://targeturl.com')
|
self.driver.get('http://google.com')
|
||||||
|
|
||||||
|
search = self.driver.find_element_by_name('q')
|
||||||
|
search.send_keys('butomo1989 docker-android')
|
||||||
|
search.submit()
|
||||||
|
sleep(2)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
self.driver.quit()
|
self.driver.quit()
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#!/system/bin/sh
|
||||||
|
setprop persist.sys.usb.config adb
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
# 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.14.0-curium
|
||||||
|
ports:
|
||||||
|
- 4444:4444
|
||||||
|
|
||||||
|
# Please stop this container by using docker stop instead of docker-compose stop
|
||||||
|
saas:
|
||||||
|
image: butomo1989/docker-android-genymotion
|
||||||
|
depends_on:
|
||||||
|
- selenium_hub
|
||||||
|
privileged: true
|
||||||
|
volumes:
|
||||||
|
- $PWD/sample_apk:/root/tmp/sample_apk
|
||||||
|
- $PWD/sample_devices:/root/tmp
|
||||||
|
environment:
|
||||||
|
- TYPE=SaaS
|
||||||
|
- TEMPLATE=/root/tmp/devices.json
|
||||||
|
- USER=$USER
|
||||||
|
- PASS=$PASS
|
||||||
|
- LICENSE=$LICENSE
|
||||||
|
- CONNECT_TO_GRID=true
|
||||||
|
|
||||||
|
# Please stop this container by using docker stop instead of docker-compose stop
|
||||||
|
aws:
|
||||||
|
image: butomo1989/docker-android-genymotion
|
||||||
|
depends_on:
|
||||||
|
- selenium_hub
|
||||||
|
privileged: true
|
||||||
|
volumes:
|
||||||
|
- ~/.aws:/root/.aws
|
||||||
|
- $PWD/sample_apk:/root/tmp/sample_apk
|
||||||
|
- $PWD/sample_devices:/root/tmp
|
||||||
|
environment:
|
||||||
|
- TYPE=aws
|
||||||
|
- TEMPLATE=/root/tmp/aws.json
|
||||||
|
- CONNECT_TO_GRID=true
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"region": "eu-west-1",
|
||||||
|
"android_version": "8.0",
|
||||||
|
"instance": "t2.small"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"region": "eu-west-1",
|
||||||
|
"instance": "t2.small",
|
||||||
|
"AMI": "ami-68d78411",
|
||||||
|
"SG": [
|
||||||
|
{
|
||||||
|
"type": "ingress",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"from_port": 22,
|
||||||
|
"to_port": 22,
|
||||||
|
"protocol": "tcp",
|
||||||
|
"cidr_blocks": "0.0.0.0/0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from_port": 80,
|
||||||
|
"to_port": 80,
|
||||||
|
"protocol": "tcp",
|
||||||
|
"cidr_blocks": "0.0.0.0/0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from_port": 443,
|
||||||
|
"to_port": 443,
|
||||||
|
"protocol": "tcp",
|
||||||
|
"cidr_blocks": "0.0.0.0/0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from_port": 51000,
|
||||||
|
"to_port": 51100,
|
||||||
|
"protocol": "tcp",
|
||||||
|
"cidr_blocks": "0.0.0.0/0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from_port": 51000,
|
||||||
|
"to_port": 51100,
|
||||||
|
"protocol": "udp",
|
||||||
|
"cidr_blocks": "0.0.0.0/0"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "egress",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"from_port": 0,
|
||||||
|
"to_port": 65535,
|
||||||
|
"protocol": "udp",
|
||||||
|
"cidr_blocks": "0.0.0.0/0"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"template": "Samsung Galaxy S7 - 6.0.0 - API 23 - 1440x2560",
|
||||||
|
"device": "SamsungS7V6",
|
||||||
|
"port": 38727
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"template": "Google Nexus 6 - 8.0 - API 26 - 1440x2560",
|
||||||
|
"device": "Nexus6V8"
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
(export USER=$USER && export PASS=$PASS && export LICENSE=$LICENSE && docker-compose -f geny.yml up -d)
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
node_config_json=$1
|
||||||
|
|
||||||
|
if [ -z "$PLATFORM_NAME" ]; then
|
||||||
|
PLATFORM_NAME="Android"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$APPIUM_HOST" ]; then
|
||||||
|
APPIUM_HOST=$(hostname -i)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$APPIUM_PORT" ]; then
|
||||||
|
APPIUM_PORT=4723
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$SELENIUM_HOST" ]; then
|
||||||
|
SELENIUM_HOST="172.17.0.1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$SELENIUM_PORT" ]; then
|
||||||
|
SELENIUM_PORT=4444
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$BROWSER_NAME" ]; then
|
||||||
|
BROWSER_NAME="android"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$NODE_TIMEOUT" ]; then
|
||||||
|
NODE_TIMEOUT=300
|
||||||
|
fi
|
||||||
|
|
||||||
|
#Get device names
|
||||||
|
devices=($(adb devices | grep -oP "\K([^ ]+)(?=\sdevice(\W|$))"))
|
||||||
|
echo "Devices found: ${#devices[@]}"
|
||||||
|
|
||||||
|
#Create capabilities json configs
|
||||||
|
function create_capabilities() {
|
||||||
|
capabilities=""
|
||||||
|
for name in ${devices[@]}; do
|
||||||
|
os_version="$(adb -s $name shell getprop ro.build.version.release | tr -d '\r')"
|
||||||
|
capabilities+=$(cat <<_EOF
|
||||||
|
{
|
||||||
|
"platform": "$PLATFORM_NAME",
|
||||||
|
"platformName": "$PLATFORM_NAME",
|
||||||
|
"version": "$os_version",
|
||||||
|
"browserName": "$BROWSER_NAME",
|
||||||
|
"deviceName": "$name",
|
||||||
|
"maxInstances": 1,
|
||||||
|
"applicationName": "$name"
|
||||||
|
}
|
||||||
|
_EOF
|
||||||
|
)
|
||||||
|
if [ ${devices[-1]} != $name ]; then
|
||||||
|
capabilities+=', '
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "$capabilities"
|
||||||
|
}
|
||||||
|
|
||||||
|
#Final node configuration json string
|
||||||
|
nodeconfig=$(cat <<_EOF
|
||||||
|
{
|
||||||
|
"capabilities": [$(create_capabilities)],
|
||||||
|
"configuration": {
|
||||||
|
"cleanUpCycle": 2000,
|
||||||
|
"timeout": $NODE_TIMEOUT,
|
||||||
|
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
|
||||||
|
"url": "http://$APPIUM_HOST:$APPIUM_PORT/wd/hub",
|
||||||
|
"host": "$APPIUM_HOST",
|
||||||
|
"port": $APPIUM_PORT,
|
||||||
|
"maxSession": 6,
|
||||||
|
"register": true,
|
||||||
|
"registerCycle": 5000,
|
||||||
|
"hubHost": "$SELENIUM_HOST",
|
||||||
|
"hubPort": $SELENIUM_PORT
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_EOF
|
||||||
|
)
|
||||||
|
echo "$nodeconfig" > $node_config_json
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# This script is needed because of https://www.ctl.io/developers/blog/post/gracefully-stopping-docker-containers/
|
||||||
|
|
||||||
|
types=(saas aws)
|
||||||
|
|
||||||
|
if [ -z "$TYPE" ]; then
|
||||||
|
echo "Please specify one of following types: ${types[@]}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
TYPE=$(echo "$TYPE" | tr '[:upper:]' '[:lower:]')
|
||||||
|
|
||||||
|
if [ -z "$TEMPLATE" ]; then
|
||||||
|
case $TYPE in
|
||||||
|
"${types[0]}" )
|
||||||
|
TEMPLATE="/root/tmp/devices.json"
|
||||||
|
;;
|
||||||
|
"${types[1]}" )
|
||||||
|
TEMPLATE="/root/tmp/aws.json"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
"Type $TYPE is not supported! Valid types: ${types[@]}"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "$TEMPLATE" ]; then
|
||||||
|
echo "File not found! Nothing to do!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[geny_start] Available types: ${types[@]}"
|
||||||
|
echo "[geny_start] Selected type of deployment: $TYPE, Template file: $TEMPLATE"
|
||||||
|
export TYPE=$TYPE
|
||||||
|
export TEMPLATE=$TEMPLATE
|
||||||
|
export TYPES=${types[@]}
|
||||||
|
|
||||||
|
getAbort() {
|
||||||
|
case $TYPE in
|
||||||
|
"${types[0]}" )
|
||||||
|
contents=$(cat $TEMPLATE)
|
||||||
|
echo "ABORT SIGNAL detected! Stopping all created emulators..."
|
||||||
|
for row in $(echo "${contents}" | jq -r '.[] | @base64'); do
|
||||||
|
get_value() {
|
||||||
|
echo ${row} | base64 --decode | jq -r ${1}
|
||||||
|
}
|
||||||
|
|
||||||
|
gmtool --cloud admin stopdisposable $(get_value '.device')
|
||||||
|
done
|
||||||
|
echo "Done"
|
||||||
|
;;
|
||||||
|
"${types[1]}" )
|
||||||
|
contents=$(cat $TEMPLATE)
|
||||||
|
echo "ABORT SIGNAL detected! Detroy all EC2 instance(s)..."
|
||||||
|
./terraform destroy -auto-approve -lock=false
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
trap 'getAbort; exit' EXIT
|
||||||
|
|
||||||
|
/usr/bin/supervisord --configuration supervisord.conf
|
||||||
|
After Width: | Height: | Size: 441 KiB |
|
After Width: | Height: | Size: 146 KiB |
|
After Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 448 KiB |
|
Before Width: | Height: | Size: 150 KiB |
|
Before Width: | Height: | Size: 244 KiB |
|
After Width: | Height: | Size: 146 KiB |
|
After Width: | Height: | Size: 229 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 115 KiB |
|
After Width: | Height: | Size: 261 KiB |
|
After Width: | Height: | Size: 183 KiB |
|
Before Width: | Height: | Size: 76 KiB |
|
After Width: | Height: | Size: 341 KiB |
@@ -2,7 +2,6 @@
|
|||||||
# Bash version should >= 4 to be able to run this script.
|
# Bash version should >= 4 to be able to run this script.
|
||||||
|
|
||||||
IMAGE="butomo1989/docker-android"
|
IMAGE="butomo1989/docker-android"
|
||||||
LATEST_BUILD_TOOL=25.0.2
|
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
read -p "Task (test|build|push|all) : " TASK
|
read -p "Task (test|build|push|all) : " TASK
|
||||||
@@ -11,21 +10,15 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$2" ]; then
|
if [ -z "$2" ]; then
|
||||||
read -p "Android version (5.0.1|5.1.1|6.0|7.0|7.1.1|all): " ANDROID_VERSION
|
read -p "Android version (5.0.1|5.1.1|6.0|7.0|7.1.1|8.0|8.1|9.0|all): " ANDROID_VERSION
|
||||||
else
|
else
|
||||||
ANDROID_VERSION=$2
|
ANDROID_VERSION=$2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$3" ]; then
|
if [ -z "$3" ]; then
|
||||||
read -p "Processor type (x86|arm|all): " PROCESSOR
|
|
||||||
else
|
|
||||||
PROCESSOR=$3
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$4" ]; then
|
|
||||||
read -p "Release version: " RELEASE
|
read -p "Release version: " RELEASE
|
||||||
else
|
else
|
||||||
RELEASE=$4
|
RELEASE=$3
|
||||||
fi
|
fi
|
||||||
|
|
||||||
declare -A list_of_levels=(
|
declare -A list_of_levels=(
|
||||||
@@ -34,11 +27,22 @@ declare -A list_of_levels=(
|
|||||||
[6.0]=23
|
[6.0]=23
|
||||||
[7.0]=24
|
[7.0]=24
|
||||||
[7.1.1]=25
|
[7.1.1]=25
|
||||||
|
[8.0]=26
|
||||||
|
[8.1]=27
|
||||||
|
[9.0]=28
|
||||||
)
|
)
|
||||||
|
|
||||||
declare -A list_of_processors=(
|
# The version of the Chrome browser installed on the Android emulator needs to be known beforehand
|
||||||
[arm]=armeabi-v7a
|
# in order to chose the proper version of chromedriver (see http://chromedriver.chromium.org/downloads)
|
||||||
[x86]=x86_64
|
declare -A chromedriver_versions=(
|
||||||
|
[5.0.1]="2.21"
|
||||||
|
[5.1.1]="2.13"
|
||||||
|
[6.0]="2.18"
|
||||||
|
[7.0]="2.23"
|
||||||
|
[7.1.1]="2.28"
|
||||||
|
[8.0]="2.31"
|
||||||
|
[8.1]="2.33"
|
||||||
|
[9.0]="2.40"
|
||||||
)
|
)
|
||||||
|
|
||||||
function get_android_versions() {
|
function get_android_versions() {
|
||||||
@@ -58,86 +62,121 @@ function get_android_versions() {
|
|||||||
|
|
||||||
# If version cannot be found in the list
|
# If version cannot be found in the list
|
||||||
if [ -z "$versions" ]; then
|
if [ -z "$versions" ]; then
|
||||||
echo "Android version \"$ANDROID_VERSION\" is not found in the list or not supported! Support only version 5.0.1, 5.1.1, 6.0, 7.0, 7.1.1"
|
echo "Android version \"$ANDROID_VERSION\" is not found in the list or not supported! Support only version 5.0.1, 5.1.1, 6.0, 7.0, 7.1.1, 8.0, 8.1"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Android versions: ${versions[@]}"
|
echo "Android versions: ${versions[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_processors() {
|
|
||||||
processors=()
|
|
||||||
|
|
||||||
if [ "$PROCESSOR" == "all" ]; then
|
|
||||||
for key in "${!list_of_processors[@]}"; do
|
|
||||||
processors+=($key)
|
|
||||||
done
|
|
||||||
else
|
|
||||||
for key in "${!list_of_processors[@]}"; do
|
|
||||||
if [[ $key == *"$PROCESSOR"* ]]; then
|
|
||||||
processors+=($key)
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If version cannot be found in the list
|
|
||||||
if [ -z "$processors" ]; then
|
|
||||||
echo "Invalid processor \"$PROCESSOR\"! Valid options: x86, arm"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Processors: ${processors[@]}"
|
|
||||||
}
|
|
||||||
|
|
||||||
get_android_versions
|
get_android_versions
|
||||||
get_processors
|
processor=x86
|
||||||
|
|
||||||
function test() {
|
function test() {
|
||||||
(export ANDROID_HOME=/root && export ANDROID_VERSION=5.0.1 && export API_LEVEL=21 \
|
# Prepare needed parameter to run tests
|
||||||
&& export PROCESSOR=x86 && export SYS_IMG=x86_64 && export IMG_TYPE=google_apis && nosetests -v)
|
test_android_version=7.1.1
|
||||||
|
test_api_level=25
|
||||||
|
test_processor=x86
|
||||||
|
test_sys_img=$test_processor
|
||||||
|
test_img_type=google_apis
|
||||||
|
test_browser=chrome
|
||||||
|
test_image=test_img
|
||||||
|
test_container=test_con
|
||||||
|
|
||||||
|
# Run e2e tests
|
||||||
|
# E2E tests must be run only for linux OS / x86 image to reduce duration of test execution
|
||||||
|
if [ "$(uname -s)" == 'Linux' ] && [ "$E2E" = true ]; then
|
||||||
|
echo "----BUILD TEST IMAGE----"
|
||||||
|
docker build -t $test_image --build-arg ANDROID_VERSION=$test_android_version \
|
||||||
|
--build-arg API_LEVEL=$test_api_level --build-arg PROCESSOR=$test_processor --build-arg SYS_IMG=$test_sys_img \
|
||||||
|
--build-arg IMG_TYPE=$test_img_type --build-arg BROWSER=$test_browser -f docker/Emulator_x86 .
|
||||||
|
|
||||||
|
echo "----REMOVE OLD TEST CONTAINER----"
|
||||||
|
docker kill $test_container && docker rm $test_container
|
||||||
|
|
||||||
|
echo "----PREPARE CONTAINER----"
|
||||||
|
docker run --privileged -d -p 4723:4723 -p 6080:6080 -e APPIUM=True -e DEVICE="Samsung Galaxy S6" --name $test_container $test_image
|
||||||
|
docker cp example/sample_apk $test_container:/root/tmp
|
||||||
|
attempt=0
|
||||||
|
while [ ${attempt} -le 10 ]; do
|
||||||
|
attempt=$(($attempt + 1))
|
||||||
|
output=$(docker ps | grep healthy | grep test_con | wc -l)
|
||||||
|
if [[ "$output" == 1 ]]; then
|
||||||
|
echo "Emulator is ready."
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "Waiting 10 seconds for emulator to be ready (attempt: $attempt)"
|
||||||
|
sleep 10
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $attempt == 10 ]]; then
|
||||||
|
echo "Failed!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "----RUN E2E TESTS----"
|
||||||
|
nosetests src/tests/e2e -v
|
||||||
|
|
||||||
|
echo "----REMOVE TEST CONTAINER----"
|
||||||
|
docker kill $test_container && docker rm $test_container
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run unit tests (After e2e test to get coverage result)
|
||||||
|
echo "----UNIT TESTS----"
|
||||||
|
(export ANDROID_HOME=/root && export ANDROID_VERSION=$test_android_version && export API_LEVEL=$test_api_level \
|
||||||
|
&& export PROCESSOR=$test_processor && export SYS_IMG=$test_sys_img && export IMG_TYPE=$test_img_type \
|
||||||
|
&& nosetests src/tests/unit -v)
|
||||||
}
|
}
|
||||||
|
|
||||||
function build() {
|
function build() {
|
||||||
# Remove pyc files
|
# Remove pyc files
|
||||||
find . -name "*.pyc" -exec rm -f {} \;
|
find . -name "*.pyc" -exec rm -f {} \;
|
||||||
|
|
||||||
# Build docker image(s)
|
# Build docker image
|
||||||
for p in "${processors[@]}"; do
|
FILE_NAME=docker/Emulator_x86
|
||||||
for v in "${versions[@]}"; do
|
|
||||||
# Find image type
|
for v in "${versions[@]}"; do
|
||||||
if [ "$v" == "5.0.1" ] || [ "$v" == "5.1.1" ]; then
|
# Find image type and default web browser
|
||||||
IMG_TYPE=android
|
if [ "$v" == "5.0.1" ] || [ "$v" == "5.1.1" ]; then
|
||||||
else
|
IMG_TYPE=default
|
||||||
IMG_TYPE=google_apis
|
BROWSER=browser
|
||||||
fi
|
elif [ "$v" == "6.0" ]; then
|
||||||
echo "[BUILD] IMAGE TYPE: $IMG_TYPE"
|
# It is because there is no ARM EABI v7a System Image for 6.0
|
||||||
level=${list_of_levels[$v]}
|
IMG_TYPE=google_apis
|
||||||
echo "[BUILD] API Level: $level"
|
BROWSER=browser
|
||||||
sys_img=${list_of_processors[$p]}
|
else
|
||||||
echo "[BUILD] System Image: $sys_img"
|
#adb root cannot be run in IMG_TYPE=google_apis_playstore
|
||||||
image_version="$IMAGE-$p-$v:$RELEASE"
|
IMG_TYPE=google_apis
|
||||||
image_latest="$IMAGE-$p-$v:latest"
|
BROWSER=chrome
|
||||||
echo "[BUILD] Image name: $image_version and $image_latest"
|
fi
|
||||||
docker build -t $image_version --build-arg ANDROID_VERSION=$v --build-arg BUILD_TOOL=$LATEST_BUILD_TOOL \
|
echo "[BUILD] IMAGE TYPE: $IMG_TYPE"
|
||||||
--build-arg API_LEVEL=$level --build-arg PROCESSOR=$p --build-arg SYS_IMG=$sys_img \
|
level=${list_of_levels[$v]}
|
||||||
--build-arg IMG_TYPE=$IMG_TYPE .
|
echo "[BUILD] API Level: $level"
|
||||||
docker build -t $image_latest --build-arg ANDROID_VERSION=$v --build-arg BUILD_TOOL=$LATEST_BUILD_TOOL \
|
sys_img=$processor
|
||||||
--build-arg API_LEVEL=$level --build-arg PROCESSOR=$p --build-arg SYS_IMG=$sys_img \
|
echo "[BUILD] System Image: $sys_img"
|
||||||
--build-arg IMG_TYPE=$IMG_TYPE .
|
chrome_driver="${chromedriver_versions[$v]}"
|
||||||
done
|
echo "[BUILD] chromedriver version: $chrome_driver"
|
||||||
|
image_version="$IMAGE-$processor-$v:$RELEASE"
|
||||||
|
image_latest="$IMAGE-$processor-$v:latest"
|
||||||
|
echo "[BUILD] Image name: $image_version and $image_latest"
|
||||||
|
echo "[BUILD] Dockerfile: $FILE_NAME"
|
||||||
|
docker build -t $image_version --build-arg ANDROID_VERSION=$v --build-arg API_LEVEL=$level \
|
||||||
|
--build-arg PROCESSOR=$processor --build-arg SYS_IMG=$sys_img --build-arg IMG_TYPE=$IMG_TYPE \
|
||||||
|
--build-arg BROWSER=$BROWSER --build-arg CHROME_DRIVER=$chrome_driver \
|
||||||
|
--build-arg APP_RELEASE_VERSION=$RELEASE -f $FILE_NAME .
|
||||||
|
docker tag $image_version $image_latest
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function push() {
|
function push() {
|
||||||
# Push docker image(s)
|
# Push docker image(s)
|
||||||
for p in "${processors[@]}"; do
|
for v in "${versions[@]}"; do
|
||||||
for v in "${versions[@]}"; do
|
image_version="$IMAGE-$processor-$v:$RELEASE"
|
||||||
image_version="$IMAGE-$p-$v:$RELEASE"
|
image_latest="$IMAGE-$processor-$v:latest"
|
||||||
image_latest="$IMAGE-$p-$v:latest"
|
echo "[PUSH] Image name: $image_version and $image_latest"
|
||||||
echo "[PUSH] Image name: $image_version and $image_latest"
|
docker push $image_version
|
||||||
docker push $image_version
|
docker push $image_latest
|
||||||
docker push $image_latest
|
|
||||||
done
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
read -p "Task (build|push|all) : " TASK
|
||||||
|
else
|
||||||
|
TASK=$1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$2" ]; then
|
||||||
|
read -p "Release version: " RELEASE
|
||||||
|
else
|
||||||
|
RELEASE=$2
|
||||||
|
fi
|
||||||
|
|
||||||
|
IMAGE="butomo1989/docker-android"
|
||||||
|
FILE_NAME=docker/Genymotion
|
||||||
|
|
||||||
|
image_version="$IMAGE-genymotion:$RELEASE"
|
||||||
|
image_latest="$IMAGE-genymotion:latest"
|
||||||
|
|
||||||
|
function build() {
|
||||||
|
echo "[BUILD] Image name: $image_version and $image_latest"
|
||||||
|
echo "[BUILD] Dockerfile: $FILE_NAME"
|
||||||
|
docker build -t $image_version --build-arg APP_RELEASE_VERSION=$RELEASE -f $FILE_NAME .
|
||||||
|
docker tag $image_version $image_latest
|
||||||
|
}
|
||||||
|
|
||||||
|
function push() {
|
||||||
|
echo "[PUSH] Image name: $image_version and $image_latest"
|
||||||
|
docker push $image_version
|
||||||
|
docker push $image_latest
|
||||||
|
}
|
||||||
|
|
||||||
|
case $TASK in
|
||||||
|
build)
|
||||||
|
build
|
||||||
|
;;
|
||||||
|
push)
|
||||||
|
push
|
||||||
|
;;
|
||||||
|
all)
|
||||||
|
build
|
||||||
|
push
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Invalid environment! Valid options: test, build, push, all"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
read -p "Task (build|push|all) : " TASK
|
||||||
|
else
|
||||||
|
TASK=$1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$2" ]; then
|
||||||
|
read -p "Release version: " RELEASE
|
||||||
|
else
|
||||||
|
RELEASE=$2
|
||||||
|
fi
|
||||||
|
|
||||||
|
IMAGE="butomo1989/docker-android"
|
||||||
|
FILE_NAME=docker/Real_device
|
||||||
|
|
||||||
|
image_version="$IMAGE-real-device:$RELEASE"
|
||||||
|
image_latest="$IMAGE-real-device:latest"
|
||||||
|
|
||||||
|
function build() {
|
||||||
|
echo "[BUILD] Image name: $image_version and $image_latest"
|
||||||
|
echo "[BUILD] Dockerfile: $FILE_NAME"
|
||||||
|
docker build -t $image_version --build-arg APP_RELEASE_VERSION=$RELEASE -f $FILE_NAME .
|
||||||
|
docker tag $image_version $image_latest
|
||||||
|
}
|
||||||
|
|
||||||
|
function push() {
|
||||||
|
echo "[PUSH] Image name: $image_version and $image_latest"
|
||||||
|
docker push $image_version
|
||||||
|
docker push $image_latest
|
||||||
|
}
|
||||||
|
|
||||||
|
case $TASK in
|
||||||
|
build)
|
||||||
|
build
|
||||||
|
;;
|
||||||
|
push)
|
||||||
|
push
|
||||||
|
;;
|
||||||
|
all)
|
||||||
|
build
|
||||||
|
push
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Invalid environment! Valid options: test, build, push, all"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
selenium==3.3.1
|
||||||
|
Appium-Python-Client==0.24
|
||||||
coverage==4.2
|
coverage==4.2
|
||||||
mock==2.0.0
|
mock==2.0.0
|
||||||
nose==1.3.7
|
nose==1.3.7
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
IMAGE_NAME="butomo1989/docker-android"
|
||||||
|
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
read -p "Type : " TYPE
|
||||||
|
else
|
||||||
|
TYPE=$1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$2" ]; then
|
||||||
|
read -p "Version : " VERSION
|
||||||
|
else
|
||||||
|
VERSION=$2
|
||||||
|
fi
|
||||||
|
|
||||||
|
declare -a versions=("7.1.1" "7.0" "6.0" "5.1.1" "5.0.1")
|
||||||
|
|
||||||
|
## now loop through the above array
|
||||||
|
for v in "${versions[@]}"
|
||||||
|
do
|
||||||
|
IMAGE="$IMAGE_NAME-$TYPE-$v"
|
||||||
|
IMAGE_OLD="$IMAGE:$VERSION"
|
||||||
|
IMAGE_LATEST="$IMAGE:latest"
|
||||||
|
echo "Revert image \"$IMAGE_LATEST\" to version \"$IMAGE_OLD\""
|
||||||
|
docker pull $IMAGE_OLD
|
||||||
|
docker tag $IMAGE_OLD $IMAGE_LATEST
|
||||||
|
docker push $IMAGE_LATEST
|
||||||
|
done
|
||||||
@@ -2,5 +2,6 @@ import os
|
|||||||
|
|
||||||
ROOT = '/root'
|
ROOT = '/root'
|
||||||
WORKDIR = os.path.dirname(__file__)
|
WORKDIR = os.path.dirname(__file__)
|
||||||
|
CHROME_DRIVER = os.path.join(ROOT, 'chromedriver')
|
||||||
CONFIG_FILE = os.path.join(WORKDIR, 'nodeconfig.json')
|
CONFIG_FILE = os.path.join(WORKDIR, 'nodeconfig.json')
|
||||||
LOGGING_FILE = os.path.join(WORKDIR, 'logging.conf')
|
LOGGING_FILE = os.path.join(WORKDIR, 'logging.conf')
|
||||||
|
|||||||
@@ -4,14 +4,25 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import uuid
|
||||||
|
|
||||||
from src import CONFIG_FILE, ROOT
|
from src import CHROME_DRIVER, CONFIG_FILE, ROOT
|
||||||
from src import log
|
from src import log
|
||||||
|
|
||||||
log.init()
|
log.init()
|
||||||
logger = logging.getLogger('app')
|
logger = logging.getLogger('app')
|
||||||
|
|
||||||
|
|
||||||
|
def symlink_force(target, link_name):
|
||||||
|
try:
|
||||||
|
os.symlink(target, link_name)
|
||||||
|
except OSError as e:
|
||||||
|
import errno
|
||||||
|
if e.errno == errno.EEXIST:
|
||||||
|
os.remove(link_name)
|
||||||
|
os.symlink(target, link_name)
|
||||||
|
|
||||||
|
|
||||||
def get_or_raise(env: str) -> str:
|
def get_or_raise(env: str) -> str:
|
||||||
"""
|
"""
|
||||||
Check if needed environment variables are given.
|
Check if needed environment variables are given.
|
||||||
@@ -26,7 +37,7 @@ def get_or_raise(env: str) -> str:
|
|||||||
return env_value
|
return env_value
|
||||||
|
|
||||||
|
|
||||||
def str_to_bool(str: str) -> bool:
|
def convert_str_to_bool(str: str) -> bool:
|
||||||
"""
|
"""
|
||||||
Convert string to boolean.
|
Convert string to boolean.
|
||||||
|
|
||||||
@@ -39,6 +50,9 @@ def str_to_bool(str: str) -> bool:
|
|||||||
logger.error(err)
|
logger.error(err)
|
||||||
|
|
||||||
|
|
||||||
|
def is_initialized() -> bool:
|
||||||
|
return os.path.exists(os.path.join(ROOT, '.android', 'devices.xml'))
|
||||||
|
|
||||||
ANDROID_HOME = get_or_raise('ANDROID_HOME')
|
ANDROID_HOME = get_or_raise('ANDROID_HOME')
|
||||||
ANDROID_VERSION = get_or_raise('ANDROID_VERSION')
|
ANDROID_VERSION = get_or_raise('ANDROID_VERSION')
|
||||||
API_LEVEL = get_or_raise('API_LEVEL')
|
API_LEVEL = get_or_raise('API_LEVEL')
|
||||||
@@ -61,22 +75,9 @@ def prepare_avd(device: str, avd_name: str):
|
|||||||
:param device: Device name
|
:param device: Device name
|
||||||
:param avd_name: Name of android virtual device / emulator
|
:param avd_name: Name of android virtual device / emulator
|
||||||
"""
|
"""
|
||||||
cmd = 'echo no | android create avd -f -n {name} -t android-{api} -b {img_type}{sys_img}'.format(
|
|
||||||
name=avd_name, api=API_LEVEL, img_type='google_apis/' if IMG_TYPE == 'google_apis' else '',
|
|
||||||
sys_img=SYS_IMG)
|
|
||||||
|
|
||||||
# Link emulator skins
|
|
||||||
skin_rsc_path = os.path.join(ROOT, 'devices', 'skins')
|
|
||||||
logger.info('Skin ressource path: {rsc}'.format(rsc=skin_rsc_path))
|
|
||||||
skin_dst_path = os.path.join(ANDROID_HOME, 'platforms', 'android-{api}'.format(api=API_LEVEL), 'skins')
|
|
||||||
logger.info('Skin destination path: {dst}'.format(dst=skin_dst_path))
|
|
||||||
for s in os.listdir(skin_rsc_path):
|
|
||||||
os.symlink(os.path.join(skin_rsc_path, s), os.path.join(skin_dst_path, s))
|
|
||||||
|
|
||||||
# Hardware and its skin
|
|
||||||
device_name_bash = device.replace(' ', '\ ')
|
device_name_bash = device.replace(' ', '\ ')
|
||||||
skin_name = device.replace(' ', '_').lower()
|
skin_name = device.replace(' ', '_').lower()
|
||||||
logger.info('Device name in bash: {db}, Skin name: {skin}'.format(db=device_name_bash, skin=skin_name))
|
|
||||||
|
|
||||||
# For custom hardware profile
|
# For custom hardware profile
|
||||||
profile_dst_path = os.path.join(ROOT, '.android', 'devices.xml')
|
profile_dst_path = os.path.join(ROOT, '.android', 'devices.xml')
|
||||||
@@ -85,12 +86,22 @@ def prepare_avd(device: str, avd_name: str):
|
|||||||
profile_src_path = os.path.join(ROOT, 'devices', 'profiles', '{profile}.xml'.format(profile=skin_name))
|
profile_src_path = os.path.join(ROOT, 'devices', 'profiles', '{profile}.xml'.format(profile=skin_name))
|
||||||
logger.info('Hardware profile resource path: {rsc}'.format(rsc=profile_src_path))
|
logger.info('Hardware profile resource path: {rsc}'.format(rsc=profile_src_path))
|
||||||
logger.info('Hardware profile destination path: {dst}'.format(dst=profile_dst_path))
|
logger.info('Hardware profile destination path: {dst}'.format(dst=profile_dst_path))
|
||||||
os.symlink(profile_src_path, profile_dst_path)
|
symlink_force(profile_src_path, profile_dst_path)
|
||||||
|
|
||||||
# Append command
|
avd_path = '/'.join([ANDROID_HOME, 'android_emulator'])
|
||||||
cmd += ' -d {device} -s {skin}'.format(device=device_name_bash, skin=skin_name)
|
creation_cmd = 'avdmanager create avd -f -n {name} -b {img_type}/{sys_img} -k "system-images;android-{api_lvl};' \
|
||||||
logger.info('AVD creation command: {cmd}'.format(cmd=cmd))
|
'{img_type};{sys_img}" -d {device} -p {path}'.format(name=avd_name, img_type=IMG_TYPE,
|
||||||
subprocess.check_call(cmd, shell=True)
|
sys_img=SYS_IMG,
|
||||||
|
api_lvl=API_LEVEL, device=device_name_bash,
|
||||||
|
path=avd_path)
|
||||||
|
logger.info('Command to create avd: {command}'.format(command=creation_cmd))
|
||||||
|
subprocess.check_call(creation_cmd, shell=True)
|
||||||
|
|
||||||
|
skin_path = '/'.join([ANDROID_HOME, 'devices', 'skins', skin_name])
|
||||||
|
config_path = '/'.join([avd_path, 'config.ini'])
|
||||||
|
with open(config_path, 'a') as file:
|
||||||
|
file.write('skin.path={sp}'.format(sp=skin_path))
|
||||||
|
logger.info('Skin was added in config.ini')
|
||||||
|
|
||||||
|
|
||||||
def appium_run(avd_name: str):
|
def appium_run(avd_name: str):
|
||||||
@@ -99,25 +110,39 @@ def appium_run(avd_name: str):
|
|||||||
|
|
||||||
:param avd_name: Name of android virtual device / emulator
|
:param avd_name: Name of android virtual device / emulator
|
||||||
"""
|
"""
|
||||||
cmd = 'appium'
|
DEFAULT_LOG_PATH = '/var/log/supervisor/appium.log'
|
||||||
|
cmd = 'appium --log {log}'.format(log=os.getenv('APPIUM_LOG', DEFAULT_LOG_PATH))
|
||||||
|
|
||||||
grid_connect = str_to_bool(str(os.getenv('CONNECT_TO_GRID', False)))
|
relaxed_security = convert_str_to_bool(str(os.getenv('RELAXED_SECURITY', False)))
|
||||||
|
logger.info('Relaxed security? {rs}'.format(rs=relaxed_security))
|
||||||
|
if relaxed_security:
|
||||||
|
cmd += ' --relaxed-security'
|
||||||
|
|
||||||
|
default_web_browser = os.getenv('BROWSER')
|
||||||
|
cmd += ' --chromedriver-executable {driver}'.format(driver=CHROME_DRIVER)
|
||||||
|
|
||||||
|
grid_connect = convert_str_to_bool(str(os.getenv('CONNECT_TO_GRID', False)))
|
||||||
logger.info('Connect to selenium grid? {connect}'.format(connect=grid_connect))
|
logger.info('Connect to selenium grid? {connect}'.format(connect=grid_connect))
|
||||||
if grid_connect:
|
if grid_connect:
|
||||||
|
# Ubuntu 16.04 -> local_ip = os.popen('ifconfig eth0 | grep \'inet addr:\' | cut -d: -f2 | awk \'{ print $1}\'').read().strip()
|
||||||
|
local_ip = os.popen('ifconfig eth0 | grep \'inet\' | cut -d: -f2 | awk \'{ print $2}\'').read().strip()
|
||||||
try:
|
try:
|
||||||
appium_host = os.getenv('APPIUM_HOST', '127.0.0.1')
|
mobile_web_test = convert_str_to_bool(str(os.getenv('MOBILE_WEB_TEST', False)))
|
||||||
|
appium_host = os.getenv('APPIUM_HOST', local_ip)
|
||||||
appium_port = int(os.getenv('APPIUM_PORT', 4723))
|
appium_port = int(os.getenv('APPIUM_PORT', 4723))
|
||||||
selenium_host = os.getenv('SELENIUM_HOST', '172.17.0.1')
|
selenium_host = os.getenv('SELENIUM_HOST', '172.17.0.1')
|
||||||
selenium_port = int(os.getenv('SELENIUM_PORT', 4444))
|
selenium_port = int(os.getenv('SELENIUM_PORT', 4444))
|
||||||
create_node_config(avd_name, appium_host, appium_port, selenium_host, selenium_port)
|
browser_name = default_web_browser if mobile_web_test else 'android'
|
||||||
|
create_node_config(avd_name, browser_name, appium_host, appium_port, selenium_host, selenium_port)
|
||||||
cmd += ' --nodeconfig {file}'.format(file=CONFIG_FILE)
|
cmd += ' --nodeconfig {file}'.format(file=CONFIG_FILE)
|
||||||
except ValueError as v_err:
|
except ValueError as v_err:
|
||||||
logger.error(v_err)
|
logger.error(v_err)
|
||||||
titel = 'Appium Server'
|
title = 'Appium Server'
|
||||||
subprocess.check_call('xterm -T "{titel}" -n "{titel}" -e \"{cmd}\"'.format(titel=titel, cmd=cmd), shell=True)
|
subprocess.check_call('xterm -T "{title}" -n "{title}" -e \"{cmd}\"'.format(title=title, cmd=cmd), shell=True)
|
||||||
|
|
||||||
|
|
||||||
def create_node_config(avd_name: str, appium_host: str, appium_port: int, selenium_host: str, selenium_port: int):
|
def create_node_config(avd_name: str, browser_name: str, appium_host: str, appium_port: int, selenium_host: str,
|
||||||
|
selenium_port: int):
|
||||||
"""
|
"""
|
||||||
Create custom node config file in json format to be able to connect with selenium server.
|
Create custom node config file in json format to be able to connect with selenium server.
|
||||||
|
|
||||||
@@ -133,7 +158,8 @@ def create_node_config(avd_name: str, appium_host: str, appium_port: int, seleni
|
|||||||
'platform': 'Android',
|
'platform': 'Android',
|
||||||
'platformName': 'Android',
|
'platformName': 'Android',
|
||||||
'version': ANDROID_VERSION,
|
'version': ANDROID_VERSION,
|
||||||
'browserName': avd_name,
|
'browserName': browser_name,
|
||||||
|
'deviceName': avd_name,
|
||||||
'maxInstances': 1,
|
'maxInstances': 1,
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -148,7 +174,8 @@ def create_node_config(avd_name: str, appium_host: str, appium_port: int, seleni
|
|||||||
'register': True,
|
'register': True,
|
||||||
'registerCycle': 5000,
|
'registerCycle': 5000,
|
||||||
'hubHost': selenium_host,
|
'hubHost': selenium_host,
|
||||||
'hubPort': selenium_port
|
'hubPort': selenium_port,
|
||||||
|
'unregisterIfStillDownAfter': 120000
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger.info('Appium node config: {config}'.format(config=config))
|
logger.info('Appium node config: {config}'.format(config=config))
|
||||||
@@ -160,20 +187,34 @@ def run():
|
|||||||
"""Run app."""
|
"""Run app."""
|
||||||
device = os.getenv('DEVICE', 'Nexus 5')
|
device = os.getenv('DEVICE', 'Nexus 5')
|
||||||
logger.info('Device: {device}'.format(device=device))
|
logger.info('Device: {device}'.format(device=device))
|
||||||
|
custom_args=os.getenv('EMULATOR_ARGS', '')
|
||||||
|
logger.info('Custom Args: {custom_args}'.format(custom_args=custom_args))
|
||||||
|
|
||||||
avd_name = '{device}_{version}'.format(device=device.replace(' ', '_').lower(), version=ANDROID_VERSION)
|
avd_name = '{device}_{version}'.format(device=device.replace(' ', '_').lower(), version=ANDROID_VERSION)
|
||||||
logger.info('AVD name: {avd}'.format(avd=avd_name))
|
logger.info('AVD name: {avd}'.format(avd=avd_name))
|
||||||
|
is_first_run = not is_initialized()
|
||||||
|
|
||||||
|
if is_first_run:
|
||||||
|
logger.info('Preparing emulator...')
|
||||||
|
prepare_avd(device, avd_name)
|
||||||
|
|
||||||
logger.info('Preparing emulator...')
|
|
||||||
prepare_avd(device, avd_name)
|
|
||||||
logger.info('Run emulator...')
|
logger.info('Run emulator...')
|
||||||
cmd = 'emulator -avd {name}'.format(name=avd_name)
|
dp_size = os.getenv('DATAPARTITION', '550m')
|
||||||
subprocess.Popen(cmd.split())
|
with open("/root/android_emulator/config.ini", "a") as cfg:
|
||||||
|
cfg.write('\ndisk.dataPartition.size={dp}'.format(dp=dp_size))
|
||||||
|
|
||||||
appium = str_to_bool(str(os.getenv('APPIUM', False)))
|
if is_first_run:
|
||||||
|
cmd = 'emulator/emulator @{name} -gpu off -verbose -wipe-data {custom_args}'.format(name=avd_name, custom_args=custom_args)
|
||||||
|
else:
|
||||||
|
cmd = 'emulator/emulator @{name} -gpu off -verbose {custom_args}'.format(name=avd_name, custom_args=custom_args)
|
||||||
|
appium = convert_str_to_bool(str(os.getenv('APPIUM', False)))
|
||||||
if appium:
|
if appium:
|
||||||
|
subprocess.Popen(cmd.split())
|
||||||
logger.info('Run appium server...')
|
logger.info('Run appium server...')
|
||||||
appium_run(avd_name)
|
appium_run(avd_name)
|
||||||
|
else:
|
||||||
|
result = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE).communicate()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
run()
|
run()
|
||||||
|
|||||||
@@ -0,0 +1,337 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
types=($TYPES)
|
||||||
|
echo "Available types: ${types[@]}"
|
||||||
|
echo "Selected type of deployment: $TYPE, Template file: $TEMPLATE"
|
||||||
|
|
||||||
|
function prepare_geny_cloud() {
|
||||||
|
contents=$(cat $TEMPLATE)
|
||||||
|
|
||||||
|
# Register
|
||||||
|
echo "Register user"
|
||||||
|
gmtool config username="${USER}" password="${PASS}"
|
||||||
|
gmtool license register "${LICENSE}"
|
||||||
|
|
||||||
|
# Start device(s)
|
||||||
|
echo "Creating device(s) based on given json file..."
|
||||||
|
for row in $(echo "${contents}" | jq -r '.[] | @base64'); do
|
||||||
|
get_value() {
|
||||||
|
echo ${row} | base64 --decode | jq -r ${1}
|
||||||
|
}
|
||||||
|
|
||||||
|
template=$(get_value '.template')
|
||||||
|
device=$(get_value '.device')
|
||||||
|
port=$(get_value '.port')
|
||||||
|
|
||||||
|
|
||||||
|
if [[ $port != null ]]; then
|
||||||
|
echo "Starting \"$device\" with template name \"$template\" on port \"$port\"..."
|
||||||
|
gmtool --cloud admin startdisposable "${template}" "${device}" --adb-serial-port "${port}"
|
||||||
|
else
|
||||||
|
echo "Starting \"$device\" with template name \"$template\"..."
|
||||||
|
gmtool --cloud admin startdisposable "${template}" "${device}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function prepare_geny_aws() {
|
||||||
|
contents=$(cat $TEMPLATE)
|
||||||
|
|
||||||
|
# Creating aws tf file(s)
|
||||||
|
echo "Creating tf file(s)"
|
||||||
|
index=1
|
||||||
|
port=5555
|
||||||
|
for row in $(echo "${contents}" | jq -r '.[] | @base64'); do
|
||||||
|
get_value() {
|
||||||
|
echo ${row} | base64 --decode | jq -r ${1}
|
||||||
|
}
|
||||||
|
|
||||||
|
region=$(get_value '.region')
|
||||||
|
android_version=$(get_value '.android_version')
|
||||||
|
instance=$(get_value '.instance')
|
||||||
|
ami=$(get_value '.AMI')
|
||||||
|
sg=$(get_value '.SG')
|
||||||
|
|
||||||
|
echo $region
|
||||||
|
echo $android_version
|
||||||
|
echo $instance
|
||||||
|
echo $ami
|
||||||
|
echo $sg
|
||||||
|
|
||||||
|
#TODO: remove this dirty hack
|
||||||
|
if [[ $android_version == null ]]; then
|
||||||
|
echo "[HACK] Version cannot be empty! version will be added!"
|
||||||
|
android_version="6.0"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#Custom Security Group
|
||||||
|
if [[ $sg != null ]]; then
|
||||||
|
echo "Custom security group is found!"
|
||||||
|
security_group=""
|
||||||
|
|
||||||
|
is_array=$(echo "${sg}" | jq 'if type=="array" then true else false end')
|
||||||
|
if [ $is_array == "true" ]; then
|
||||||
|
echo "New security group with given rules will be created"
|
||||||
|
for i in $(echo "${sg}" | jq -r '.[] | @base64'); do
|
||||||
|
get_value() {
|
||||||
|
echo ${i} | base64 --decode | jq -r ${1}
|
||||||
|
}
|
||||||
|
|
||||||
|
type=$(get_value '.type')
|
||||||
|
configs=$(get_value '.configurations')
|
||||||
|
|
||||||
|
|
||||||
|
for c in $(echo "${configs}" | jq -r '.[] | @base64'); do
|
||||||
|
get_value() {
|
||||||
|
echo ${c} | base64 --decode | jq -r ${1}
|
||||||
|
}
|
||||||
|
|
||||||
|
from_port=$(get_value '.from_port')
|
||||||
|
to_port=$(get_value '.to_port')
|
||||||
|
protocol=$(get_value '.protocol')
|
||||||
|
cidr_blocks=$(get_value '.cidr_blocks')
|
||||||
|
security_group+=$(cat <<_EOF
|
||||||
|
|
||||||
|
$type {
|
||||||
|
from_port = $from_port
|
||||||
|
to_port = $to_port
|
||||||
|
protocol = "$protocol"
|
||||||
|
cidr_blocks = ["$cidr_blocks"]
|
||||||
|
}
|
||||||
|
_EOF
|
||||||
|
)
|
||||||
|
done
|
||||||
|
done
|
||||||
|
else
|
||||||
|
#TODO: remove this dirty hack
|
||||||
|
echo "Given security group will be used!"
|
||||||
|
is_array="false"
|
||||||
|
security_group=$(cat <<_EOF
|
||||||
|
ingress {
|
||||||
|
from_port = 22
|
||||||
|
to_port = 22
|
||||||
|
protocol = "tcp"
|
||||||
|
cidr_blocks = ["0.0.0.0/0"]
|
||||||
|
}
|
||||||
|
_EOF
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Custom security is not found! It will use default security group!"
|
||||||
|
security_group=$(cat <<_EOF
|
||||||
|
ingress {
|
||||||
|
from_port = 22
|
||||||
|
to_port = 22
|
||||||
|
protocol = "tcp"
|
||||||
|
cidr_blocks = ["0.0.0.0/0"]
|
||||||
|
}
|
||||||
|
ingress {
|
||||||
|
from_port = 80
|
||||||
|
to_port = 80
|
||||||
|
protocol = "tcp"
|
||||||
|
cidr_blocks = ["0.0.0.0/0"]
|
||||||
|
}
|
||||||
|
ingress {
|
||||||
|
from_port = 443
|
||||||
|
to_port = 443
|
||||||
|
protocol = "tcp"
|
||||||
|
cidr_blocks = ["0.0.0.0/0"]
|
||||||
|
}
|
||||||
|
ingress {
|
||||||
|
from_port = 51000
|
||||||
|
to_port = 51100
|
||||||
|
protocol = "tcp"
|
||||||
|
cidr_blocks = ["0.0.0.0/0"]
|
||||||
|
}
|
||||||
|
ingress {
|
||||||
|
from_port = 51000
|
||||||
|
to_port = 51100
|
||||||
|
protocol = "udp"
|
||||||
|
cidr_blocks = ["0.0.0.0/0"]
|
||||||
|
}
|
||||||
|
egress {
|
||||||
|
from_port = 0
|
||||||
|
to_port = 65535
|
||||||
|
protocol = "udp"
|
||||||
|
cidr_blocks = ["0.0.0.0/0"]
|
||||||
|
}
|
||||||
|
_EOF
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
|
aws_tf_content=$(cat <<_EOF
|
||||||
|
variable "aws_region_$index" {
|
||||||
|
type = "string"
|
||||||
|
default = "$region"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "android_version_$index" {
|
||||||
|
type = "string"
|
||||||
|
default = "$android_version"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "instance_type_$index" {
|
||||||
|
type = "string"
|
||||||
|
default = "$instance"
|
||||||
|
}
|
||||||
|
|
||||||
|
provider "aws" {
|
||||||
|
alias = "provider_$index"
|
||||||
|
region = "\${var.aws_region_$index}"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "aws_security_group" "geny_sg_$index" {
|
||||||
|
provider = "aws.provider_$index"
|
||||||
|
$security_group
|
||||||
|
}
|
||||||
|
|
||||||
|
data "aws_ami" "geny_aws_$index" {
|
||||||
|
provider = "aws.provider_$index"
|
||||||
|
most_recent = true
|
||||||
|
|
||||||
|
filter {
|
||||||
|
name = "name"
|
||||||
|
values = ["genymotion-ami-\${var.android_version_$index}-*"]
|
||||||
|
}
|
||||||
|
|
||||||
|
owners = ["679593333241"] #Genymotion
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "aws_key_pair" "geny_key_$index" {
|
||||||
|
provider = "aws.provider_$index"
|
||||||
|
public_key = "\${file("~/.ssh/id_rsa.pub")}"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "aws_instance" "geny_aws_$index" {
|
||||||
|
provider = "aws.provider_$index"
|
||||||
|
ami="\${data.aws_ami.geny_aws_$index.id}"
|
||||||
|
instance_type = "\${var.instance_type_$index}"
|
||||||
|
vpc_security_group_ids=["\${aws_security_group.geny_sg_$index.name}"]
|
||||||
|
key_name = "\${aws_key_pair.geny_key_$index.key_name}"
|
||||||
|
tags {
|
||||||
|
Name = "DockerAndroid-\${data.aws_ami.geny_aws_$index.id}"
|
||||||
|
}
|
||||||
|
count = 1
|
||||||
|
|
||||||
|
provisioner "remote-exec" {
|
||||||
|
connection {
|
||||||
|
type = "ssh"
|
||||||
|
user = "shell"
|
||||||
|
private_key = "\${file("~/.ssh/id_rsa")}"
|
||||||
|
}
|
||||||
|
|
||||||
|
script = "/root/enable_adb.sh"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
output "public_dns_$index" {
|
||||||
|
value = "\${aws_instance.geny_aws_$index.public_dns}"
|
||||||
|
}
|
||||||
|
_EOF
|
||||||
|
)
|
||||||
|
echo "$aws_tf_content" > /root/aws_tf_$index.tf
|
||||||
|
|
||||||
|
if [[ $ami != null ]]; then
|
||||||
|
echo "Using given AMI!"
|
||||||
|
sed -i "s/.*ami=.*/ ami=\"$ami\"/g" /root/aws_tf_$index.tf
|
||||||
|
else
|
||||||
|
echo "Custom AMI is not found. It will use the latest AMI!"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $sg != null ]] && [[ $is_array == "false" ]]; then
|
||||||
|
echo "Using given security group: $sg"
|
||||||
|
sed -i "s/.*vpc_security_group_ids=.*/ vpc_security_group_ids=[\"$sg\"]/g" /root/aws_tf_$index.tf
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "---------------------------------------------------------"
|
||||||
|
|
||||||
|
((index++))
|
||||||
|
((port++))
|
||||||
|
done
|
||||||
|
|
||||||
|
# Deploy EC2 instance(s)
|
||||||
|
echo "Deploy EC2 instance(s) on AWS with Genymotion image based on given json file..."
|
||||||
|
./terraform init
|
||||||
|
./terraform plan
|
||||||
|
./terraform apply -auto-approve
|
||||||
|
|
||||||
|
# Workaround to connect adb remotely because there is a issue by using local-exec
|
||||||
|
time_sleep=5
|
||||||
|
interval_sleep=1
|
||||||
|
echo "Connect to adb remotely"
|
||||||
|
for ((i=index;i>=1;i--)); do
|
||||||
|
dns=$(./terraform output public_dns_$i)
|
||||||
|
((sleep ${interval_sleep} && adb connect localhost:${port}) > /dev/null & ssh -i ~/.ssh/id_rsa -o ServerAliveInterval=60 -o StrictHostKeyChecking=no -q -NL ${port}:localhost:5555 shell@${dns}) &
|
||||||
|
((port--))
|
||||||
|
time_sleep=$((time_sleep+interval_sleep))
|
||||||
|
done
|
||||||
|
echo "It will wait for ${time_sleep} until all device(s) to be connected"
|
||||||
|
sleep ${time_sleep}
|
||||||
|
adb devices
|
||||||
|
echo "Process is completed"
|
||||||
|
}
|
||||||
|
|
||||||
|
function run_appium() {
|
||||||
|
echo "Preparing appium-server..."
|
||||||
|
CMD="appium --log $APPIUM_LOG"
|
||||||
|
if [ "$CONNECT_TO_GRID" = true ]; then
|
||||||
|
NODE_CONFIG_JSON="/root/src/nodeconfig.json"
|
||||||
|
/root/generate_config.sh $NODE_CONFIG_JSON
|
||||||
|
CMD+=" --nodeconfig $NODE_CONFIG_JSON"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$RELAXED_SECURITY" = true ]; then
|
||||||
|
CMD+=" --relaxed-security"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Preparation is done"
|
||||||
|
$CMD
|
||||||
|
}
|
||||||
|
|
||||||
|
function ga(){
|
||||||
|
if [ "$GA" = true ]; then
|
||||||
|
echo "Collecting data for improving the project"
|
||||||
|
description="PROCESSOR: ${SYS_IMG}; VERSION: ${ANDROID_VERSION}; DEVICE: ${DEVICE}; APPIUM: ${APPIUM}; SELENIUM: ${CONNECT_TO_GRID}; MOBILE_TEST: ${MOBILE_WEB_TEST}"
|
||||||
|
random_user=$(cat /proc/version 2>&1 | sed -e 's/ /_/g' | sed -e 's/[()]//g' | sed -e 's/@.*_gcc_version/_gcc/g' | sed -e 's/__/_/g' | sed -e 's/Linux_version_//g' | sed -e 's/generic_build/genb/g')
|
||||||
|
random_user="${APP_RELEASE_VERSION}_${random_user}"
|
||||||
|
payload=(
|
||||||
|
--data v=${GA_API_VERSION}
|
||||||
|
--data aip=1
|
||||||
|
--data tid="${GA_TRACKING_ID}"
|
||||||
|
--data cid="${random_user}"
|
||||||
|
--data t="event"
|
||||||
|
--data ec="${APP_TYPE}"
|
||||||
|
--data ea="${random_user}"
|
||||||
|
--data el="${description}"
|
||||||
|
--data an="docker-android"
|
||||||
|
--data av="${APP_RELEASE_VERSION}"
|
||||||
|
)
|
||||||
|
curl ${GA_ENDPOINT} "${payload[@]}" --silent
|
||||||
|
else
|
||||||
|
echo "Nothing to do"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
ga
|
||||||
|
if [ "$REAL_DEVICE" = true ]; then
|
||||||
|
echo "Using real device"
|
||||||
|
run_appium
|
||||||
|
elif [ "$GENYMOTION" = true ]; then
|
||||||
|
echo "Using Genymotion"
|
||||||
|
echo "${types[@]}"
|
||||||
|
case $TYPE in
|
||||||
|
"${types[0]}" )
|
||||||
|
echo "Using Genymotion-Cloud (SaaS)"
|
||||||
|
prepare_geny_cloud
|
||||||
|
run_appium
|
||||||
|
;;
|
||||||
|
"${types[1]}" )
|
||||||
|
echo "Using Genymotion-AWS"
|
||||||
|
prepare_geny_aws
|
||||||
|
run_appium
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
echo "Using Emulator"
|
||||||
|
python3 -m src.app
|
||||||
|
fi
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ -z "$REAL_DEVICE"]; then
|
||||||
|
echo "Container is using android emulator"
|
||||||
|
else
|
||||||
|
echo "Starting android screen mirro..."
|
||||||
|
java -jar /root/asm.jar $ANDROID_HOME
|
||||||
|
fi
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
ip=$(ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')
|
#Ubuntu 16.04 -> ip=$(ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')
|
||||||
|
ip=$(ifconfig eth0 | grep 'inet' | cut -d: -f2 | awk '{ print $2}')
|
||||||
socat tcp-listen:5554,bind=$ip,fork tcp:127.0.0.1:5554 &
|
socat tcp-listen:5554,bind=$ip,fork tcp:127.0.0.1:5554 &
|
||||||
socat tcp-listen:5555,bind=$ip,fork tcp:127.0.0.1:5555
|
socat tcp-listen:5555,bind=$ip,fork tcp:127.0.0.1:5555
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
function start() {
|
||||||
|
mkdir -p $VIDEO_PATH
|
||||||
|
name="$(date '+%d_%m_%Y_%H_%M_%S').mp4"
|
||||||
|
echo "Start video recording"
|
||||||
|
ffmpeg -video_size 1599x899 -framerate 15 -f x11grab -i $DISPLAY $VIDEO_PATH/$name -y
|
||||||
|
}
|
||||||
|
|
||||||
|
function stop() {
|
||||||
|
echo "Stop video recording"
|
||||||
|
kill $(ps -ef | grep [f]fmpeg | awk '{print $2}')
|
||||||
|
}
|
||||||
|
|
||||||
|
function auto_record() {
|
||||||
|
echo "Auto record: $AUTO_RECORD"
|
||||||
|
sleep 6
|
||||||
|
|
||||||
|
while [ "$AUTO_RECORD" = true ]; do
|
||||||
|
# Check if there is test running
|
||||||
|
no_test=true
|
||||||
|
while $no_test; do
|
||||||
|
task=$(curl -s localhost:4723/wd/hub/sessions | jq -r '.value')
|
||||||
|
if [ "$task" = "" ] || [ "$task" = "[]" ]; then
|
||||||
|
sleep .5
|
||||||
|
else
|
||||||
|
start &
|
||||||
|
no_test=false
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Check if test is finished
|
||||||
|
while [ $no_test = false ]; do
|
||||||
|
task=$(curl -s localhost:4723/wd/hub/sessions | jq -r '.value')
|
||||||
|
if [ "$task" = "" ] || [ "$task" = "[]" ]; then
|
||||||
|
stop
|
||||||
|
no_test=true
|
||||||
|
else
|
||||||
|
sleep .5
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Auto recording is disabled!"
|
||||||
|
}
|
||||||
|
|
||||||
|
$@
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
"""Unit test to test app."""
|
|
||||||
import os
|
|
||||||
from unittest import TestCase
|
|
||||||
|
|
||||||
import mock
|
|
||||||
|
|
||||||
from src import app
|
|
||||||
|
|
||||||
|
|
||||||
class TestApp(TestCase):
|
|
||||||
"""Unit test class to test other methods in the app."""
|
|
||||||
|
|
||||||
def test_valid_env(self):
|
|
||||||
key = 'ENV_1'
|
|
||||||
os.environ[key] = 'test'
|
|
||||||
app.get_or_raise(key)
|
|
||||||
del os.environ[key]
|
|
||||||
|
|
||||||
def test_invalid_env(self):
|
|
||||||
with self.assertRaises(RuntimeError):
|
|
||||||
app.get_or_raise('ENV_2')
|
|
||||||
|
|
||||||
def test_valid_bool(self):
|
|
||||||
self.assertEqual(app.str_to_bool('True'), True)
|
|
||||||
self.assertEqual(app.str_to_bool('t'), True)
|
|
||||||
self.assertEqual(app.str_to_bool('1'), True)
|
|
||||||
self.assertEqual(app.str_to_bool('YES'), True)
|
|
||||||
|
|
||||||
def test_invalid_bool(self):
|
|
||||||
self.assertEqual(app.str_to_bool(''), False)
|
|
||||||
self.assertEqual(app.str_to_bool('test'), False)
|
|
||||||
|
|
||||||
def test_invalid_format(self):
|
|
||||||
self.assertEqual(app.str_to_bool(True), None)
|
|
||||||
|
|
||||||
@mock.patch('src.app.prepare_avd')
|
|
||||||
@mock.patch('subprocess.Popen')
|
|
||||||
def test_run_with_appium(self, mocked_avd, mocked_subprocess):
|
|
||||||
with mock.patch('src.app.appium_run') as mocked_appium:
|
|
||||||
os.environ['APPIUM'] = str(True)
|
|
||||||
app.run()
|
|
||||||
self.assertTrue(mocked_avd.called)
|
|
||||||
self.assertTrue(mocked_subprocess.called)
|
|
||||||
self.assertTrue(mocked_appium.called)
|
|
||||||
|
|
||||||
@mock.patch('src.app.prepare_avd')
|
|
||||||
@mock.patch('subprocess.Popen')
|
|
||||||
def test_run_withhout_appium(self, mocked_avd, mocked_subprocess):
|
|
||||||
with mock.patch('src.app.appium_run') as mocked_appium:
|
|
||||||
os.environ['APPIUM'] = str(False)
|
|
||||||
app.run()
|
|
||||||
self.assertTrue(mocked_avd.called)
|
|
||||||
self.assertTrue(mocked_subprocess.called)
|
|
||||||
self.assertFalse(mocked_appium.called)
|
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
"""e2e test to test sample android application inside docker-android"""
|
||||||
|
from unittest import TestCase
|
||||||
|
|
||||||
|
from appium import webdriver
|
||||||
|
|
||||||
|
|
||||||
|
class TestE2EAndroidApk(TestCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
desired_caps = {
|
||||||
|
'platformName': 'Android',
|
||||||
|
'deviceName': 'Android Emulator',
|
||||||
|
'automationName': 'UIAutomator2',
|
||||||
|
'app': '/root/tmp/sample_apk_debug.apk'
|
||||||
|
}
|
||||||
|
self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
|
||||||
|
|
||||||
|
def test_calculation(self):
|
||||||
|
text_fields = self.driver.find_elements_by_class_name('android.widget.EditText')
|
||||||
|
text_fields[0].send_keys(4)
|
||||||
|
text_fields[1].send_keys(6)
|
||||||
|
|
||||||
|
btn_calculate = self.driver.find_element_by_class_name('android.widget.Button')
|
||||||
|
btn_calculate.click()
|
||||||
|
|
||||||
|
self.assertEqual('10', text_fields[2].text)
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
self.driver.quit()
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
"""e2e test to test chrome application inside docker-android"""
|
||||||
|
from unittest import TestCase
|
||||||
|
|
||||||
|
from appium import webdriver
|
||||||
|
|
||||||
|
|
||||||
|
class TestE2EChrome(TestCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
desired_caps = {
|
||||||
|
'platformName': 'Android',
|
||||||
|
'deviceName': 'Android Emulator',
|
||||||
|
'appPackage': 'com.android.chrome',
|
||||||
|
'appActivity': 'com.google.android.apps.chrome.Main',
|
||||||
|
'browserName': 'chrome'
|
||||||
|
}
|
||||||
|
self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
|
||||||
|
|
||||||
|
def test_open_url(self):
|
||||||
|
self.driver.get('http://google.com')
|
||||||
|
|
||||||
|
# Handle Welcome Home
|
||||||
|
self.driver.switch_to.context('NATIVE_APP')
|
||||||
|
self.driver.find_element_by_id('terms_accept').click()
|
||||||
|
self.driver.find_element_by_id('negative_button').click()
|
||||||
|
|
||||||
|
# Search for Github
|
||||||
|
self.driver.switch_to.context('CHROMIUM')
|
||||||
|
search = self.driver.find_element_by_name('q')
|
||||||
|
search.send_keys('butomo1989 docker-android')
|
||||||
|
search.submit()
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
self.driver.quit()
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
"""Unit test for android virtual device creation.py."""
|
|
||||||
import os
|
|
||||||
from unittest import TestCase
|
|
||||||
|
|
||||||
import mock
|
|
||||||
|
|
||||||
from src import app
|
|
||||||
|
|
||||||
|
|
||||||
@mock.patch('subprocess.check_call')
|
|
||||||
@mock.patch('os.symlink')
|
|
||||||
class TestAvd(TestCase):
|
|
||||||
"""Unit test class to test method create_avd."""
|
|
||||||
|
|
||||||
def setUp(self):
|
|
||||||
self.avd_name = 'test_avd'
|
|
||||||
|
|
||||||
def test_nexus_avd_as_default(self, mocked_suprocess, mocked_sys_link):
|
|
||||||
with mock.patch('os.listdir') as mocked_list_dir:
|
|
||||||
mocked_list_dir.return_value = ['file1', 'file2']
|
|
||||||
self.assertFalse(mocked_list_dir.called)
|
|
||||||
self.assertFalse(mocked_sys_link.called)
|
|
||||||
self.assertFalse(mocked_suprocess.called)
|
|
||||||
app.prepare_avd('Nexus 5', self.avd_name)
|
|
||||||
self.assertTrue(mocked_list_dir.called)
|
|
||||||
self.assertTrue(mocked_sys_link.called)
|
|
||||||
self.assertTrue(mocked_suprocess.called)
|
|
||||||
|
|
||||||
def test_samsung_avd(self, mocked_suprocess, mocked_sys_link):
|
|
||||||
with mock.patch('os.listdir') as mocked_list_dir:
|
|
||||||
mocked_list_dir.return_value = ['file1', 'file2']
|
|
||||||
self.assertFalse(mocked_list_dir.called)
|
|
||||||
self.assertFalse(mocked_sys_link.called)
|
|
||||||
self.assertFalse(mocked_suprocess.called)
|
|
||||||
app.prepare_avd('Samsung Galaxy S6', self.avd_name)
|
|
||||||
self.assertTrue(mocked_list_dir.called)
|
|
||||||
self.assertTrue(mocked_sys_link.called)
|
|
||||||
self.assertTrue(mocked_suprocess.called)
|
|
||||||
|
|
||||||
def tearDown(self):
|
|
||||||
if os.getenv('DEVICE'):
|
|
||||||
del os.environ['DEVICE']
|
|
||||||
@@ -0,0 +1,108 @@
|
|||||||
|
"""Unit test to test app."""
|
||||||
|
import os
|
||||||
|
from unittest import TestCase
|
||||||
|
|
||||||
|
import mock
|
||||||
|
|
||||||
|
from src import app
|
||||||
|
|
||||||
|
|
||||||
|
class TestApp(TestCase):
|
||||||
|
"""Unit test class to test other methods in the app."""
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def test_symlink(self):
|
||||||
|
res = os.path.join('testFile1.txt')
|
||||||
|
dest = os.path.join('link_testFile1.txt')
|
||||||
|
open(res, 'a').close()
|
||||||
|
app.symlink_force(res, dest)
|
||||||
|
os.remove(res)
|
||||||
|
os.remove(dest)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def test_symlink_already_exist(self):
|
||||||
|
res = os.path.join('testFile1.txt')
|
||||||
|
dest = os.path.join('link_testFile1.txt')
|
||||||
|
open(res, 'a').close()
|
||||||
|
open(dest, 'a').close()
|
||||||
|
app.symlink_force(res, dest)
|
||||||
|
os.remove(res)
|
||||||
|
os.remove(dest)
|
||||||
|
|
||||||
|
def test_valid_env(self):
|
||||||
|
key = 'ENV_1'
|
||||||
|
os.environ[key] = 'test'
|
||||||
|
app.get_or_raise(key)
|
||||||
|
del os.environ[key]
|
||||||
|
|
||||||
|
def test_invalid_env(self):
|
||||||
|
with self.assertRaises(RuntimeError):
|
||||||
|
app.get_or_raise('ENV_2')
|
||||||
|
|
||||||
|
def test_valid_bool(self):
|
||||||
|
self.assertEqual(app.convert_str_to_bool('True'), True)
|
||||||
|
self.assertEqual(app.convert_str_to_bool('t'), True)
|
||||||
|
self.assertEqual(app.convert_str_to_bool('1'), True)
|
||||||
|
self.assertEqual(app.convert_str_to_bool('YES'), True)
|
||||||
|
|
||||||
|
def test_invalid_bool(self):
|
||||||
|
self.assertEqual(app.convert_str_to_bool(''), False)
|
||||||
|
self.assertEqual(app.convert_str_to_bool('test'), False)
|
||||||
|
|
||||||
|
def test_invalid_format(self):
|
||||||
|
self.assertEqual(app.convert_str_to_bool(True), None)
|
||||||
|
|
||||||
|
@mock.patch('src.app.prepare_avd')
|
||||||
|
@mock.patch('builtins.open')
|
||||||
|
@mock.patch('subprocess.Popen')
|
||||||
|
def test_run_with_appium(self, mocked_avd, mocked_open, mocked_subprocess):
|
||||||
|
with mock.patch('src.app.appium_run') as mocked_appium:
|
||||||
|
os.environ['APPIUM'] = str(True)
|
||||||
|
app.run()
|
||||||
|
self.assertTrue(mocked_avd.called)
|
||||||
|
self.assertTrue(mocked_open.called)
|
||||||
|
self.assertTrue(mocked_subprocess.called)
|
||||||
|
self.assertTrue(mocked_appium.called)
|
||||||
|
|
||||||
|
@mock.patch('src.app.prepare_avd')
|
||||||
|
@mock.patch('builtins.open')
|
||||||
|
@mock.patch('subprocess.Popen')
|
||||||
|
def test_run_with_appium_and_relaxed_security(self, mocked_avd, mocked_open, mocked_subprocess):
|
||||||
|
with mock.patch('src.app.appium_run') as mocked_appium:
|
||||||
|
os.environ['APPIUM'] = str(True)
|
||||||
|
os.environ['RELAXED_SECURITY'] = str(True)
|
||||||
|
app.run()
|
||||||
|
self.assertTrue(mocked_avd.called)
|
||||||
|
self.assertTrue(mocked_open.called)
|
||||||
|
self.assertTrue(mocked_subprocess.called)
|
||||||
|
self.assertTrue(mocked_appium.called)
|
||||||
|
|
||||||
|
@mock.patch('src.app.prepare_avd')
|
||||||
|
@mock.patch('builtins.open')
|
||||||
|
@mock.patch('subprocess.Popen')
|
||||||
|
def test_run_without_appium(self, mocked_avd, mocked_open, mocked_subprocess):
|
||||||
|
with mock.patch('src.app.appium_run') as mocked_appium:
|
||||||
|
os.environ['APPIUM'] = str(False)
|
||||||
|
app.run()
|
||||||
|
self.assertTrue(mocked_avd.called)
|
||||||
|
self.assertTrue(mocked_open.called)
|
||||||
|
self.assertTrue(mocked_subprocess.called)
|
||||||
|
self.assertFalse(mocked_appium.called)
|
||||||
|
|
||||||
|
@mock.patch('builtins.open')
|
||||||
|
@mock.patch('subprocess.Popen')
|
||||||
|
@mock.patch('os.path.exists', mock.MagicMock(return_value=False))
|
||||||
|
def test_run_first_run(self, mocked_open, mocked_subprocess):
|
||||||
|
with mock.patch('src.app.prepare_avd') as mocked_prepare_avd:
|
||||||
|
app.run()
|
||||||
|
self.assertFalse(app.is_initialized())
|
||||||
|
self.assertTrue(mocked_prepare_avd.called)
|
||||||
|
|
||||||
|
@mock.patch('builtins.open')
|
||||||
|
@mock.patch('subprocess.Popen')
|
||||||
|
@mock.patch('os.path.exists', mock.MagicMock(return_value=True))
|
||||||
|
def test_run_next_run(self, mocked_open, mocked_subprocess):
|
||||||
|
with mock.patch('src.app.prepare_avd') as mocked_prepare_avd:
|
||||||
|
app.run()
|
||||||
|
self.assertTrue(app.is_initialized())
|
||||||
|
self.assertFalse(mocked_prepare_avd.called)
|
||||||
@@ -14,6 +14,14 @@ class TestAppium(TestCase):
|
|||||||
os.environ['CONNECT_TO_GRID'] = str(True)
|
os.environ['CONNECT_TO_GRID'] = str(True)
|
||||||
self.avd_name = 'test_avd'
|
self.avd_name = 'test_avd'
|
||||||
|
|
||||||
|
@mock.patch('subprocess.check_call')
|
||||||
|
def test_chrome_driver(self, mocked_subprocess):
|
||||||
|
os.environ['CONNECT_TO_GRID'] = str(False)
|
||||||
|
os.environ['BROWSER'] = 'chrome'
|
||||||
|
self.assertFalse(mocked_subprocess.called)
|
||||||
|
app.appium_run(self.avd_name)
|
||||||
|
self.assertTrue(mocked_subprocess.called)
|
||||||
|
|
||||||
@mock.patch('subprocess.check_call')
|
@mock.patch('subprocess.check_call')
|
||||||
def test_without_selenium_grid(self, mocked_subprocess):
|
def test_without_selenium_grid(self, mocked_subprocess):
|
||||||
os.environ['CONNECT_TO_GRID'] = str(False)
|
os.environ['CONNECT_TO_GRID'] = str(False)
|
||||||
@@ -21,30 +29,36 @@ class TestAppium(TestCase):
|
|||||||
app.appium_run(self.avd_name)
|
app.appium_run(self.avd_name)
|
||||||
self.assertTrue(mocked_subprocess.called)
|
self.assertTrue(mocked_subprocess.called)
|
||||||
|
|
||||||
|
@mock.patch('os.popen')
|
||||||
@mock.patch('subprocess.check_call')
|
@mock.patch('subprocess.check_call')
|
||||||
def test_with_selenium_grid(self, mocked_subprocess):
|
def test_with_selenium_grid(self, mocked_os, mocked_subprocess):
|
||||||
with mock.patch('src.app.create_node_config') as mocked_config:
|
with mock.patch('src.app.create_node_config') as mocked_config:
|
||||||
self.assertFalse(mocked_config.called)
|
self.assertFalse(mocked_config.called)
|
||||||
|
self.assertFalse(mocked_os.called)
|
||||||
self.assertFalse(mocked_subprocess.called)
|
self.assertFalse(mocked_subprocess.called)
|
||||||
app.appium_run(self.avd_name)
|
app.appium_run(self.avd_name)
|
||||||
self.assertTrue(mocked_config.called)
|
self.assertTrue(mocked_config.called)
|
||||||
|
self.assertTrue(mocked_os.called)
|
||||||
self.assertTrue(mocked_subprocess.called)
|
self.assertTrue(mocked_subprocess.called)
|
||||||
|
|
||||||
|
@mock.patch('os.popen')
|
||||||
@mock.patch('subprocess.check_call')
|
@mock.patch('subprocess.check_call')
|
||||||
def test_invalid_integer(self, mocked_subprocess):
|
def test_invalid_integer(self, mocked_os, mocked_subprocess):
|
||||||
os.environ['APPIUM_PORT'] = 'test'
|
os.environ['APPIUM_PORT'] = 'test'
|
||||||
with mock.patch('src.app.create_node_config') as mocked_config:
|
with mock.patch('src.app.create_node_config') as mocked_config:
|
||||||
self.assertFalse(mocked_config.called)
|
self.assertFalse(mocked_config.called)
|
||||||
|
self.assertFalse(mocked_os.called)
|
||||||
self.assertFalse(mocked_subprocess.called)
|
self.assertFalse(mocked_subprocess.called)
|
||||||
app.appium_run(self.avd_name)
|
app.appium_run(self.avd_name)
|
||||||
self.assertFalse(mocked_config.called)
|
self.assertFalse(mocked_config.called)
|
||||||
|
self.assertTrue(mocked_os.called)
|
||||||
self.assertTrue(mocked_subprocess.called)
|
self.assertTrue(mocked_subprocess.called)
|
||||||
self.assertRaises(ValueError)
|
self.assertRaises(ValueError)
|
||||||
|
|
||||||
def test_config_creation(self):
|
def test_config_creation(self):
|
||||||
from src import CONFIG_FILE
|
from src import CONFIG_FILE
|
||||||
self.assertFalse(os.path.exists(CONFIG_FILE))
|
self.assertFalse(os.path.exists(CONFIG_FILE))
|
||||||
app.create_node_config('test', '127.0.0.1', 4723, '127.0.0.1', 4444)
|
app.create_node_config('test', 'android', '127.0.0.1', 4723, '127.0.0.1', 4444)
|
||||||
self.assertTrue(os.path.exists(CONFIG_FILE))
|
self.assertTrue(os.path.exists(CONFIG_FILE))
|
||||||
os.remove(CONFIG_FILE)
|
os.remove(CONFIG_FILE)
|
||||||
|
|
||||||
@@ -52,3 +66,5 @@ class TestAppium(TestCase):
|
|||||||
del os.environ['CONNECT_TO_GRID']
|
del os.environ['CONNECT_TO_GRID']
|
||||||
if os.getenv('APPIUM_PORT'):
|
if os.getenv('APPIUM_PORT'):
|
||||||
del os.environ['APPIUM_PORT']
|
del os.environ['APPIUM_PORT']
|
||||||
|
if os.getenv('BROWSER'):
|
||||||
|
del os.environ['BROWSER']
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
"""Unit test for android virtual device creation.py."""
|
||||||
|
import os
|
||||||
|
from unittest import TestCase
|
||||||
|
|
||||||
|
import mock
|
||||||
|
|
||||||
|
from src import app
|
||||||
|
|
||||||
|
|
||||||
|
@mock.patch('subprocess.check_call')
|
||||||
|
class TestAvd(TestCase):
|
||||||
|
"""Unit test class to test method create_avd."""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
self.avd_name = 'test_avd'
|
||||||
|
|
||||||
|
@mock.patch("builtins.open", create=True)
|
||||||
|
def test_nexus_avd_as_default(self, mocked_suprocess, mocked_open):
|
||||||
|
self.assertFalse(mocked_suprocess.called)
|
||||||
|
self.assertFalse(mocked_open.called)
|
||||||
|
app.prepare_avd('Nexus 5', self.avd_name)
|
||||||
|
self.assertTrue(mocked_suprocess.called)
|
||||||
|
self.assertTrue(mocked_open.called)
|
||||||
|
|
||||||
|
@mock.patch('os.symlink')
|
||||||
|
@mock.patch("builtins.open", create=True)
|
||||||
|
def test_samsung_avd(self, mocked_suprocess, mocked_sys_link, mocked_open):
|
||||||
|
self.assertFalse(mocked_sys_link.called)
|
||||||
|
self.assertFalse(mocked_suprocess.called)
|
||||||
|
self.assertFalse(mocked_open.called)
|
||||||
|
app.prepare_avd('Samsung Galaxy S6', self.avd_name)
|
||||||
|
self.assertTrue(mocked_sys_link.called)
|
||||||
|
self.assertTrue(mocked_suprocess.called)
|
||||||
|
self.assertTrue(mocked_open.called)
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
if os.getenv('DEVICE'):
|
||||||
|
del os.environ['DEVICE']
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
function wait_emulator_to_be_ready () {
|
||||||
|
boot_completed=false
|
||||||
|
while [ "$boot_completed" == false ]; do
|
||||||
|
status=$(adb wait-for-device shell getprop sys.boot_completed | tr -d '\r')
|
||||||
|
echo "Boot Status: $status"
|
||||||
|
|
||||||
|
if [ "$status" == "1" ]; then
|
||||||
|
boot_completed=true
|
||||||
|
else
|
||||||
|
sleep 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function change_language_if_needed() {
|
||||||
|
if [ ! -z "${LANGUAGE// }" ] && [ ! -z "${COUNTRY// }" ]; then
|
||||||
|
wait_emulator_to_be_ready
|
||||||
|
echo "Languge will be changed to ${LANGUAGE}-${COUNTRY}"
|
||||||
|
adb root && adb shell "setprop persist.sys.language $LANGUAGE; setprop persist.sys.country $COUNTRY; stop; start" && adb unroot
|
||||||
|
echo "Language is changed!"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function install_google_play () {
|
||||||
|
wait_emulator_to_be_ready
|
||||||
|
echo "Google Play Service will be installed"
|
||||||
|
adb install -r "/root/google_play_services.apk"
|
||||||
|
echo "Google Play Store will be installed"
|
||||||
|
adb install -r "/root/google_play_store.apk"
|
||||||
|
}
|
||||||
|
|
||||||
|
function disable_animation () {
|
||||||
|
# To improve performance
|
||||||
|
adb shell "settings put global window_animation_scale 0.0"
|
||||||
|
adb shell "settings put global transition_animation_scale 0.0"
|
||||||
|
adb shell "settings put global animator_duration_scale 0.0"
|
||||||
|
}
|
||||||
|
|
||||||
|
change_language_if_needed
|
||||||
|
sleep 1
|
||||||
|
install_google_play
|
||||||
|
disable_animation
|
||||||
@@ -2,33 +2,63 @@
|
|||||||
nodaemon=true
|
nodaemon=true
|
||||||
logfile=%(ENV_LOG_PATH)s/supervisord.log
|
logfile=%(ENV_LOG_PATH)s/supervisord.log
|
||||||
childlogdir=%(ENV_LOG_PATH)s
|
childlogdir=%(ENV_LOG_PATH)s
|
||||||
|
priority=1
|
||||||
|
|
||||||
[program:xvfb]
|
[program:xvfb]
|
||||||
command=/usr/bin/Xvfb %(ENV_DISPLAY)s -screen %(ENV_SCREEN)s %(ENV_SCREEN_WIDTH)sx%(ENV_SCREEN_HEIGHT)sx%(ENV_SCREEN_DEPTH)s
|
command=/usr/bin/Xvfb %(ENV_DISPLAY)s -screen %(ENV_SCREEN)s %(ENV_SCREEN_WIDTH)sx%(ENV_SCREEN_HEIGHT)sx%(ENV_SCREEN_DEPTH)s
|
||||||
stdout_logfile=%(ENV_LOG_PATH)s/xvfb.stdout.log
|
stdout_logfile=%(ENV_LOG_PATH)s/xvfb.stdout.log
|
||||||
stderr_logfile=%(ENV_LOG_PATH)s/xvfb.stderr.log
|
stderr_logfile=%(ENV_LOG_PATH)s/xvfb.stderr.log
|
||||||
|
priority=1
|
||||||
|
|
||||||
[program:openbox]
|
[program:openbox]
|
||||||
command=/usr/bin/openbox-session
|
command=/usr/bin/openbox-session
|
||||||
stdout_logfile=%(ENV_LOG_PATH)s/openbox.stdout.log
|
stdout_logfile=%(ENV_LOG_PATH)s/openbox.stdout.log
|
||||||
stderr_logfile=%(ENV_LOG_PATH)s/openbox.stderr.log
|
stderr_logfile=%(ENV_LOG_PATH)s/openbox.stderr.log
|
||||||
|
priority=2
|
||||||
|
|
||||||
[program:x11vnc]
|
[program:x11vnc]
|
||||||
command=/usr/bin/x11vnc -display %(ENV_DISPLAY)s -nopw -forever -shared
|
command=/usr/bin/x11vnc -display %(ENV_DISPLAY)s -nopw -forever -shared
|
||||||
stdout_logfile=%(ENV_LOG_PATH)s/x11vnc.stdout.log
|
stdout_logfile=%(ENV_LOG_PATH)s/x11vnc.stdout.log
|
||||||
stderr_logfile=%(ENV_LOG_PATH)s/x11vnc.stderr.log
|
stderr_logfile=%(ENV_LOG_PATH)s/x11vnc.stderr.log
|
||||||
|
priority=2
|
||||||
|
|
||||||
[program:novnc]
|
[program:novnc]
|
||||||
command=./noVNC/utils/launch.sh --vnc localhost:%(ENV_LOCAL_PORT)s --listen %(ENV_TARGET_PORT)s
|
command=./noVNC/utils/launch.sh --vnc localhost:%(ENV_LOCAL_PORT)s --listen %(ENV_TARGET_PORT)s
|
||||||
stdout_logfile=%(ENV_LOG_PATH)s/novnc.stdout.log
|
stdout_logfile=%(ENV_LOG_PATH)s/novnc.stdout.log
|
||||||
stderr_logfile=%(ENV_LOG_PATH)s/novnc.stderr.log
|
stderr_logfile=%(ENV_LOG_PATH)s/novnc.stderr.log
|
||||||
|
priority=2
|
||||||
|
|
||||||
[program:port-forward]
|
[program:port-forward]
|
||||||
command=./src/port_forward.sh
|
command=./src/port_forward.sh
|
||||||
autorestart=false
|
autorestart=false
|
||||||
|
priority=1
|
||||||
|
|
||||||
|
;startsecs to fix "not expected" error. see: https://github.com/Supervisor/supervisor/issues/212#issuecomment-47933372
|
||||||
|
[program:android-screen-mirror]
|
||||||
|
command=./src/asm.sh
|
||||||
|
autorestart=false
|
||||||
|
startsecs=0
|
||||||
|
stdout_logfile=%(ENV_LOG_PATH)s/android-screen-mirror.stdout.log
|
||||||
|
stderr_logfile=%(ENV_LOG_PATH)s/android-screen-mirror.stderr.log
|
||||||
|
priority=3
|
||||||
|
|
||||||
[program:docker-appium]
|
[program:docker-appium]
|
||||||
command=python3 -m src.app
|
command=./src/appium.sh
|
||||||
autorestart=false
|
autorestart=false
|
||||||
stdout_logfile=%(ENV_LOG_PATH)s/docker-android.stdout.log
|
stdout_logfile=%(ENV_LOG_PATH)s/docker-android.stdout.log
|
||||||
stderr_logfile=%(ENV_LOG_PATH)s/docker-android.stderr.log
|
stderr_logfile=%(ENV_LOG_PATH)s/docker-android.stderr.log
|
||||||
|
priority=4
|
||||||
|
|
||||||
|
[program:auto-recording]
|
||||||
|
command=./src/record.sh auto_record
|
||||||
|
autorestart=false
|
||||||
|
stdout_logfile=%(ENV_LOG_PATH)s/video-recording.stdout.log
|
||||||
|
stderr_logfile=%(ENV_LOG_PATH)s/video-recording.stderr.log
|
||||||
|
priority=4
|
||||||
|
|
||||||
|
[program:adb-utils]
|
||||||
|
command=./src/utils.sh
|
||||||
|
autorestart=false
|
||||||
|
stdout_logfile=%(ENV_LOG_PATH)s/adb-utils.stdout.log
|
||||||
|
stderr_logfile=%(ENV_LOG_PATH)s/adb-utils.stderr.log
|
||||||
|
priority=5
|
||||||
|
|||||||
@@ -5,10 +5,18 @@ if [ -z "$TRAVIS_TAG" ]; then
|
|||||||
echo "UNIT TEST ONLY"
|
echo "UNIT TEST ONLY"
|
||||||
bash release.sh test all all 0.1
|
bash release.sh test all all 0.1
|
||||||
else
|
else
|
||||||
echo "Log in to docker hub"
|
if [ ! -z "$ANDROID_VERSION" ]; then
|
||||||
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
|
echo "Log in to docker hub"
|
||||||
echo "[Version: $ANDROID_VERSION] RUN UNIT TEST, BUILD DOCKER IMAGES AND PUSH THOSE TO DOCKER HUB"
|
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
|
||||||
bash release.sh all $ANDROID_VERSION all $TRAVIS_TAG
|
echo "[Version: $ANDROID_VERSION] RUN UNIT TEST, BUILD DOCKER IMAGES AND PUSH THOSE TO DOCKER HUB"
|
||||||
|
bash release.sh all $ANDROID_VERSION $TRAVIS_TAG
|
||||||
|
elif [ ! -z "$REAL_DEVICE" ]; then
|
||||||
|
echo "[SUPPORT FOR REAL DEVICE: BUILD DOCKER IMAGES AND PUSH THOSE TO DOCKER HUB ]"
|
||||||
|
bash release_real.sh all $TRAVIS_TAG
|
||||||
|
elif [ ! -z "$GENYMOTION" ]; then
|
||||||
|
echo "[SUPPORT FOR GENYMOTION: BUILD DOCKER IMAGES AND PUSH THOSE TO DOCKER HUB ]"
|
||||||
|
bash release_genymotion.sh all $TRAVIS_TAG
|
||||||
|
fi
|
||||||
echo "Log out of docker hub"
|
echo "Log out of docker hub"
|
||||||
docker logout
|
docker logout
|
||||||
fi
|
fi
|
||||||
|
|||||||