Refactor hw7 mobile tests to meet course requirements
This commit is contained in:
+21
-53
@@ -1,67 +1,35 @@
|
||||
services:
|
||||
apk-downloader:
|
||||
image: curlimages/curl:8.5.0
|
||||
user: "0:0"
|
||||
environment:
|
||||
- APP_URL=${APP_URL:-}
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- >
|
||||
if [ -n "$APP_URL" ]; then
|
||||
curl -L "$APP_URL" -o /apk/wishlist.apk;
|
||||
else
|
||||
cp /apk-source/app.apk /apk/wishlist.apk;
|
||||
fi
|
||||
wiremock:
|
||||
image: wiremock/wiremock:3.9.1
|
||||
volumes:
|
||||
- ./apk:/apk
|
||||
- ./wishlist-349317-5fd795.apk:/apk-source/app.apk:ro
|
||||
- ./wiremock:/home/wiremock
|
||||
- ./wishlist-349317-5fd795.apk:/home/wiremock/__files/wishlist.apk:ro
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:8080/__admin/health | grep -q 'healthy'"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 12
|
||||
|
||||
android-emulator:
|
||||
image: budtmo/docker-android:emulator_13.0
|
||||
privileged: true
|
||||
depends_on:
|
||||
apk-downloader:
|
||||
condition: service_completed_successfully
|
||||
- wiremock
|
||||
devices:
|
||||
- /dev/kvm:/dev/kvm
|
||||
ports:
|
||||
- "4723:4723"
|
||||
- "6080:6080"
|
||||
- "5554:5554"
|
||||
- "5555:5555"
|
||||
environment:
|
||||
- DEVICE=Pixel_5
|
||||
- APPIUM=true
|
||||
- WEB_VNC=true
|
||||
- AUTO_GRANT_PERMISSIONS=true
|
||||
- ENABLE_VNC=true
|
||||
- EMULATOR_PARAMS=-no-window -no-audio -gpu swiftshader_indirect -no-snapshot -no-boot-anim -accel off
|
||||
- AUTO_GRANT_PERMISSIONS=true
|
||||
- EMULATOR_PARAMS=-no-window -no-audio -gpu swiftshader_indirect -no-snapshot -no-boot-anim
|
||||
shm_size: 2gb
|
||||
volumes:
|
||||
- ./apk:/apk:ro
|
||||
apk-installer:
|
||||
image: budtmo/docker-android:emulator_13.0
|
||||
depends_on:
|
||||
android-emulator:
|
||||
condition: service_started
|
||||
entrypoint:
|
||||
- /bin/bash
|
||||
- -lc
|
||||
command:
|
||||
- >
|
||||
for i in $(seq 1 60); do
|
||||
adb connect android-emulator:5555 || true;
|
||||
if adb devices | tr -s ' ' | grep -q "android-emulator:5555"; then
|
||||
break;
|
||||
fi;
|
||||
sleep 2;
|
||||
done;
|
||||
adb -s android-emulator:5555 wait-for-device;
|
||||
for i in $(seq 1 120); do
|
||||
if adb -s android-emulator:5555 shell getprop sys.boot_completed | tr -d '\r' | grep -q "1"; then
|
||||
break;
|
||||
fi;
|
||||
sleep 2;
|
||||
done;
|
||||
adb -s android-emulator:5555 install -r /apk/wishlist.apk &&
|
||||
adb -s android-emulator:5555 shell monkey -p ru.otus.wishlist -c android.intent.category.LAUNCHER 1
|
||||
volumes:
|
||||
- ./apk:/apk:ro
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "[ \"$(cat /home/androidusr/device_status 2>/dev/null)\" = \"READY\" ]"]
|
||||
interval: 15s
|
||||
timeout: 5s
|
||||
retries: 40
|
||||
start_period: 30s
|
||||
|
||||
Reference in New Issue
Block a user