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.
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 budtmo/docker-android-x86-8.1
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.
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 budtmo/docker-android-x86-8.1
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>
- SELENIUM_TIMEOUT=<timeout_in_seconds>
To run tests for mobile browser, following parameter can be passed:
- MOBILE_WEB_TEST=true
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 budtmo/docker-android-x86-8.1
You can deactivate auto_record by changing the value to "False" in docker-compose file. e.g. change value to "False" in this line.
Pass environment variable RELAXED_SECURITY=true to disable additional security check to use some advanced features.
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.
docker-compose up -d