Replaced gmtool with gmsaas
This commit is contained in:
parent
5c2045a840
commit
9e826e4f61
|
@ -11,9 +11,8 @@ You can easily scale your Appium tests on Genymotion Android virtual devices in
|
||||||
```bash
|
```bash
|
||||||
export USER="xxx"
|
export USER="xxx"
|
||||||
export PASS="xxx"
|
export PASS="xxx"
|
||||||
export LICENSE="xxx"
|
|
||||||
|
|
||||||
docker run -it --rm -p 4723:4723 -v $PWD/genymotion/example/sample_devices:/root/tmp -e TYPE=SaaS -e USER=$USER -e PASS=$PASS -e LICENSE=$LICENSE budtmo/docker-android-genymotion
|
docker run -it --rm -p 4723:4723 -v $PWD/genymotion/example/sample_devices:/root/tmp -e TYPE=SaaS -e USER=$USER -e PASS=$PASS budtmo/docker-android-genymotion
|
||||||
```
|
```
|
||||||
|
|
||||||
2. On PaaS (AWS) <br />
|
2. On PaaS (AWS) <br />
|
||||||
|
|
|
@ -127,6 +127,7 @@ ENV LANG=C.UTF-8
|
||||||
#====================
|
#====================
|
||||||
RUN echo | ssh-keygen -q
|
RUN echo | ssh-keygen -q
|
||||||
ENV GENYMOTION=true \
|
ENV GENYMOTION=true \
|
||||||
|
INSTANCES_PATH=/root/tmp/instances.txt \
|
||||||
APPIUM_LOG=$LOG_PATH/appium.log
|
APPIUM_LOG=$LOG_PATH/appium.log
|
||||||
RUN pip3 install gmsaas
|
RUN pip3 install gmsaas
|
||||||
COPY genymotion/generate_config.sh genymotion/geny_start.sh genymotion/enable_adb.sh /root/
|
COPY genymotion/generate_config.sh genymotion/geny_start.sh genymotion/enable_adb.sh /root/
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"template": "Samsung Galaxy S7 - 6.0.0 - API 23 - 1440x2560",
|
"template": "a2a0c86c-7572-45fe-98d0-66f8efed9fa0",
|
||||||
"device": "SamsungS7V6",
|
"device": "SamsungS7V6",
|
||||||
"port": 38727
|
"port": 38727
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"template": "Google Nexus 6 - 8.0 - API 26 - 1440x2560",
|
"template": "80a67ae9-430c-4824-a386-befbb19518b9",
|
||||||
"device": "Nexus6V8"
|
"device": "Nexus6V8"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
1
genymotion/example/sample_devices/instances.txt
Normal file
1
genymotion/example/sample_devices/instances.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
e2dc186f-3276-4c90-a491-e67f1fcfb379 b0b2b3b3-4a23-4d8c-aed9-02ddb9e65718
|
|
@ -1,3 +1,3 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
(export USER=$USER && export PASS=$PASS && export LICENSE=$LICENSE && docker-compose -f geny.yml up -d)
|
(export USER=$USER && export PASS=$PASS && docker-compose -f geny.yml up -d)
|
||||||
|
|
|
@ -38,16 +38,26 @@ export TYPES=${types[@]}
|
||||||
getAbort() {
|
getAbort() {
|
||||||
case $TYPE in
|
case $TYPE in
|
||||||
"${types[0]}" )
|
"${types[0]}" )
|
||||||
contents=$(cat $TEMPLATE)
|
echo "ABORT SIGNAL detected! Stopping all created instances / emulators..."
|
||||||
echo "ABORT SIGNAL detected! Stopping all created emulators..."
|
|
||||||
for row in $(echo "${contents}" | jq -r '.[] | @base64'); do
|
|
||||||
get_value() {
|
|
||||||
echo ${row} | base64 --decode | jq -r ${1}
|
|
||||||
}
|
|
||||||
|
|
||||||
gmtool --cloud admin stopdisposable $(get_value '.device')
|
# Get the list of created instances from the instance.txt
|
||||||
done
|
if [ ! -f "$INSTANCES_PATH" ]; then
|
||||||
echo "Done"
|
echo "File not found! Nothing to do!"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
content=$(cat ${INSTANCES_PATH})
|
||||||
|
read -a instances <<< $content
|
||||||
|
echo "All created instances: ${instances[@]}"
|
||||||
|
|
||||||
|
# Stop the instance one by one
|
||||||
|
for i in "${instances[@]}"
|
||||||
|
do
|
||||||
|
echo "stop instance with id \"${i}\""
|
||||||
|
gmsaas instances stop "${i}"
|
||||||
|
echo "stopped"
|
||||||
|
done
|
||||||
|
echo "Done"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
"${types[1]}" )
|
"${types[1]}" )
|
||||||
contents=$(cat $TEMPLATE)
|
contents=$(cat $TEMPLATE)
|
||||||
|
|
|
@ -7,12 +7,12 @@ echo "Selected type of deployment: $TYPE, Template file: $TEMPLATE"
|
||||||
function prepare_geny_cloud() {
|
function prepare_geny_cloud() {
|
||||||
contents=$(cat $TEMPLATE)
|
contents=$(cat $TEMPLATE)
|
||||||
|
|
||||||
# Register
|
# LogIn
|
||||||
echo "Register user"
|
echo "Log In"
|
||||||
gmtool config username="${USER}" password="${PASS}"
|
gmsaas auth login "${USER}" "${PASS}"
|
||||||
gmtool license register "${LICENSE}"
|
|
||||||
|
|
||||||
# Start device(s)
|
# Start device(s)
|
||||||
|
created_instances=()
|
||||||
echo "Creating device(s) based on given json file..."
|
echo "Creating device(s) based on given json file..."
|
||||||
for row in $(echo "${contents}" | jq -r '.[] | @base64'); do
|
for row in $(echo "${contents}" | jq -r '.[] | @base64'); do
|
||||||
get_value() {
|
get_value() {
|
||||||
|
@ -22,16 +22,24 @@ function prepare_geny_cloud() {
|
||||||
template=$(get_value '.template')
|
template=$(get_value '.template')
|
||||||
device=$(get_value '.device')
|
device=$(get_value '.device')
|
||||||
port=$(get_value '.port')
|
port=$(get_value '.port')
|
||||||
|
|
||||||
|
echo "Starting \"$device\" with template name \"$template\"..."
|
||||||
|
instance_uuid=$(gmsaas instances start "${template}" "${device}")
|
||||||
|
echo "Instance-ID: \"$instance_uuid\""
|
||||||
|
created_instances+=("${instance_uuid}")
|
||||||
|
|
||||||
if [[ $port != null ]]; then
|
if [[ $port != null ]]; then
|
||||||
echo "Starting \"$device\" with template name \"$template\" on port \"$port\"..."
|
echo "Connect device on port \"$port\"..."
|
||||||
gmtool --cloud admin startdisposable "${template}" "${device}" --adb-serial-port "${port}"
|
gmsaas instances adbconnect "${instance_uuid}" --adb-serial-port "${port}"
|
||||||
else
|
else
|
||||||
echo "Starting \"$device\" with template name \"$template\"..."
|
echo "Connect device on port..."
|
||||||
gmtool --cloud admin startdisposable "${template}" "${device}"
|
gmsaas instances adbconnect "${instance_uuid}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Store created instances in a file
|
||||||
|
echo "All created instances: ${created_instances[@]}"
|
||||||
|
echo "${created_instances[@]}" > "${INSTANCES_PATH}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function prepare_geny_aws() {
|
function prepare_geny_aws() {
|
||||||
|
|
Loading…
Reference in a new issue