Compare commits

...

20 commits

Author SHA1 Message Date
Scott Wallace fcb1f2ec31
Fix an issue when attempting to detect an existing AVD image
Fixes .
2021-05-05 10:04:46 +01:00
Budi Utomo 49113f2cb4
Added PayPal link for donation 2021-04-28 15:00:12 +02:00
Budi Utomo 0a8b7c07a2
Added step how to check kvm 2021-02-16 15:40:39 +01:00
butomo1989 49b9c44f3a Using Appium 1.20.2 2021-02-04 08:31:13 +01:00
butomo1989 15cddf08c4 Merge branch 'master' of github.com:butomo1989/docker-android 2021-02-03 16:55:06 +01:00
butomo1989 71949ee857 Using Appium 1.20.1 2021-02-03 16:54:51 +01:00
Budi Utomo d0e3c619ca
Merge pull request from iqalab-cloud/bug-fix-incorrect-max-session
Bug fix: maxSession in appium config should be 1
2021-01-13 13:07:30 +01:00
Zhaopeng XUAN 8dc87a3a3c Bug fix: maxSession in appium config should be 1 2021-01-13 12:39:36 +01:00
Budi Utomo 76617374c0
Merge pull request from iqalab-cloud/feature-support-selenium-proxy-class
Feature: Support customised Selenium Proxy Class when use Appium
2021-01-09 11:21:30 +01:00
Zhaopeng XUAN 70fc3b411c Fix the issue 2021-01-08 12:05:34 +01:00
Zhaopeng XUAN 5e7ce8ce66 Feature: Support Selenium Proxy Class when use Appium 2021-01-08 11:44:56 +01:00
butomo1989 1d7121c41b Merge branch 'master' of github.com:butomo1989/docker-android 2021-01-08 08:34:25 +01:00
butomo1989 0a1758091f Updated base image 2021-01-08 08:34:06 +01:00
Budi Utomo eb045aa644
Merge pull request from jnvillar/patch-1
Update README_VMWARE.md
2021-01-07 10:42:00 +01:00
Juan Ignacio Noli Villar e5a9fe7031
Update README_VMWARE.md 2020-12-17 10:49:08 -03:00
butomo1989 fdb464781a Added monitoring section 2020-09-02 11:33:07 +02:00
Budi Utomo 2e5237ec80
Merge pull request from yintro4ha/master
Able to add proxy user and password on Android emulator
2020-08-27 12:56:15 +02:00
yintro4ha b1f9ec5e79
Merge pull request from yintro4ha/add-proxy-auth
Update utils.sh
2020-08-24 15:14:00 +08:00
yintro4ha 1ac4a6484e
Update README_CUSTOM_CONFIG.md
Add document for new proxy auth variable
2020-08-24 15:10:03 +08:00
yintro4ha f09e38c92c
Update utils.sh
Add Variable: 
1. HTTP_PROXY_USER
2. HTTP_PROXY_PASSWORD
2020-08-24 15:05:22 +08:00
10 changed files with 57 additions and 14 deletions

View file

@ -9,6 +9,7 @@
[![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) [![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)
[![GitHub release](https://img.shields.io/github/release/budtmo/docker-android.svg)](https://github.com/budtmo/docker-android/releases) [![GitHub release](https://img.shields.io/github/release/budtmo/docker-android.svg)](https://github.com/budtmo/docker-android/releases)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fbudtmo%2Fdocker-android.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fbudtmo%2Fdocker-android?ref=badge_shield) [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fbudtmo%2Fdocker-android.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fbudtmo%2Fdocker-android?ref=badge_shield)
[![Paypal Donate](https://img.shields.io/badge/paypal-donate-blue.svg)](http://paypal.me/budtmo)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
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.
@ -81,7 +82,14 @@ Docker is installed in your system.
Quick Start Quick Start
----------- -----------
1. Run Docker-Android 1. Your machine need to support virtualization. To check it:
```
sudo apt install cpu-checker
kvm-ok
```
2. Run Docker-Android
- For ***Linux OS***, please use image name that contains "x86" - For ***Linux OS***, please use image name that contains "x86"
@ -92,7 +100,7 @@ Quick Start
- For ***OSX*** and ***Windows OS***, please use Virtual Machine that support Virtualization with Ubuntu OS - For ***OSX*** and ***Windows OS***, please use Virtual Machine that support Virtualization with Ubuntu OS
2. Verify the ip address of docker host. 3. Verify the ip address of docker host.
- For OSX, you can find out by using following command: - For OSX, you can find out by using following command:
@ -102,7 +110,7 @@ Quick Start
- For different OS, localhost should work. - For different OS, localhost should work.
3. Open ***http://docker-host-ip-address:6080*** from web browser. Note: Adding ```?view_only=true``` will give user only view only permission. 4. Open ***http://docker-host-ip-address:6080*** from web browser. Note: Adding ```?view_only=true``` will give user only view only permission.
Custom configurations Custom configurations
--------------------- ---------------------
@ -251,6 +259,10 @@ Security
-------- --------
All docker images are protected by [Polyverse](https://polyverse.io/) by scrambling the Linux packages. For more information please visit [this link](https://youtu.be/eSZNP42n-pM) All docker images are protected by [Polyverse](https://polyverse.io/) by scrambling the Linux packages. For more information please visit [this link](https://youtu.be/eSZNP42n-pM)
Monitoring
----------
You can use [cadvisor](https://github.com/google/cadvisor) combined with influxdb / prometheus and grafana if needed to monitor each running container.
Users Users
----- -----
Docker-Android are being used by 100+ countries around the world. Docker-Android are being used by 100+ countries around the world.

View file

@ -25,6 +25,7 @@ It is also possible to connect appium server that run inside docker-android with
- SELENIUM_HOST="\<host\_ip\_address>" - SELENIUM_HOST="\<host\_ip\_address>"
- SELENIUM_PORT=\<port\_number> - SELENIUM_PORT=\<port\_number>
- SELENIUM_TIMEOUT=\<timeout\_in\_seconds> - SELENIUM_TIMEOUT=\<timeout\_in\_seconds>
- SELENIUM_PROXY_CLASS=\<selenium\_proxy\_class\_name>
To run tests for mobile browser, following parameter can be passed: To run tests for mobile browser, following parameter can be passed:

View file

@ -13,6 +13,15 @@ You can enable proxy inside container and Android emulator by passing following
- NO_PROXY="localhost" - NO_PROXY="localhost"
- ENABLE_PROXY_ON_EMULATOR=true - ENABLE_PROXY_ON_EMULATOR=true
Proxy with authentication
----
You can set proxy with authentication by passing following environment variable:
- HTTP_PROXY_USER="\<username>"
- HTTPS_PROXY_PASSWORD="\<password>"
Language Language
-------- --------

View file

@ -38,10 +38,19 @@ The following instructions are used for OS X. You'll need [docker-machine-parall
![Enable nested virtualization for Parallels Desktop](images/parallels_enable_nested_virtualization.png) ![Enable nested virtualization for Parallels Desktop](images/parallels_enable_nested_virtualization.png)
4. Enable kvm inside virtual machine 4. Enable kvm inside virtual machine
4.0 Check kvm version
```bash
# version
$ 10.1
```
Go to http://tinycorelinux.net/10.x/x86_64/tcz/ and check your kvm version, for version 10.1 is kvm-4.19.10-tinycore64.tcz
4.1. Run as an account other than root to install kvm packages using tce-load. 4.1. Run as an account other than root to install kvm packages using tce-load.
```bash ```bash
# su docker # su docker
$ tce-load -wi kvm $ tce-load -wi kvm-4.19.10-tinycore64.tcz
``` ```
4.2. Run as root to load kvm module after kvm packages install. 4.2. Run as root to load kvm module after kvm packages install.

View file

@ -1,4 +1,4 @@
FROM appium/appium:1.18.0-p0 FROM appium/appium:1.20.2-p0
LABEL maintainer "Budi Utomo <budtmo.os@gmail.com>" LABEL maintainer "Budi Utomo <budtmo.os@gmail.com>"

View file

@ -1,4 +1,4 @@
FROM appium/appium:1.18.0-p0 FROM appium/appium:1.20.2-p0
LABEL maintainer "Budi Utomo <budtmo.os@gmail.com>" LABEL maintainer "Budi Utomo <budtmo.os@gmail.com>"

View file

@ -1,4 +1,4 @@
FROM appium/appium:1.18.0-p0 FROM appium/appium:1.20.2-p0
LABEL maintainer "Budi Utomo <budtmo.os@gmail.com>" LABEL maintainer "Budi Utomo <budtmo.os@gmail.com>"

View file

@ -56,7 +56,7 @@ def is_initialized(device_name) -> bool:
if os.path.exists(config_path): if os.path.exists(config_path):
logger.info('Found existing config file at {}.'.format(config_path)) logger.info('Found existing config file at {}.'.format(config_path))
with open(config_path, 'r') as f: with open(config_path, 'r') as f:
if any('hw.device.name={}'.format(device_name) in line for line in f): if any('hw.device.name = {}'.format(device_name) in line for line in f):
logger.info('Existing config file references {}. Assuming device was previously initialized.'.format(device_name)) logger.info('Existing config file references {}. Assuming device was previously initialized.'.format(device_name))
return True return True
else: else:
@ -149,9 +149,10 @@ def appium_run(avd_name: str):
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))
selenium_timeout = int(os.getenv('SELENIUM_TIMEOUT', 30)) selenium_timeout = int(os.getenv('SELENIUM_TIMEOUT', 30))
selenium_proxy_class = os.getenv('SELENIUM_PROXY_CLASS', 'org.openqa.grid.selenium.proxy.DefaultRemoteProxy')
browser_name = default_web_browser if mobile_web_test else 'android' 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, create_node_config(avd_name, browser_name, appium_host, appium_port, selenium_host, selenium_port,
selenium_timeout) selenium_timeout, selenium_proxy_class)
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)
@ -160,7 +161,7 @@ def appium_run(avd_name: str):
def create_node_config(avd_name: str, browser_name: str, appium_host: str, appium_port: int, selenium_host: str, def create_node_config(avd_name: str, browser_name: str, appium_host: str, appium_port: int, selenium_host: str,
selenium_port: int, selenium_timeout: int): selenium_port: int, selenium_timeout: int, selenium_proxy_class: str):
""" """
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.
@ -170,6 +171,7 @@ def create_node_config(avd_name: str, browser_name: str, appium_host: str, appiu
:param selenium_host: Host where selenium server is running :param selenium_host: Host where selenium server is running
:param selenium_port: Port number where selenium server is running :param selenium_port: Port number where selenium server is running
:param selenium_timeout: Selenium session timeout in seconds :param selenium_timeout: Selenium session timeout in seconds
:param selenium_proxy_class: Selenium Proxy class created in Selenium hub
""" """
config = { config = {
'capabilities': [ 'capabilities': [
@ -185,11 +187,11 @@ def create_node_config(avd_name: str, browser_name: str, appium_host: str, appiu
'configuration': { 'configuration': {
'cleanUpCycle': 2000, 'cleanUpCycle': 2000,
'timeout': selenium_timeout, 'timeout': selenium_timeout,
'proxy': 'org.openqa.grid.selenium.proxy.DefaultRemoteProxy', 'proxy': selenium_proxy_class,
'url': 'http://{host}:{port}/wd/hub'.format(host=appium_host, port=appium_port), 'url': 'http://{host}:{port}/wd/hub'.format(host=appium_host, port=appium_port),
'host': appium_host, 'host': appium_host,
'port': appium_port, 'port': appium_port,
'maxSession': 6, 'maxSession': 1,
'register': True, 'register': True,
'registerCycle': 5000, 'registerCycle': 5000,
'hubHost': selenium_host, 'hubHost': selenium_host,

View file

@ -58,7 +58,8 @@ class TestAppium(TestCase):
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', 'android', '127.0.0.1', 4723, '127.0.0.1', 4444, 30) app.create_node_config('test', 'android', '127.0.0.1', 4723, '127.0.0.1', 4444, 30,
'org.openqa.grid.selenium.proxy.DefaultRemoteProxy')
self.assertTrue(os.path.exists(CONFIG_FILE)) self.assertTrue(os.path.exists(CONFIG_FILE))
os.remove(CONFIG_FILE) os.remove(CONFIG_FILE)

View file

@ -52,7 +52,16 @@ function enable_proxy_if_needed () {
adb shell "content update --uri content://telephony/carriers --bind proxy:s:"0.0.0.0" --bind port:s:"0000" --where "mcc=310" --where "mnc=260"" adb shell "content update --uri content://telephony/carriers --bind proxy:s:"0.0.0.0" --bind port:s:"0000" --where "mcc=310" --where "mnc=260""
sleep 5 sleep 5
adb shell "content update --uri content://telephony/carriers --bind proxy:s:"${p[0]}" --bind port:s:"${p[1]}" --where "mcc=310" --where "mnc=260"" adb shell "content update --uri content://telephony/carriers --bind proxy:s:"${p[0]}" --bind port:s:"${p[1]}" --where "mcc=310" --where "mnc=260""
if [ ! -z "${HTTP_PROXY_USER}" ]; then
sleep 2
adb shell "content update --uri content://telephony/carriers --bind user:s:"${HTTP_PROXY_USER}" --where "mcc=310" --where "mnc=260""
fi
if [ ! -z "${HTTP_PROXY_PASSWORD}" ]; then
sleep 2
adb shell "content update --uri content://telephony/carriers --bind password:s:"${HTTP_PROXY_PASSWORD}" --where "mcc=310" --where "mnc=260""
fi
adb unroot adb unroot
# Mobile data need to be restarted for Android 10 or higher # Mobile data need to be restarted for Android 10 or higher