Compare commits

...
22 Commits
Author SHA1 Message Date
butomo1989 cde35287c7 Using the latest base image 2018-05-12 13:13:21 +02:00
butomo1989 29898ba91e Fixed issue #52 2018-05-11 00:43:16 +02:00
butomo1989 2d25517bfa Using the latest version of docker-appium 2018-04-29 20:06:17 +02:00
Budi UtomoandGitHub e3219ac24b Changed order 2018-04-23 19:25:24 +02:00
Budi UtomoandGitHub c4fb6243c5 Fixed tag 2018-04-23 19:23:54 +02:00
Budi UtomoandGitHub d021fd69e6 Added video conference 2018-04-23 19:22:10 +02:00
butomo1989 cacfe568a2 Added video image 2018-04-23 21:17:41 +02:00
butomo1989 cb100330ad Using appium-docker-android docker image for executing Appium UI-Test 2018-03-21 19:08:48 +01:00
butomo1989 bc0972318f Using the latest version of docker-selenium 2018-03-21 12:29:54 +01:00
Budi UtomoandGitHub 3a88fa4ae4 Merge pull request #71 from greenerchen/patch-1
Add instructions for VMWare or Parallels Desktop
2018-03-05 13:44:18 +01:00
Greener Chen 398a694ccd Add supplementary images 2018-03-05 18:37:19 +08:00
Greener ChenandGitHub 14a29344b8 Add instructions for VMWare or Parallels Desktop 2018-03-05 18:28:07 +08:00
butomo1989 47621a7ccb Added sample how to build Android project 2018-02-17 10:00:03 +01:00
butomo1989 c1d66496fb Added GitHub templates 2018-02-17 09:59:09 +01:00
Budi UtomoandGitHub 1365ec736b Replaced code line 2018-02-13 11:18:50 +01:00
butomo1989 4aee17de2d Deleted unused image 2018-02-12 18:47:02 +01:00
butomo1989 5c9ad32522 Automated some steps in screen mirroring for real device 2018-02-12 18:09:14 +01:00
butomo1989 366aa8b3b3 Added real device configuration in docker-compose 2018-02-12 11:07:37 +01:00
butomo1989 905f2c723b Using the latest base image 2018-02-12 10:49:26 +01:00
Budi UtomoandGitHub 0e028d9a4a Updated version of docker-selenium hub 2018-02-06 20:33:24 +01:00
butomo1989 ce61b992f9 Using the newest version of base image 2018-01-29 16:57:46 +01:00
butomo1989 e62573036c Added dockerandroid logo 2017-11-23 21:03:12 +01:00
20 changed files with 198 additions and 24 deletions
+22
View File
@@ -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 -->
+12
View File
@@ -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. -->
+109 -10
View File
@@ -1,16 +1,22 @@
Docker-Android
==============
<p align="center">
<img id="header" src="./images/logo_dockerandroid_small.png" />
</p>
[![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&amp;utm_medium=referral&amp;utm_content=butomo1989/docker-appium&amp;utm_campaign=Badge_Grade)
Docker-Android is a docker image built to be used for everything related to mobile website testing and Android project.
Samsung Device | Google Device
:---------------------------:|:---------------------------:
![][docker android samsung] | ![][docker android nexus]
<p align="center">
<a href="https://youtu.be/pQdpjuYwvp8"><img src="./images/appiumconf2018.png" alt="Appium Conference 2018" width="600"></a>
</p>
Emulator - Samsung Device | Emulator - Nexus Device | Real Device
:---------------------------:|:---------------------------:|:---------------------------:
![][emulator samsung] |![][emulator nexus] |![][real device]
Purpose
-------
@@ -137,7 +143,6 @@ You can deactivate auto_record by changing the value to "False" in docker-compos
### Docker-Compose
![][compose]
![][connected_devices]
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.
@@ -145,6 +150,23 @@ There is [example of compose file] to run complete selenium grid and docker-andr
docker-compose up -d
```
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
```
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
```
Control android emulator outside container
------------------------------------------
@@ -194,6 +216,78 @@ 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.
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
Create a virtual machine of VMWare Fusion
```bash
$ docker-machine create --driver=vmwarefusion vmware-dev
```
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
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
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.
Troubleshooting
---------------
All logs inside container are stored under folder **/var/log/supervisor**. you can print out log file by using **docker exec**. Example:
@@ -202,16 +296,21 @@ 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
```
Special Thanks
--------------
- [Gian Christanto] for creating a great logo!
[appium]: <https://appium.io>
[espresso]: <https://google.github.io/android-testing-support-library/docs/espresso/>
[robotium]: <https://github.com/RobotiumTech/robotium>
[docker android samsung]: <images/docker_android_samsung.png>
[docker android nexus]: <images/docker_android_nexus.png>
[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>
[connected_devices]: <images/connected_devices.png>
[line]: <https://github.com/butomo1989/docker-android/blob/master/docker-compose.yml#L30>
[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/>
+47 -1
View File
@@ -6,16 +6,56 @@ version: "2.2"
services:
# Selenium hub
selenium_hub:
image: selenium/hub:3.4.0
image: selenium/hub:3.11.0-bismuth
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"
@@ -36,6 +76,9 @@ services:
privileged: true
# Increase scale number if needed
scale: 1
depends_on:
- selenium_hub
- real_device
ports:
- 6080
volumes:
@@ -55,6 +98,9 @@ services:
privileged: true
# Increase scale number if needed
scale: 1
depends_on:
- selenium_hub
- real_device
ports:
- 6080
volumes:
+1 -1
View File
@@ -1,4 +1,4 @@
FROM appium/appium:1.7.1-p1
FROM appium/appium:1.8.0-p1
LABEL maintainer "Budi Utomo <budi.ut.1989@gmail.com>"
+1 -1
View File
@@ -1,4 +1,4 @@
FROM appium/appium:1.7.1-p1
FROM appium/appium:1.8.0-p1
LABEL maintainer "Budi Utomo <budi.ut.1989@gmail.com>"
+4 -10
View File
@@ -1,4 +1,4 @@
FROM appium/appium:1.7.1-p1
FROM appium/appium:1.8.0-p1
LABEL maintainer "Budi Utomo <budi.ut.1989@gmail.com>"
@@ -38,7 +38,7 @@ WORKDIR /root
# Sed for JSON data
#==================
RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \
xterm \
xterm \
supervisor \
socat \
x11vnc \
@@ -67,14 +67,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
#==============================================
# Download Adb remote screen
#==============================================
RUN wget -nv -O asm.zip "http://adakoda.github.io/android-screen-monitor/download/3.0.0/ASM_3_00.zip" \
&& unzip asm.zip \
&& rm asm.zip
#================================================
#================================================
# noVNC Default Configurations
# These Configurations can be changed through -e
#================================================
@@ -110,6 +103,7 @@ 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
Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 KiB

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 607 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 244 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 KiB

Executable
BIN
View File
Binary file not shown.
+2 -1
View File
@@ -105,7 +105,8 @@ def appium_run(avd_name: str):
: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))
default_web_browser = os.getenv('BROWSER')
if default_web_browser == 'chrome':