forked from GitJournal/GitJournal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.sh
executable file
·49 lines (37 loc) · 1.22 KB
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2019-2021 Vishesh Handa <[email protected]>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
set -eu pipefail
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 $MIN_API_VERSION $MAX_API_VERSION); do
echo "Downling SDK $i"
sdkmanager "system-images;android-$i;google_apis;x86"
done
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"
# Launch the device
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"
done