Coder Social home page Coder Social logo

docker-appium's Introduction

docker-appium

Docker image to run your appium test against a defined Android emulador and SDK

Based on vbanthia's idea but parametrized and based on Docker Ubuntu 14.04.

I really appreciate Pablo M. Sobrado's contributions because, without him, this project wouldn't exist.

Table of Contents

Prerequisites

This docker image is designed to run on Linux systems, may not work on Windows. You will need at least 25GB per build.

Build instructions

You can build your Docker image running the Dockerfile with the following command:

$ docker build -t agomezmoron/docker-appium . && docker rmi -f $(docker images -f "dangling=true" -q) &> /dev/null

or pulling it from docker:

$ docker pull agomezmoron/docker-appium

Optional arguments

You can specify the Java and Appium version, the Android SDK or the VNC password to use with the following variables (the values used are the default ones):

JAVA_VERSION=8
ANDROID_SDK_VERSION=23
VNC_PASSWD=1234
APPIUM_VERSION=1.5.2

Usage:

$ docker build --build-arg JAVA_VERSION=8 --build-arg ANDROID_SDK_VERSION=23 --build-arg VNC_PASSWD=1234 -t agomezmoron/docker-appium . && docker rmi -f $(docker images -f "dangling=true" -q) &> /dev/null

Possible inputs

Java:

  • 6
  • 7
  • 8

Android SDK:

  • 19
  • 20
  • 21
  • 22
  • 23
  • 24

Notes

The second part of the command, '&& docker rmi -f $(docker images -f "dangling=true" -q) &> /dev/null', is an optional one that deletes past images of the builds so the PC does not end up with several duplicated images. It can be removed without affecting the build.

Run instructions

Run the image with the following command:

$ docker run --privileged -v /YOUR/SOURCES/FOLDER:/src -v /YOUR/TARGET/FOLDER:/src/target -e HOST_UID=$(id -u) -e HOST_GID=$(id -g) -e DOCKER_TESTS_COMMAND="YOUR_MAVEN_COMMAND" --rm -t -i -p 5900:5900 agomezmoron/docker-appium

Mandatory arguments

Please note that you WILL have to specify your sources folder for appium to run, AS WELL as a target folder for when it ends. Also, you MUST input a maven command, for example:

mvn test -Pandroid,ci

Command specific arguments

  • --privileged: Allow docker to use the host's virtualization technology (KVM)

Optional arguments

You can choose to update the SDK when running the image. This may be useful in some cases. Just specify it like this:

UPDATE="y"

The run command will create an Android emulator before launching it. You can specify its CPU and device with the following variables (the values used are the default ones):

DEVICE="Nexus S"
ABI="default/x86_64"

Usage:

$ docker run --privileged -v /YOUR/SOURCES/FOLDER:/src -v /YOUR/TARGET/FOLDER:/src/target -e HOST_UID=$(id -u) -e HOST_GID=$(id -g) -e DOCKER_TESTS_COMMAND="YOUR_MAVEN_COMMAND" -e DEVICE="Nexus S" -e ABI="default/x86_64" -e UPDATE="y" --rm -t -i --net=host agomezmoron/docker-appium

Possible inputs

ABIs (CPUs):

  • armeabi-v7a
  • default/x86
  • default/x86_64

Devices:

  • tv_1080p
  • tv_720p
  • wear_round
  • wear_round_chin_320_290
  • wear_square
  • Galaxy Nexus
  • Nexus 10
  • Nexus 4
  • Nexus 5
  • Nexus 6
  • Nexus 7 2013
  • Nexus 7
  • Nexus 9
  • Nexus One
  • Nexus S
  • 2.7in QVGA
  • 2.7in QVGA slider
  • 3.2in HVGA slider (ADP1)
  • 3.2in QVGA (ADP2)
  • 3.3in WQVGA
  • 3.4in WQVGA
  • 3.7 FWVGA slider
  • 3.7in WVGA (Nexus One)
  • 4in WVGA (Nexus S)
  • 4.65in 720p (Galaxy Nexus)
  • 4.7in WXGA
  • 5.1in WVGA
  • 5.4in FWVGA
  • 7in WSVGA (Tablet)
  • 10.1in WXGA (Tablet)

VNC connection

Open Remmina, a built-in app in Ubuntu. Configure a new connection like this:

  • Name: Whatever you like

  • Protocol: VNC - Virtual Network Computing

  • Server: localhost

  • Username: ubuntu / 'empty'

  • Password: Your chosen VNC password. If none was given in the build, use '1234'.

Click on 'Connect' -or 'Save' if you want to store the connection for further uses- and you should be able to see the emulator, as long as the image is up and running.

Troubleshooting

Errors on the build or run step

You can try first stopping and removing the images:

$ docker stop $(docker ps -a -q) && docker rm -f $(docker ps -a -q)

then deleting them with docker rmi -f image_id. You can check the images ids by running:

$ docker images

Errors on the VNC connection

You can try first stopping and removing the images:

$ docker stop $(docker ps -a -q) && docker rm -f $(docker ps -a -q)

then running the image again and reconnecting. If the connection still fails, try restarting the docker daemon:

$ sudo service docker restart

docker-appium's People

Contributors

pmsobrado avatar agomezmoron avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.