mirror of
https://github.com/status-im/react-native.git
synced 2025-01-09 09:12:02 +00:00
affd5ac681
Summary: The goal of this pull request is to make it easier for contributors to run Android tests locally, specifically the unit tests and integration tests. I added a bunch of checks to the local testing scripts that will warn you if your environment is misconfigured, and tell you how to fix it. I also updated the testing docs, so that the regular "Testing" page should be a decent resource to point people to when you are telling them "hey this pull request needs a test." Just Android, though, I haven't gotten to the iOS parts yet. I also disabled a couple tests that seemed quite flaky while running on a local machine, and don't seem to be providing much value. In particular, the `TestId` test just hangs on my emulator a lot and has been flaky on CI in the past, so I removed about half of its test cases to make the sample app smaller. The testMetions test appears to be dependent on screen size so I commented it out. Closes https://github.com/facebook/react-native/pull/11442 Differential Revision: D4323569 Pulled By: bestander fbshipit-source-id: 9c869f3915d5c7cee438615f37986b07ab251f8c
34 lines
1.2 KiB
Bash
34 lines
1.2 KiB
Bash
#!/bin/bash
|
|
|
|
# This script validates that the Android environment is set up to run
|
|
# tests on a device or emulator (as opposed to a plain Java environment).
|
|
|
|
# This requires that the Android NDK is set up correctly and it also
|
|
# requires that you are currently either running an emulator or have
|
|
# an Android device plugged in.
|
|
|
|
if [ -z "$ANDROID_NDK" ]; then
|
|
echo "Error: \$ANDROID_NDK is not configured."
|
|
echo "You must first install the Android NDK and then set \$ANDROID_NDK."
|
|
echo "If you already installed the Android SDK, well, the NDK is a different thing that you also need to install."
|
|
echo "See https://facebook.github.io/react-native/docs/android-building-from-source.html for instructions."
|
|
exit 1
|
|
fi
|
|
|
|
if [ -z "$(adb get-state)" ]; then
|
|
echo "Error: you must either run an emulator or connect a device."
|
|
echo "You can check what devices are running with 'adb get-state'."
|
|
echo "You can run scripts/run-android-emulator.sh to get a known-good emulator config."
|
|
exit 1
|
|
fi
|
|
|
|
while :
|
|
do
|
|
BOOTANIM=`adb -e shell getprop init.svc.bootanim`
|
|
if [ -n `echo $BOOTANIM | grep stopped` ]; then
|
|
break
|
|
fi
|
|
echo "Waiting for the emulator to finish booting..."
|
|
sleep 3
|
|
done
|