Compare commits

...
123 Commits
Author SHA1 Message Date
butomo1989 4e5370b85b Cleaned up 2018-09-04 12:01:47 +02:00
butomo1989 da177442ce Cleaned up 2018-09-04 10:34:49 +02:00
butomo1989 e2800863e8 Deleted old badge 2018-09-03 12:05:23 +02:00
butomo1989 c4bd3dcf55 Updated version of Selenium Grid in examples 2018-09-03 10:28:58 +02:00
butomo1989 ac594d96e9 Updated base image 2018-09-03 10:04:48 +02:00
butomo1989 a49cc2950e Cleaned up 2018-08-30 13:46:14 +02:00
butomo1989 6b657dd13e Replaced the hard code 2018-08-30 13:36:53 +02:00
butomo1989 aa7a798f62 Connect to Genymotion emulator automatically 2018-08-30 13:35:03 +02:00
butomo1989 ccec2c5969 Using specific version of appium as base image because a release issue with it 2018-08-30 12:05:49 +02:00
butomo1989 e45bc0010f Enabled adb remotely 2018-08-29 13:02:44 +02:00
butomo1989 efd1f07e58 Fixed escape char 2018-08-27 14:32:33 +02:00
butomo1989 73418a8b4f Fixed escape char 2018-08-27 14:30:51 +02:00
Budi UtomoandGitHub ad444fd738 Merge pull request #116 from bonigarcia/master
Fix chromedriver version for Android 5.0.1
2018-08-27 09:48:28 +02:00
Boni Garcia 12391277e6 Fix chromedriver version for Android 5.0.1 2018-08-27 09:31:06 +02:00
Budi UtomoandGitHub c50f185c65 Merge pull request #115 from stazdx/master
Added documentation about Azure
2018-08-27 09:11:18 +02:00
stazdxandGitHub 62090f73b4 Merge pull request #1 from stazdx/azure-docs
Enable nested virtualization on Azure
2018-08-24 17:49:41 -05:00
stazdxandGitHub 7bce737447 Enable nested virtualization on Azure 2018-08-24 17:49:10 -05:00
butomo1989 f2c6ab79bb Enabled key pair 2018-08-24 16:14:04 +02:00
butomo1989 afcbd4a7e7 Merge branch 'master' into release-1.4 2018-08-21 16:45:54 +02:00
Budi UtomoandGitHub 9a714e5fb3 Merge pull request #111 from devilankur18/custom_args
Able to pass custom arguments to Emulator
2018-08-21 16:23:22 +02:00
Ankur Agarwal a6394bcf74 added support for custom arguments while running/creating emulator 2018-08-21 17:50:50 +05:30
butomo1989 43d0bb1292 Merge branch 'release-1.4' of github.com:butomo1989/docker-android into release-1.4 2018-08-21 09:49:41 +02:00
butomo1989 e56352bf74 Added provider id 2018-08-21 09:49:10 +02:00
Budi UtomoandGitHub 7746b0ce1a Merge pull request #112 from red-avtovo/appium_latest
Appium latest image
2018-08-21 08:55:25 +02:00
Aleksandr Bochev 806443e956 switched to base image latest appium 2018-08-20 17:38:53 +02:00
butomo1989 a5d0e6eba2 Always use the latest AMI image 2018-08-20 11:46:09 +02:00
butomo1989 ac9371a2ed Merge branch 'master' into release-1.4 2018-08-20 09:51:35 +02:00
Budi UtomoandGitHub f3abb0a828 Merge pull request #110 from devilankur18/emulator_backup_restore
AVD initialisation based on devices xml file
2018-08-16 18:04:20 +02:00
Ankur Agarwal c653efc7b1 fixes related to initialization 2018-08-16 12:36:51 +00:00
butomo1989 bcd7d9a29b Back to user mode 2018-08-14 09:14:25 +02:00
butomo1989 dd7ef41590 Added integration with Genymotion in AWS 2018-08-11 19:38:47 +02:00
butomo1989 d7c9730712 Fixed issue #90 2018-08-03 15:58:07 +02:00
butomo1989 735bc64a2d Cleaned up 2018-08-03 15:56:36 +02:00
butomo1989 307d6502af Fixed string 2018-08-02 12:52:31 +02:00
butomo1989 91a4e270c6 Refactored code 2018-08-02 11:42:19 +02:00
Budi UtomoandGitHub d13e60a122 Merge pull request #104 from devilankur18/master
Added device_id support via ENV variable or auto uuid values
2018-07-31 09:04:58 +02:00
Ankur AgarwalandGitHub c4be3a1ac0 Merge branch 'master' into master 2018-07-31 01:24:15 +05:30
Ankur AgarwalandGitHub 7c7eed4a3d Fixing trailing whitespaces 2018-07-31 01:17:01 +05:30
Budi UtomoandGitHub d0271e0be0 Merge pull request #103 from mehrdad-abdoli/master
Update Google Play Store app
2018-07-30 17:00:42 +02:00
App-Test 9d71ecded7 Update Google Play Services and some other useful stuff by adb 2018-07-30 16:30:19 +04:30
App-Test 81af88e7a4 Update Google Play Services and some other useful stuff by adb 2018-07-30 16:28:41 +04:30
App-Test a8f7fd2d02 Update Google Play Services and some other useful stuff by adb 2018-07-30 16:26:57 +04:30
App-Test de71e5156c Update Google Play Services and some other useful stuff by adb 2018-07-30 16:19:05 +04:30
Ankur AgarwalandGitHub bcf27f0489 Added logging 2018-07-28 23:20:06 +05:30
Ankur AgarwalandGitHub 972445a8bc Assign device_id via environment variable 2018-07-28 23:07:03 +05:30
App-Test 460e0b8daf Update Google Play Services and some other useful stuff by adb 2018-07-28 16:53:26 +04:30
Budi UtomoandGitHub 3673d195ea Updated Readme 2018-07-25 12:27:09 +02:00
Budi UtomoandGitHub 77c6ac8507 Updated Readme 2018-07-25 12:24:34 +02:00
Budi UtomoandGitHub cd35f4a3ab Merge pull request #100 from bonigarcia/master
Download proper version of chromedriver for each Android version
2018-07-25 12:20:11 +02:00
Boni Garcia 217df7cd65 Include browser name, browser version, and chromedriver version in Docker images table 2018-07-25 11:44:21 +02:00
Boni Garcia ccfdef4fe8 Set default chromedriver version 2018-07-24 17:18:41 +02:00
Boni Garcia b40ec48136 Download proper version of chromedriver 2018-07-24 15:59:11 +02:00
Budi UtomoandGitHub 064331de0e Merge pull request #97 from shadow1163/issue87
Once container start, add flag -wipe-data to command.
2018-07-20 08:01:40 +02:00
Budi UtomoandGitHub 5ef52ca622 Merge branch 'master' into issue87 2018-07-20 07:57:23 +02:00
junbo 15c51a4ab1 roll back is_initialized 2018-07-20 09:53:46 +08:00
Budi UtomoandGitHub 7e2b364c08 Merge pull request #96 from JoeSSS/patch-2
Add information about connecting to adb from outside the container in README
2018-07-19 13:02:04 +02:00
Serghei MoretandGitHub 0b18e4995c Update README.md 2018-07-19 12:41:04 +02:00
Serghei MoretandGitHub f0fb5ef009 Update README.md 2018-07-19 12:39:16 +02:00
Serghei MoretandGitHub ec0c381fb6 Update README.md 2018-07-19 12:38:24 +02:00
Serghei MoretandGitHub 58f7693024 Add adbkey part to README 2018-07-19 12:35:28 +02:00
junbo 40f6e67d83 fix issue 87 2018-07-19 18:11:59 +08:00
Budi UtomoandGitHub 852daa4e32 Merge pull request #92 from red-avtovo/mymaster
Initialise emulator just once
2018-07-10 19:10:49 +02:00
Aleksandr Bochev bf65a73eb1 removed time dependency 2018-07-10 18:45:29 +02:00
Aleksandr Bochev 3577d7e0a1 fixed emulator is unauthorized
performed avd creation just once
2018-07-10 18:34:53 +02:00
Budi UtomoandGitHub 1371744b36 Merge pull request #89 from JoeSSS/patch-1
Fix issue #86
2018-07-09 21:20:51 +02:00
Serghei MoretandGitHub cf3b1cf683 Fix adb getting into the loop 2018-07-09 18:06:58 +02:00
Budi UtomoandGitHub 416a88143f Updated README.md 2018-07-06 10:33:17 +02:00
butomo1989 55719bb638 Use Chrome driver version for Chrome that is inside Emulator 2018-07-05 22:40:41 +02:00
butomo1989 c22fe34e7c Updated README.md 2018-07-05 21:21:24 +02:00
butomo1989 69154410f2 Updated 2018-07-05 21:11:21 +02:00
butomo1989 4975ebcc47 Cleaned up 2018-07-05 21:06:00 +02:00
butomo1989 e4180a6e65 Passed chrome driver version through environment variable 2018-07-05 20:10:47 +02:00
butomo1989 e22b8f141e Removed arm image 2018-07-05 20:04:25 +02:00
butomo1989 7d29525b48 Build version 8.0 and 8.1 2018-07-05 19:56:14 +02:00
butomo1989 f47cc495b0 Merge branch 'release-1.1' of github.com:butomo1989/docker-android into release-1.1 2018-07-05 19:51:46 +02:00
butomo1989 bc516d5a8e Updated permission 2018-07-05 19:11:14 +02:00
Budi UtomoandGitHub b54fcd2087 Merge pull request #72 from greenerchen/patch-2
Build docker images with play store
2018-07-05 17:50:00 +02:00
Greener ChenandGitHub 7e7d12e4e8 Merge branch 'release-1.1' into patch-2 2018-07-05 23:34:22 +08:00
Budi UtomoandGitHub 8d9fc61158 Merge pull request #83 from bonigarcia/master
Use latest version of chromedriver
2018-07-05 17:01:19 +02:00
Budi UtomoandGitHub bc5635ed0a Merge pull request #81 from JoeSSS/JoeSSS-patch-1
Support for Android 8.0 and 8.1
2018-07-05 15:32:59 +02:00
Serghei MoretandGitHub 0b7ca97939 Merge branch 'release-1.1' into JoeSSS-patch-1 2018-07-05 15:28:54 +02:00
Budi UtomoandGitHub 7e0a2e4770 Merge pull request #85 from red-avtovo/sdk_installation_cleanup
cleaned sdk installation
2018-07-05 15:25:35 +02:00
Serghei Moret c82443e221 Update release.sh 2018-07-05 14:29:54 +02:00
Boni Garcia 1d7b7c2ac7 Improve script to download latest version of chromedriver automatically 2018-07-05 12:56:10 +02:00
Aleksandr Bochev 59f792f7c0 cleaned sdk installation 2018-07-05 12:23:13 +02:00
Boni Garcia 84ac59f66a Update chromedriver version to 2.40 2018-07-05 11:41:09 +02:00
Serghei MoretandGitHub d176e69cc1 Let default emulator pick the right kernel 2018-07-03 20:46:23 +02:00
Serghei MoretandGitHub 59f61e057e Update Emulator_x86 2018-07-03 20:44:13 +02:00
butomo1989 601d58c51f Changed apk path 2018-06-28 01:03:27 +02:00
butomo1989 ac33a1f687 Changed apk path 2018-06-28 00:47:49 +02:00
butomo1989 91ebdbf5ab Edited permission 2018-06-28 00:43:26 +02:00
butomo1989 c8fb92e400 Using adb version inside container 2018-06-26 22:53:34 +02:00
butomo1989 80a64e82dd Added demo how to use Genymotion cloud 2018-06-25 23:53:06 +02:00
butomo1989 780278b519 Edited README.md 2018-06-25 22:56:05 +02:00
butomo1989 b4544ae90f Cleaned up Dockerfile 2018-06-25 22:54:01 +02:00
butomo1989 0af1143e72 Deleted genymotion manual installation 2018-06-25 22:48:30 +02:00
butomo1989 48eb6bf9ae Edited README.md 2018-06-22 02:34:29 +02:00
butomo1989 f8940c79f5 Cleaned up 2018-06-22 02:32:01 +02:00
butomo1989 4b7d2aa125 Deleted unused parameter 2018-06-22 02:23:21 +02:00
butomo1989 d4832ad2b8 Fixed unit test 2018-06-22 01:37:54 +02:00
butomo1989 54d5365907 Cleaned up 2018-06-22 01:16:40 +02:00
butomo1989 2922e3ba92 Cleaned up 2018-06-22 00:34:43 +02:00
butomo1989 820b6e0e0e Enable debug modus for emulator 2018-06-21 21:16:54 +02:00
butomo1989 75514ef1f0 Updated README.md 2018-06-20 23:32:34 +02:00
butomo1989 ab34ca36d9 Enabled relaxed security 2018-06-20 23:30:54 +02:00
butomo1989 15f6541621 Fixed if-else logic 2018-06-20 23:28:41 +02:00
butomo1989 99c1b1f6b6 Using the latest base image 2018-06-20 21:10:59 +02:00
butomo1989 32258461be Enable to specify port 2018-06-19 01:20:15 +02:00
butomo1989 b7f332fd3b Added genymotion logo 2018-06-19 00:07:32 +02:00
butomo1989 09068f20c5 Formatted 2018-06-19 00:01:33 +02:00
butomo1989 59bf049159 Updated supported OS 2018-06-18 23:45:59 +02:00
butomo1989 d6b69863ca Cleaned up 2018-06-12 01:05:35 +02:00
butomo1989 68d0c2fc81 Cleaned up 2018-06-06 23:35:59 +02:00
butomo1989 5b89a28198 Renamed docker-image 2018-05-30 00:57:21 +02:00
butomo1989 705be0e3c9 Added auto-stop feature 2018-05-30 00:54:06 +02:00
butomo1989 b5f8c28fc1 Edited path 2018-05-30 00:51:16 +02:00
butomo1989 79f797213c Added integreation with geny cloud 2018-05-29 02:04:30 +02:00
butomo1989 424b6bb2ec Added script to revert a release 2018-05-29 00:09:28 +02:00
butomo1989 efccb144a4 Updated selenium hub 2018-05-29 00:08:14 +02:00
butomo1989 a960f34381 Updated base image 2018-05-28 21:02:26 +02:00
butomo1989 11e3428145 Added how to enable proxy inside container 2018-05-26 16:07:12 +02:00
Diego MolinaandGitHub 9d0c66fb2b Merge branch 'master' into patch-2 2018-04-09 11:38:33 +02:00
Greener Chen 2b02843cfd Build docker images with play store for emulators with x86 processor and API 24 or later version 2018-03-12 01:41:16 +08:00
33 changed files with 937 additions and 338 deletions
+1
View File
@@ -0,0 +1 @@
*.mp4 filter=lfs diff=lfs merge=lfs -text
-3
View File
@@ -7,6 +7,3 @@
coverage.xml
xunit.xml
coverage/*
# Video
video*
+2
View File
@@ -16,6 +16,8 @@ env:
- ANDROID_VERSION=6.0
- ANDROID_VERSION=7.0
- ANDROID_VERSION=7.1.1
- ANDROID_VERSION=8.0
- ANDROID_VERSION=8.1
- REAL_DEVICE=True
script: bash travis.sh
+47 -146
View File
@@ -4,7 +4,6 @@
[![Join the chat at https://gitter.im/butomo1989/docker-android](https://badges.gitter.im/butomo1989/docker-android.svg)](https://gitter.im/butomo1989/docker-android?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://travis-ci.org/butomo1989/docker-android.svg?branch=master)](https://travis-ci.org/butomo1989/docker-android)
[![Docker Pulls](https://img.shields.io/docker/pulls/butomo1989/docker-android-x86-7.1.1.svg?style=flat-square&style=plastic)](https://hub.docker.com/r/butomo1989/docker-android-x86-7.1.1/)
[![codecov](https://codecov.io/gh/butomo1989/docker-android/branch/master/graph/badge.svg)](https://codecov.io/gh/butomo1989/docker-android)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/3f000ffb97db45a59161814e1434c429)](https://www.codacy.com/app/butomo1989/docker-appium?utm_source=github.com&utm_medium=referral&utm_content=butomo1989/docker-appium&utm_campaign=Badge_Grade)
@@ -12,14 +11,14 @@ Docker-Android is a docker image built to be used for everything related to mobi
<p align="center">
<a href="https://youtu.be/pQdpjuYwvp8"><img src="./images/appiumconf2018.png" alt="Appium Conference 2018" width="600"></a>
</p>
</p>
Emulator - Samsung Device | Emulator - Nexus Device | Real Device
:---------------------------:|:---------------------------:|:---------------------------:
![][emulator samsung] |![][emulator nexus] |![][real device]
Purpose
-------
Purposes
--------
1. Run UI tests for mobile websites with [appium]
2. Build Android project and run unit tests with the latest build-tools
@@ -36,24 +35,23 @@ Advantages compare with other docker-android projects
4. Ability to control emulator from outside container by using adb connect
5. Support real devices with screen mirroring
6. Ability to record video during test execution for debugging
7. Open source with more features coming
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
---------------------
|Supported OS |Android version |API level |Image name |Image status |
|:---|:---|:---|:---|:---:|
|Linux|5.0.1|21|butomo1989/docker-android-x86-5.0.1|[![](https://images.microbadger.com/badges/image/butomo1989/docker-android-x86-5.0.1.svg)](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://images.microbadger.com/badges/image/butomo1989/docker-android-x86-5.1.1.svg)](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://images.microbadger.com/badges/image/butomo1989/docker-android-x86-6.0.svg)](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://images.microbadger.com/badges/image/butomo1989/docker-android-x86-7.0.svg)](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://images.microbadger.com/badges/image/butomo1989/docker-android-x86-7.1.1.svg)](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://images.microbadger.com/badges/image/butomo1989/docker-android-arm-5.0.1.svg)](https://microbadger.com/images/butomo1989/docker-android-arm-5.0.1 "Get your own image badge on microbadger.com")|
|OSX / Windows|5.1.1|22|butomo1989/docker-android-arm-5.1.1|[![](https://images.microbadger.com/badges/image/butomo1989/docker-android-arm-5.1.1.svg)](https://microbadger.com/images/butomo1989/docker-android-arm-5.1.1 "Get your own image badge on microbadger.com")|
|OSX / Windows|6.0|23|butomo1989/docker-android-arm-6.0|[![](https://images.microbadger.com/badges/image/butomo1989/docker-android-arm-6.0.svg)](https://microbadger.com/images/butomo1989/docker-android-arm-6.0 "Get your own image badge on microbadger.com")|
|OSX / Windows|7.0|24|butomo1989/docker-android-arm-7.0|[![](https://images.microbadger.com/badges/image/butomo1989/docker-android-arm-7.0.svg)](https://microbadger.com/images/butomo1989/docker-android-arm-7.0 "Get your own image badge on microbadger.com")|
|OSX / Windows|7.1.1|25|butomo1989/docker-android-arm-7.1.1|[![](https://images.microbadger.com/badges/image/butomo1989/docker-android-arm-7.1.1.svg)](https://microbadger.com/images/butomo1989/docker-android-arm-7.1.1 "Get your own image badge on microbadger.com")|
|All |-|-|butomo1989/docker-android-real-device|[![](https://images.microbadger.com/badges/image/butomo1989/docker-android-real-device.svg)](https://microbadger.com/images/butomo1989/docker-android-real-device "Get your own image badge on microbadger.com")|
|OS |Android |API |Browser |Browser version |Chromedriver |Image |Size |
|:---|:---|:---|:---|:---|:---|:---|:---|
|Linux|5.0.1|21|browser|37.0|2.21|butomo1989/docker-android-x86-5.0.1|[![](https://images.microbadger.com/badges/image/butomo1989/docker-android-x86-5.0.1.svg)](https://microbadger.com/images/butomo1989/docker-android-x86-5.0.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://images.microbadger.com/badges/image/butomo1989/docker-android-x86-5.1.1.svg)](https://microbadger.com/images/butomo1989/docker-android-x86-5.1.1 "Get your own image badge on microbadger.com")|
|Linux|6.0|23|browser|44.0|2.18|butomo1989/docker-android-x86-6.0|[![](https://images.microbadger.com/badges/image/butomo1989/docker-android-x86-6.0.svg)](https://microbadger.com/images/butomo1989/docker-android-x86-6.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://images.microbadger.com/badges/image/butomo1989/docker-android-x86-7.0.svg)](https://microbadger.com/images/butomo1989/docker-android-x86-7.0 "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://images.microbadger.com/badges/image/butomo1989/docker-android-x86-7.1.1.svg)](https://microbadger.com/images/butomo1989/docker-android-x86-7.1.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://images.microbadger.com/badges/image/butomo1989/docker-android-x86-8.0.svg)](https://microbadger.com/images/butomo1989/docker-android-x86-8.0 "Get your own image badge on microbadger.com")|
|Linux|8.1|27|chrome|61.0|2.33|butomo1989/docker-android-x86-8.1|[![](https://images.microbadger.com/badges/image/butomo1989/docker-android-x86-8.1.svg)](https://microbadger.com/images/butomo1989/docker-android-x86-8.1 "Get your own image badge on microbadger.com")|
|All |-|-|-|-|-|butomo1989/docker-android-real-device|[![](https://images.microbadger.com/badges/image/butomo1989/docker-android-real-device.svg)](https://microbadger.com/images/butomo1989/docker-android-real-device "Get your own image badge on microbadger.com")|
|Linux|All|All|All|All|All|butomo1989/docker-android-genymotion|[![](https://images.microbadger.com/badges/image/butomo1989/docker-android-genymotion.svg)](https://microbadger.com/images/butomo1989/docker-android-genymotion "Get your own image badge on microbadger.com")|
List of Devices
---------------
@@ -75,19 +73,16 @@ Docker is installed in your system.
Quick Start
-----------
1. Run docker-android
1. Run Docker-Android
- For ***Linux OS***, please use image name that contains "x86"
```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.
@@ -101,71 +96,32 @@ Quick Start
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***.
```bash
docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -p 4723:4723 -e DEVICE="Samsung Galaxy S6" -e APPIUM=True --name android-container butomo1989/docker-android-x86-7.1.1
```
### 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-7.1.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-7.1.1
```
### Video Recording
You can deactivate auto_record by changing the value to "False" in docker-compose file. e.g. change value to "False" in this [line].
### Docker-Compose
![][compose]
There is [example of compose file] to run complete selenium grid and docker-android container as nodes. [docker-compose] version [1.13.0] or higher is required to be able to execute that compose file.
```bash
docker-compose up -d
```
[This document](README_CUSTOM_CONFIG.md) contains custom configurations of Docker-Android that you might need, e.g. Proxy, Changing language on fly, etc.
Build Android project
---------------------
docker-android can be used for building Android project and executing its unit test. This following steps will illustrate how to build Android project:
Docker-Android can be used for building Android project and executing its unit test. This following steps will illustrate how to build Android project:
1. Clone [this sample test project](https://github.com/googlesamples/android-testing).
```bash
git clone git@github.com:googlesamples/android-testing.git
```
```bash
git clone git@github.com:googlesamples/android-testing.git
```
2. Build the project
```bash
docker run -it --rm -v $PWD/android-testing/ui/espresso/BasicSample:/root/tmp butomo1989/docker-android-x86-7.1.1 tmp/gradlew build
```
```bash
docker run -it --rm -v $PWD/android-testing/ui/espresso/BasicSample:/root/tmp butomo1989/docker-android-x86-8.1 tmp/gradlew build
```
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
------------------------------------------
@@ -216,77 +172,27 @@ SMS Simulation
![][sms]
How to use docker-android in VMWare or Parallels Desktop
---------------
The following instructions are used for OS X. You'll need [docker-machine-parallels](https://github.com/Parallels/docker-machine-parallels) to create a virtual machine (vm) with tiny core linux for running docker images. After that, you may start the vm you created for VMWare Fusion or Parallels Desktop and run a docker container inside this vm. If you're going to use the android docker of emulator with x86 processor, setup this vm for nested virtualization and kvm support before you run a docker container.
Google Play Services and Google Play Store
------------------------------------------
1. Install docker-machine-parallels via Homebrew:
```bash
$ brew install docker-machine-parallels
```
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.
2. Create a virtual machine for running docker images based on the virtual machine tool you use
VMWARE
------
Create a virtual machine of VMWare Fusion
```bash
$ docker-machine create --driver=vmwarefusion vmware-dev
```
This [document](README_VMWARE.md) shows you how to configure Virtual Machine on VMWARE to be able to run Docker-Android.
Create a virtual machine of Parallels Desktop
```bash
$ docker-machine create --driver=parallels prl-dev
```
Cloud
-----
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.
This [document](README_CLOUD.md) contains information about deploying Docker-Android on cloud services.
3. Setup the virtual machine for nested virtualization support
Genymotion
----------
Shutdown the vm by running the command below in the boot2docker vm before you setup it.
```bash
# shutdown -h now
```
![Genymotion](images/logo_genymotion.png)
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`.
[![Enable nested virtualization for VMWare Fusion](images/vmwarefusion_enable_nested_virtualization.png)]
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`.
[![Enable nested virtualization for Parallels Desktop](images/parallels_enable_nested_virtualization.png)]
4. Enable kvm inside virtual machine
Run as an account other than root to install kvm packages using tce-load.
```bash
# su docker
$ tce-load -wi kvm
```
Run as root to load kvm module after kvm packages install.
```bash
$ sudo modprobe kvm_intel
```
Check if the kvm device is loaded.
```bash
$ ls /dev/kvm
```
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
Let's run a docker image for an emulator with x86 processor.
```bash
docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -e DEVICE="Samsung Galaxy S6" --name android-container butomo1989/docker-android-x86-7.1.1
```
When the services inside this docker container are running, connect to http://10.211.55.3:6080/vnc.html (the IP we got when the docker machine was created) and login. The emulator with x86 processor should be running on screen.
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) for more detail.
Troubleshooting
---------------
@@ -306,11 +212,6 @@ Special Thanks
[emulator samsung]: <images/emulator_samsung_galaxy_s6.png>
[emulator nexus]: <images/emulator_nexus_5.png>
[real device]: <images/real_device.png>
[compose]: <images/compose.png>
[line]: <https://github.com/butomo1989/docker-android/blob/master/docker-compose.yml#L70>
[example of compose file]: <docker-compose.yml>
[docker-compose]: <https://docs.docker.com/compose/install/>
[1.13.0]: <https://github.com/docker/compose/releases/tag/1.13.0>
[adb_connection]: <images/adb_connection.png>
[sms]: <images/SMS.png>
[gian christanto]: <https://www.linkedin.com/in/gian-christanto-0b398b131/>
+54
View File
@@ -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>
+5
View File
@@ -0,0 +1,5 @@
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
+39
View File
@@ -0,0 +1,39 @@
Proxy
-----
You can enable proxy inside container by passing following environment variables:
- HTTP_PROXY="\<language>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>"
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`
+28
View File
@@ -0,0 +1,28 @@
Genymotion
----------
You can easily scale your Appium tests on Genymotion Android virtual devices in the cloud.
1. Using Genymotion Cloud
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=genycloud -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. Using Genymotion on AWS
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).
+71
View File
@@ -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`.
![Enable nested virtualization for VMWare Fusion](images/vmwarefusion_enable_nested_virtualization.png)
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`.
![Enable nested virtualization for Parallels Desktop](images/parallels_enable_nested_virtualization.png)
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.
+15 -15
View File
@@ -6,9 +6,9 @@ version: "2.2"
services:
# Selenium hub
selenium_hub:
image: selenium/hub:3.11.0-bismuth
image: selenium/hub:3.14.0-curium
ports:
- "4444:4444"
- 4444:4444
# There is a bug for using appium. Issue: https://github.com/butomo1989/docker-android/issues/73
# Real devices
@@ -24,10 +24,10 @@ services:
# - /dev/bus/usb:/dev/bus/usb
# - ~/.android:/root/.android
# environment:
# - CONNECT_TO_GRID=True
# - CONNECT_TO_GRID=true
# - APPIUM=true
# - SELENIUM_HOST=selenium_hub
# - AUTO_RECORD=True
# - AUTO_RECORD=true
# - BROWSER_NAME=chrome
# Using Appium Docker Android
@@ -42,7 +42,7 @@ services:
- ~/.android:/root/.android
- $PWD/example/sample_apk:/root/tmp
environment:
- CONNECT_TO_GRID=True
- CONNECT_TO_GRID=true
- SELENIUM_HOST=selenium_hub
# Enable it for msite testing
#- BROWSER_NAME=chrome
@@ -60,19 +60,19 @@ services:
- 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
- $PWD/example/sample_apk:/root/tmp/sample_apk
- ./video-nexus_7.1.1:/tmp/video
environment:
- DEVICE=Nexus 5
- CONNECT_TO_GRID=True
- CONNECT_TO_GRID=true
- APPIUM=true
- SELENIUM_HOST=selenium_hub
- AUTO_RECORD=True
- AUTO_RECORD=true
# Docker-Android for mobile website testing with chrome browser
# Chrome browser exists only for version 7.0 and 7.1.1
samsung_galaxy_web_7.1.1:
image: butomo1989/docker-android-x86-7.1.1
image: butomo1989/docker-android-x86-8.1
privileged: true
# Increase scale number if needed
scale: 1
@@ -85,11 +85,11 @@ services:
- ./video-samsung_7.1.1:/tmp/video
environment:
- DEVICE=Samsung Galaxy S6
- CONNECT_TO_GRID=True
- CONNECT_TO_GRID=true
- APPIUM=true
- SELENIUM_HOST=selenium_hub
- MOBILE_WEB_TEST=True
- AUTO_RECORD=True
- 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
@@ -107,8 +107,8 @@ services:
- ./video-samsung_5.1.1:/tmp/video
environment:
- DEVICE=Samsung Galaxy S6
- CONNECT_TO_GRID=True
- CONNECT_TO_GRID=true
- APPIUM=true
- SELENIUM_HOST=selenium_hub
- MOBILE_WEB_TEST=True
- AUTO_RECORD=True
- MOBILE_WEB_TEST=true
- AUTO_RECORD=true
+21 -14
View File
@@ -1,4 +1,4 @@
FROM appium/appium:1.8.0-p1
FROM appium/appium:1.9.0-p0
LABEL maintainer "Budi Utomo <budi.ut.1989@gmail.com>"
@@ -86,33 +86,40 @@ RUN wget -nv -O noVNC.zip "https://github.com/kanaka/noVNC/archive/${NOVNC_SHA}
ARG ANDROID_VERSION=5.0.1
ARG API_LEVEL=21
ARG PROCESSOR=x86
ARG SYS_IMG=x86_64
ARG SYS_IMG=x86
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
ENV ANDROID_VERSION=$ANDROID_VERSION \
API_LEVEL=$API_LEVEL \
PROCESSOR=$PROCESSOR \
SYS_IMG=$SYS_IMG \
IMG_TYPE=$IMG_TYPE \
BROWSER=$BROWSER
BROWSER=$BROWSER \
CHROME_DRIVER=$CHROME_DRIVER \
GOOGLE_PLAY_SERVICE=$GOOGLE_PLAY_SERVICE \
GOOGLE_PLAY_STORE=$GOOGLE_PLAY_STORE
ENV PATH ${PATH}:${ANDROID_HOME}/build-tools
RUN echo y | sdkmanager "platforms;android-${API_LEVEL}" && \
echo y | sdkmanager "system-images;android-${API_LEVEL};${IMG_TYPE};${SYS_IMG}" && \
echo y | sdkmanager "emulator"
RUN rm ${ANDROID_HOME}/tools/emulator \
&& ln -s ${ANDROID_HOME}/emulator/emulator64-${PROCESSOR} ${ANDROID_HOME}/tools/emulator
ENV LD_LIBRARY_PATH=$ANDROID_HOME/emulator/lib64:$ANDROID_HOME/emulator/lib64/qt/lib
RUN yes | sdkmanager --licenses && \
sdkmanager "platforms;android-${API_LEVEL}" "system-images;android-${API_LEVEL};${IMG_TYPE};${SYS_IMG}" "emulator"
#==============================================
# Download chrome driver v2.26
# to be able to use chrome browser in emulator
# Issue: https://github.com/butomo1989/docker-android/commit/6406504f944dae73d0a0c5d8e71a17a47dff9b33
# 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/2.26/chromedriver_linux64.zip" \
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
# These Configurations can be changed through -e
@@ -155,6 +162,6 @@ COPY supervisord.conf /root/
RUN chmod -R +x /root/src && chmod +x /root/supervisord.conf
HEALTHCHECK --interval=2s --timeout=40s --retries=1 \
CMD adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done'
CMD timeout 40 adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done'
CMD /usr/bin/supervisord --configuration supervisord.conf
+45 -53
View File
@@ -1,4 +1,4 @@
FROM appium/appium:1.8.0-p1
FROM appium/appium:1.9.0-p0
LABEL maintainer "Budi Utomo <budi.ut.1989@gmail.com>"
@@ -16,6 +16,13 @@ WORKDIR /root
# Process manager
# socat
# Port forwarder
# keychain
# ssh-key creator
#------------------
# Genymotion spec
#------------------
# bzip2
# File compression
#------------------
# NoVNC Packages
#------------------
@@ -38,9 +45,11 @@ WORKDIR /root
# Sed for JSON data
#==================
RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \
xterm \
xterm \
supervisor \
socat \
keychain \
bzip2 \
x11vnc \
openbox \
menu \
@@ -67,39 +76,7 @@ RUN wget -nv -O noVNC.zip "https://github.com/kanaka/noVNC/archive/${NOVNC_SHA}
&& rm websockify.zip \
&& ln noVNC/vnc_auto.html noVNC/index.html
#======================
# Install SDK packages
#======================
ARG ANDROID_VERSION=5.0.1
ARG API_LEVEL=21
ARG PROCESSOR=x86
ARG SYS_IMG=x86_64
ARG IMG_TYPE=google_apis
ARG BROWSER=android
ENV ANDROID_VERSION=$ANDROID_VERSION \
API_LEVEL=$API_LEVEL \
PROCESSOR=$PROCESSOR \
SYS_IMG=$SYS_IMG \
IMG_TYPE=$IMG_TYPE \
BROWSER=$BROWSER
ENV PATH ${PATH}:${ANDROID_HOME}/build-tools
RUN echo y | sdkmanager "platforms;android-${API_LEVEL}" && \
echo y | sdkmanager "system-images;android-${API_LEVEL};${IMG_TYPE};${SYS_IMG}" && \
echo y | sdkmanager "emulator"
RUN rm ${ANDROID_HOME}/tools/emulator \
&& ln -s ${ANDROID_HOME}/emulator/emulator64-${PROCESSOR} ${ANDROID_HOME}/tools/emulator
ENV LD_LIBRARY_PATH=$ANDROID_HOME/emulator/lib64:$ANDROID_HOME/emulator/lib64/qt/lib
#==============================================
# Download chrome driver v2.26
# to be able to use chrome browser in emulator
# Issue: https://github.com/butomo1989/docker-android/commit/6406504f944dae73d0a0c5d8e71a17a47dff9b33
#==============================================
RUN wget -nv -O chrome.zip "https://chromedriver.storage.googleapis.com/2.26/chromedriver_linux64.zip" \
&& unzip -x chrome.zip \
&& rm chrome.zip
#================================================
#================================================
# noVNC Default Configurations
# These Configurations can be changed through -e
#================================================
@@ -112,7 +89,32 @@ ENV DISPLAY=:0 \
TARGET_PORT=6080 \
TIMEOUT=1 \
VIDEO_PATH=/tmp/video \
LOG_PATH=/var/log/supervisor
LOG_PATH=/var/log/supervisor
#====================
# 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
@@ -121,26 +123,16 @@ ENV DISPLAY=:0 \
# Appium port
# 6080
# noVNC port
# 5554
# Emulator port
# 5555
# ADB connection port
#===============
EXPOSE 4723 6080 5554 5555
EXPOSE 4723 6080 5555
#======================
# Add Emulator Devices
#======================
COPY devices /root/devices
#===================
# Run docker-appium
#===================
#=======================
# Run docker-genymotion
#=======================
COPY src /root/src
COPY supervisord.conf /root/
RUN chmod -R +x /root/src && chmod +x /root/supervisord.conf
HEALTHCHECK --interval=2s --timeout=40s --retries=1 \
CMD adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done'
CMD /usr/bin/supervisord --configuration supervisord.conf
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"]
+3 -2
View File
@@ -1,4 +1,4 @@
FROM appium/appium:1.8.0-p1
FROM appium/appium:1.9.0-p0
LABEL maintainer "Budi Utomo <budi.ut.1989@gmail.com>"
@@ -85,7 +85,8 @@ ENV DISPLAY=:0 \
#=========================
# Set default variables
#=========================
ENV REAL_DEVICE=True
ENV APPIUM_LOG=$LOG_PATH/appium.log
ENV REAL_DEVICE=true
ENV BROWSER=android
#===============
+2
View File
@@ -0,0 +1,2 @@
#!/system/bin/sh
setprop persist.sys.usb.config adb
+43
View File
@@ -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
cloud:
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=genycloud
- 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
Binary file not shown.
+12
View File
@@ -0,0 +1,12 @@
[
{
"region": "eu-west-1",
"android_version": "6.0",
"instance": "t2.small"
},
{
"region": "eu-west-1",
"android_version": "8.0",
"instance": "t2.small"
}
]
+11
View File
@@ -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"
}
]
+3
View File
@@ -0,0 +1,3 @@
#!/bin/bash
(export USER=$USER && export PASS=$PASS && export LICENSE=$LICENSE && docker-compose -f geny.yml up -d)
+81
View File
@@ -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
+61
View File
@@ -0,0 +1,61 @@
#!/bin/bash
# This script is needed because of https://www.ctl.io/developers/blog/post/gracefully-stopping-docker-containers/
types=(genycloud 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
Binary file not shown.

After

Width:  |  Height:  |  Size: 441 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

+54 -80
View File
@@ -10,21 +10,15 @@ else
fi
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|all): " ANDROID_VERSION
else
ANDROID_VERSION=$2
fi
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
else
RELEASE=$4
RELEASE=$3
fi
declare -A list_of_levels=(
@@ -33,11 +27,20 @@ declare -A list_of_levels=(
[6.0]=23
[7.0]=24
[7.1.1]=25
[8.0]=26
[8.1]=27
)
declare -A list_of_processors=(
[arm]=armeabi-v7a
[x86]=x86_64
# The version of the Chrome browser installed on the Android emulator needs to be known beforehand
# in order to chose the proper version of chromedriver (see http://chromedriver.chromium.org/downloads)
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"
)
function get_android_versions() {
@@ -57,46 +60,22 @@ function get_android_versions() {
# If version cannot be found in the list
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
fi
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_processors
processor=x86
function test() {
# Prepare needed parameter to run tests
test_android_version=7.1.1
test_api_level=25
test_processor=x86
test_sys_img=x86_64
test_sys_img=$test_processor
test_img_type=google_apis
test_browser=chrome
test_image=test_img
@@ -152,54 +131,49 @@ function build() {
# Remove pyc files
find . -name "*.pyc" -exec rm -f {} \;
# Build docker image(s)
for p in "${processors[@]}"; do
if [ "$p" == "x86" ]; then
FILE_NAME=docker/Emulator_x86
else
FILE_NAME=docker/Emulator_arm
fi
# Build docker image
FILE_NAME=docker/Emulator_x86
for v in "${versions[@]}"; do
# Find image type and default web browser
if [ "$v" == "5.0.1" ] || [ "$v" == "5.1.1" ]; then
IMG_TYPE=default
BROWSER=browser
elif [ "$v" == "6.0" ]; then
# It is because there is no ARM EABI v7a System Image for 6.0
IMG_TYPE=google_apis
BROWSER=browser
else
IMG_TYPE=google_apis
BROWSER=chrome
fi
echo "[BUILD] IMAGE TYPE: $IMG_TYPE"
level=${list_of_levels[$v]}
echo "[BUILD] API Level: $level"
sys_img=${list_of_processors[$p]}
echo "[BUILD] System Image: $sys_img"
image_version="$IMAGE-$p-$v:$RELEASE"
image_latest="$IMAGE-$p-$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=$p --build-arg SYS_IMG=$sys_img --build-arg IMG_TYPE=$IMG_TYPE \
--build-arg BROWSER=$BROWSER -f $FILE_NAME .
docker tag $image_version $image_latest
done
for v in "${versions[@]}"; do
# Find image type and default web browser
if [ "$v" == "5.0.1" ] || [ "$v" == "5.1.1" ]; then
IMG_TYPE=default
BROWSER=browser
elif [ "$v" == "6.0" ]; then
# It is because there is no ARM EABI v7a System Image for 6.0
IMG_TYPE=google_apis
BROWSER=browser
else
#adb root cannot be run in IMG_TYPE=google_apis_playstore
IMG_TYPE=google_apis
BROWSER=chrome
fi
echo "[BUILD] IMAGE TYPE: $IMG_TYPE"
level=${list_of_levels[$v]}
echo "[BUILD] API Level: $level"
sys_img=$processor
echo "[BUILD] System Image: $sys_img"
chrome_driver="${chromedriver_versions[$v]}"
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 -f $FILE_NAME .
docker tag $image_version $image_latest
done
}
function push() {
# Push docker image(s)
for p in "${processors[@]}"; do
for v in "${versions[@]}"; do
image_version="$IMAGE-$p-$v:$RELEASE"
image_latest="$IMAGE-$p-$v:latest"
echo "[PUSH] Image name: $image_version and $image_latest"
docker push $image_version
docker push $image_latest
done
for v in "${versions[@]}"; do
image_version="$IMAGE-$processor-$v:$RELEASE"
image_latest="$IMAGE-$processor-$v:latest"
echo "[PUSH] Image name: $image_version and $image_latest"
docker push $image_version
docker push $image_latest
done
}
Regular → Executable
View File
+29
View File
@@ -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
+31 -9
View File
@@ -4,6 +4,7 @@ import json
import logging
import os
import subprocess
import uuid
from src import CHROME_DRIVER, CONFIG_FILE, ROOT
from src import log
@@ -49,6 +50,9 @@ def convert_str_to_bool(str: str) -> bool:
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_VERSION = get_or_raise('ANDROID_VERSION')
API_LEVEL = get_or_raise('API_LEVEL')
@@ -86,9 +90,10 @@ def prepare_avd(device: str, avd_name: str):
avd_path = '/'.join([ANDROID_HOME, 'android_emulator'])
creation_cmd = 'avdmanager create avd -f -n {name} -b {img_type}/{sys_img} -k "system-images;android-{api_lvl};' \
'{img_type};{sys_img}" -d {device} -p {path}'.format(name=avd_name, img_type=IMG_TYPE, sys_img=SYS_IMG,
api_lvl=API_LEVEL, device=device_name_bash,
path=avd_path)
'{img_type};{sys_img}" -d {device} -p {path}'.format(name=avd_name, img_type=IMG_TYPE,
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)
@@ -108,9 +113,13 @@ def appium_run(avd_name: str):
DEFAULT_LOG_PATH = '/var/log/supervisor/appium.log'
cmd = 'appium --log {log}'.format(log=os.getenv('APPIUM_LOG', DEFAULT_LOG_PATH))
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')
if default_web_browser == 'chrome':
cmd += ' --chromedriver-executable {driver}'.format(driver=CHROME_DRIVER)
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))
@@ -177,21 +186,34 @@ def run():
"""Run app."""
device = os.getenv('DEVICE', 'Nexus 5')
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)
logger.info('AVD name: {avd}'.format(avd=avd_name))
is_first_run = not is_initialized()
logger.info('Preparing emulator...')
prepare_avd(device, avd_name)
if is_first_run:
logger.info('Preparing emulator...')
prepare_avd(device, avd_name)
logger.info('Run emulator...')
cmd = 'emulator -avd {name} -gpu off'.format(name=avd_name)
subprocess.Popen(cmd.split())
dp_size = os.getenv('DATAPARTITION', '550m')
with open("/root/android_emulator/config.ini", "a") as cfg:
cfg.write('\ndisk.dataPartition.size={dp}'.format(dp=dp_size))
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:
subprocess.Popen(cmd.split())
logger.info('Run appium server...')
appium_run(avd_name)
else:
result = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE).communicate()
if __name__ == '__main__':
run()
+199 -9
View File
@@ -1,13 +1,203 @@
#!/bin/bash
if [ -z $REAL_DEVICE ]; then
python3 -m src.app
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')
echo $region
echo $android_version
echo $instance
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"
ingress {
from_port = 0
to_port = 65535
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
egress {
from_port = 0
to_port = 65535
protocol = "udp"
cidr_blocks = ["0.0.0.0/0"]
}
}
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 = "EK-\${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
((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 -oStrictHostKeyChecking=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
}
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"
prepare_geny_cloud
run_appium
;;
"${types[1]}" )
echo "Using Genymotion-AWS"
prepare_geny_aws
run_appium
;;
esac
else
CMD="appium"
if [ ! -z "$CONNECT_TO_GRID" ]; then
NODE_CONFIG_JSON="/root/src/nodeconfig.json"
/root/generate_config.sh $NODE_CONFIG_JSON
CMD+=" --nodeconfig $NODE_CONFIG_JSON"
fi
$CMD
echo "Using Emulator"
python3 -m src.app
fi
+4 -4
View File
@@ -16,12 +16,12 @@ function auto_record() {
echo "Auto record: $AUTO_RECORD"
sleep 6
while [ $AUTO_RECORD == "True" ]; do
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
if [ "$task" = "" ] || [ "$task" = "[]" ]; then
sleep .5
else
start &
@@ -30,9 +30,9 @@ function auto_record() {
done
# Check if test is finished
while [ $no_test == false ]; do
while [ $no_test = false ]; do
task=$(curl -s localhost:4723/wd/hub/sessions | jq -r '.value')
if [ "$task" == "" ] || [ "$task" == "[]" ]; then
if [ "$task" = "" ] || [ "$task" = "[]" ]; then
stop
no_test=true
else
+24 -2
View File
@@ -53,21 +53,43 @@ class TestApp(TestCase):
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_subprocess):
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_withhout_appium(self, mocked_avd, mocked_subprocess):
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)
Executable
+44
View File
@@ -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
+7
View File
@@ -55,3 +55,10 @@ 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
+1 -1
View File
@@ -9,7 +9,7 @@ else
echo "Log in to docker hub"
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
echo "[Version: $ANDROID_VERSION] RUN UNIT TEST, BUILD DOCKER IMAGES AND PUSH THOSE TO DOCKER HUB"
bash release.sh all $ANDROID_VERSION all $TRAVIS_TAG
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