From 9e0e9a336d0baebec31f27f6c26feff278adc410 Mon Sep 17 00:00:00 2001 From: Vishesh Handa Date: Wed, 13 Feb 2019 13:33:34 +0100 Subject: [PATCH] Integration Test: Minor refactor --- scripts/test.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/scripts/test.sh b/scripts/test.sh index 056b22c7..8e9f5af5 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -1,21 +1,24 @@ #!/usr/bin/env bash -set -eux +set -eu SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" cd "$SCRIPT_DIR/.." touch ~/.android/repositories.cfg +MIN_API_VERSION=21 +MAX_API_VERSION=28 + # Download all Images -for i in $(seq 21 28); do +for i in $(seq $MIN_API_VERSION $MAX_API_VERSION); do echo "Downling SDK $i" sdkmanager "system-images;android-$i;google_apis;x86" done -for i in $(seq 21 28); do - echo "Creating for API $i" +for i in $(seq $MIN_API_VERSION $MAX_API_VERSION); do + echo "Creating device for API $i" NAME="gitjournal_test_api_$i" echo no | avdmanager create avd -n "$NAME" -f -k "system-images;android-$i;google_apis;x86" @@ -24,12 +27,19 @@ for i in $(seq 21 28); do emulator -ports 5570,5571 -avd "$NAME" & EMULATOR_PID=$! + echo + echo "Waiting for device to boot" + echo adb wait-for-device adb -s emulator-5570 shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done; input keyevent 82' # Run the test + echo + echo "Running the Test" + echo flutter drive --target=test_driver/git.dart + echo "Shutting down the device" adb -s emulator-5570 emu kill kill -9 $EMULATOR_PID avdmanager delete avd -n "$NAME"