Skip to content

Commit

Permalink
Custom node config (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickDuncan authored and budtmo committed Apr 23, 2018
1 parent 0499bab commit 0bc637e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
10 changes: 8 additions & 2 deletions Appium/entry_point.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@
NODE_CONFIG_JSON="/root/nodeconfig.json"
CMD="xvfb-run appium"

function generate_node_config() {
if [ -z "$CUSTOM_NODE_CONFIG" ]; then
/root/generate_config.sh $NODE_CONFIG_JSON
fi
}

if [ ! -z "$REMOTE_ADB" ]; then
/root/wireless_connect.sh
/root/wireless_connect.sh
fi

if [ ! -z "$CONNECT_TO_GRID" ]; then
/root/generate_config.sh $NODE_CONFIG_JSON
generate_node_config
CMD+=" --nodeconfig $NODE_CONFIG_JSON"
fi

Expand Down
23 changes: 15 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
## Setting up Android real device test on Docker macOSX

1. Why is this approach needed at first place?

- Helps in quick & easier setup of automation environment for appium + android
- Without this approach, you'll need to do each of the automation setup steps manually; which can be slow and error prone
- Refer to [Selenium Conference Youtube video](https://www.youtube.com/watch?v=jGW6ycW_tTQ&list=PLRdSclUtJDYXFVU37NEqh4KkT78BLqjcG&index=7) for more details
Expand Down Expand Up @@ -85,20 +85,20 @@
### Share Android identification key
Each time, you will (re)create container, connected to container devices will ask for authorization after first
connection. To prevent that, you can share one identity through all created containers. To do that, you should:
connection. To prevent that, you can share one identity through all created containers. To do that, you should:
- Connect all devices to docker physical machine
- Run `adb devices`
- Authorize all devices (do not forget to check **Always allow this computer**)
![Always allow this computer screenshot](Appium/authorization.png)
- run your containers with parameter `-v ~/.android:/root/.android`
For example:
```
$ docker run --privileged -d -p 4723:4723 -v ~/.android:/root/.android -v /dev/bus/usb:/dev/bus/usb --name container-appium appium/appium
```
```
## Connect to Android devices by Air
Expand All @@ -113,10 +113,9 @@ Then run docker container with following parameters:
- REMOTE_ADB_POLLING_SEC=60 (default: 5, interval between polling the list of connected devices in order to connect to lost remote devices)
```
$ docker run -d -p 4723:4723 -e REMOTE_ADB=True -e ANDROID_DEVICES=192.168.0.5:5555,192.168.0.6:5555 -e REMOTE_ADB_POLLING_SEC=60
$ docker run -d -p 4723:4723 -e REMOTE_ADB=True -e ANDROID_DEVICES=192.168.0.5:5555,192.168.0.6:5555 -e REMOTE_ADB_POLLING_SEC=60
```
```
## Connect to Selenium Grid
Appium-Docker-Android can be connected with selenium grid by passing following parameters:
Expand All @@ -131,6 +130,14 @@ Appium-Docker-Android can be connected with selenium grid by passing following p
$ docker run --privileged -d -p 4723:4723 -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 -v /dev/bus/usb:/dev/bus/usb --name container-appium appium/appium
```
### Custom Node Config
The image generates the node config file, if you would like to provide your own config pass the following parameters:
- CONNECT\_TO\_GRID=True
- CUSTOM\_NODE\_CONFIG=True
- -v \<path\_to\_config>:/root/nodeconfig.json
### Docker compose
There is [an example of compose file](docker-compose.yml) to simulate the connection between selenium hub and appium server with connected device(s) in docker solution.
Expand Down

0 comments on commit 0bc637e

Please sign in to comment.