Skip to content

Instantly share code, notes, and snippets.

@prashanth-sams
Last active July 19, 2020 10:38
Show Gist options
  • Save prashanth-sams/255d97a2c29775f1950ab2f8d1c9b20b to your computer and use it in GitHub Desktop.
Save prashanth-sams/255d97a2c29775f1950ab2f8d1c9b20b to your computer and use it in GitHub Desktop.
Appium Selenium Grid
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: android
namespace: selenium
labels:
app: selenium
environment: stg
role: qa
service: selenium
spec:
replicas: 1
selector:
matchLabels:
app: android
template:
metadata:
labels:
app: android
spec:
containers:
- name: android
image: butomo1989/docker-android-x86-7.1.1
resources:
limits:
memory: "2048Mi"
cpu: "500m"
securityContext:
privileged: true
ports:
- containerPort: 6080
name: port1
- containerPort: 4723
name: port2
- containerPort: 5554
name: port3
- containerPort: 5555
name: port4
- containerPort: 5037
name: port5
env:
- name: DEVICE
value: "Nexus 5"
- name: APPIUM
value: "true"
- name: CONNECT_TO_GRID
value: " true"
- name: APPIUM_HOST
value: "android.selenium"
- name: APPIUM_PORT
value: "4723"
- name: SELENIUM_HOST
value: "selenium-selenium-hub.selenium"
- name: SELENIUM_PORT
value: "4444"
android:
image: budtmo/docker-android-x86-9.0
privileged: true
links:
- app:example.com
depends_on:
- hub
ports:
- 6080:6080
environment:
- DEVICE=Samsung Galaxy S7 Edge
- CONNECT_TO_GRID=true
- APPIUM=true
- SELENIUM_HOST=hub
- MOBILE_WEB_TEST=true
- AUTO_RECORD=false
@prashanth-sams
Copy link
Author

docker run --privileged -d -p 6080:6080 -p 4723:4723 -p 5554:5554 -p 5555:5555 -e DEVICE="Samsung Galaxy S10" -e APPIUM=true -e CONNECT_TO_GRID=true -e APPIUM_HOST="xxx.xxx.xxx.xx" -e APPIUM_PORT=4723 -e SELENIUM_HOST="xxx.xxx.xxx.xx" -e SELENIUM_PORT=4444 -e MOBILE_WEB_TEST=true -e RELAXED_SECURITY=true --name android-container budtmo/docker-android-x86-9.0

@prashanth-sams
Copy link
Author

check cpu accelaration

docker exec -it android-container tail -f /var/log/supervisor/docker-android.stdout.log

@prashanth-sams
Copy link
Author

docker run --rm --privileged -p 6080:6080 -p 4723:4723 -e APPIUM=true -e CONNECT_TO_GRID=true -e MOBILE_WEB_TEST=true -e DEVICE="Samsung Galaxy S6" -e AUTO_RECORD=true -e APPIUM_HOST="172.17.0.1" -e APPIUM_PORT=4723 -e SELENIUM_HOST="172.17.0.1" -e SELENIUM_PORT=4444 -v $PWD:/tmp/video butomo1989/docker-android-x86-8.1:1.6-p0

@prashanth-sams
Copy link
Author

Docker Run

check if the machine supports hardware virtualization

sysctl -a | grep machdep.cpu.features
sysctl -a | grep -o VMX
docker cp /Users/prashanth/Projects/apps/app-staging-debug.apk 4a835b756a0b:/tmp/
docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -p 4723:4723 --name android-container-appium budtmo/docker-android-real-device
docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -p 4723:4723 --name android-container-appium budtmo/docker-android-x86-7.1.1

https://github.com/budtmo/docker-android/blob/master/docker-compose.yml

@prashanth-sams
Copy link
Author

check the logs for failures

docker exec -it a82491387405 tail -f /var/log/supervisor/docker-android.stdout.log

@prashanth-sams
Copy link
Author

prashanth-sams commented Jul 16, 2020

MAC

/Users/$(whoami)/Library/Android/sdk/emulator/emulator -accel-check

image

LINUX

~/Android/Sdk/emulator/emulator -accel-check

image

@prashanth-sams
Copy link
Author

prashanth-sams commented Jul 16, 2020

docker run --privileged -d -p 6080:6080 -p 4723:4723 -p 5554:5554 -p 5555:5555 -v /Users/prashanth/Projects/apps/app-staging-debug.apk:/root/tmp/app-staging-debug.apk -e DEVICE="Samsung Galaxy S9" -e APPIUM=true --name android-container budtmo/docker-android-x86-9.0

@prashanth-sams
Copy link
Author

KVM is must for docker-android - Kernel based virtual machine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment