-
-
Notifications
You must be signed in to change notification settings - Fork 22
Integeration Test Support
Heyramb Narayan Goyal edited this page Dec 19, 2021
·
1 revision
For Flutter "Integeration Test Support" check this issue.
Thanks to @maksymgendin for providing the steps for "Integeration Test Support" on Flutter Task Ext.
NOTE : before you copy paste the below code and run into issues, make sure you have installed the required "Tools"
Bash steps for starting and stopping the emulators are as follows:
trigger:
- main
pool:
vmImage: macos-latest
steps:
- bash: |
ANDROID_SDK_TO_USE="system-images;android-31;google_apis;x86_64"
echo "Installing desired image"
yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --install $ANDROID_SDK_TO_USE
echo "Auto-accepting all licenses"
yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses
echo "Creating emulator"
echo no | $ANDROID_HOME/cmdline-tools/latest/bin/avdmanager create avd --force --name "pixel_12.0" --package $ANDROID_SDK_TO_USE --device pixel --tag google_apis --abi x86_64
echo "Starting emulator"
nohup $ANDROID_HOME/emulator/emulator -avd "pixel_12.0" -no-boot-anim -netdelay none -no-snapshot -wipe-data > /dev/null 2>&1 &
$ANDROID_HOME/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do sleep 1; done; input keyevent 82'
echo "Emulator started"
displayName: Prepare and start Android emulator
- bash: |
flutter test integration_test
displayName: Run integration tests on Android
- bash: |
echo "Killing Android emulators"
$ANDROID_HOME/platform-tools/adb devices | grep emulator | cut -f1 | while read line; do $ANDROID_HOME/platform-tools/adb -s $line emu kill; done
echo "Emulators killed"
displayName: Stop Android emulator
- bash: |
echo "Starting simluator"
# iOS 14.4 - iPhone 12 Pro Max
IOS_DEVICE_UID=8FC33EB4-1CC6-4EE3-9942-10A1F2AECF72
xcrun simctl boot $IOS_DEVICE_UID
open -a '/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator' --args $IOS_DEVICE_UID
echo "Simluator started"
displayName: Start iOS simulator
- bash: |
flutter test integration_test
displayName: Run integration tests on iOS
- bash: |
echo "Killing simulator"
killall Simulator
echo "Simulator killed"
displayName: Stop iOS simulator