update test script
This commit is contained in:
parent
a6715d210d
commit
18cdeaedd5
|
@ -18,6 +18,7 @@ while pgrep -q Simulator; do
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PACKAGER_OUT="packager_out.txt"
|
PACKAGER_OUT="packager_out.txt"
|
||||||
|
|
||||||
function start_packager()
|
function start_packager()
|
||||||
{
|
{
|
||||||
rm -f $PACKAGER_OUT
|
rm -f $PACKAGER_OUT
|
||||||
|
@ -34,6 +35,11 @@ function start_packager()
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function unlock_device()
|
||||||
|
{
|
||||||
|
adb shell input keyevent 82
|
||||||
|
}
|
||||||
|
|
||||||
# kill old packagers
|
# kill old packagers
|
||||||
pkill node || true
|
pkill node || true
|
||||||
|
|
||||||
|
@ -66,27 +72,6 @@ elif [ "$TARGET" = "react-example" ]; then
|
||||||
xcodebuild -scheme ReactExample -configuration "$CONFIGURATION" -sdk iphonesimulator build $DESTINATION
|
xcodebuild -scheme ReactExample -configuration "$CONFIGURATION" -sdk iphonesimulator build $DESTINATION
|
||||||
popd
|
popd
|
||||||
elif [ "$TARGET" = "react-tests-android" ]; then
|
elif [ "$TARGET" = "react-tests-android" ]; then
|
||||||
chmod a+x /opt/android-sdk-linux/build-tools/23.0.1/aapt
|
|
||||||
|
|
||||||
# Copy patched version of FB
|
|
||||||
rm -Rf ~/.m2/repository/com/facebook/react/react-native/
|
|
||||||
mkdir -p ~/.m2/repository/com/facebook/react/react-native/
|
|
||||||
tar xvf ./patched_bin/0.18.0-patched.tar.gz -C ~/.m2/repository/com/facebook/react/react-native/
|
|
||||||
echo " Installed patched React Native in "
|
|
||||||
ls -l ~/.m2/repository/com/facebook/react/react-native/0.18.0-patched/
|
|
||||||
# # update sdk tool
|
|
||||||
# expect -c '
|
|
||||||
# set timeout -1;
|
|
||||||
# spawn /opt/android-sdk-linux/tools/android update sdk -u -a -t "build-tools-23.0.1";
|
|
||||||
# expect {
|
|
||||||
# "Do you accept the license" { exp_send "y\r" ; exp_continue }
|
|
||||||
# eof
|
|
||||||
# }
|
|
||||||
# '
|
|
||||||
|
|
||||||
# run nvm
|
|
||||||
[ -s "${HOME}/.nvm/nvm.sh" ] && . "${HOME}/.nvm/nvm.sh"
|
|
||||||
|
|
||||||
pushd react-native/android
|
pushd react-native/android
|
||||||
./gradlew installarchives
|
./gradlew installarchives
|
||||||
popd
|
popd
|
||||||
|
@ -99,7 +84,7 @@ elif [ "$TARGET" = "react-tests-android" ]; then
|
||||||
|
|
||||||
npm install
|
npm install
|
||||||
start_packager
|
start_packager
|
||||||
|
unlock_device
|
||||||
sh run-android.sh
|
sh run-android.sh
|
||||||
|
|
||||||
LOGCAT_OUT="logcat_out.txt"
|
LOGCAT_OUT="logcat_out.txt"
|
||||||
|
@ -109,7 +94,7 @@ elif [ "$TARGET" = "react-tests-android" ]; then
|
||||||
adb logcat | tee $LOGCAT_OUT &
|
adb logcat | tee $LOGCAT_OUT &
|
||||||
while :;
|
while :;
|
||||||
do
|
do
|
||||||
if grep -q "FILE WRITTEN!!" $LOGCAT_OUT
|
if grep -q "__REALM_REACT_ANDROID_TESTS_COMPLETED__" $LOGCAT_OUT
|
||||||
then
|
then
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
|
@ -118,7 +103,10 @@ elif [ "$TARGET" = "react-tests-android" ]; then
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
adb pull /data/data/com.demo/files/tests.xml . || true
|
adb pull /sdcard/tests.xml . || true
|
||||||
|
more "********* TESTS COMPLETED *********";
|
||||||
|
more "********* File location: `pwd`/tests.xml *********";
|
||||||
|
more tests.xml
|
||||||
else
|
else
|
||||||
echo "Invalid target '${TARGET}'"
|
echo "Invalid target '${TARGET}'"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
* https://github.com/facebook/react-native
|
* https://github.com/facebook/react-native
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var React = require('react-native');
|
var React = require('react-native');
|
||||||
var {
|
var {
|
||||||
AppRegistry,
|
AppRegistry,
|
||||||
|
@ -77,12 +76,12 @@ function runTests() {
|
||||||
}
|
}
|
||||||
// export unit tests results
|
// export unit tests results
|
||||||
var xmlString = rootXml.end({ pretty: true, indent: ' ', newline: '\n' });
|
var xmlString = rootXml.end({ pretty: true, indent: ' ', newline: '\n' });
|
||||||
var path = RNFS.DocumentDirectoryPath + '/tests.xml';
|
var path = '/sdcard/tests.xml';
|
||||||
|
|
||||||
// write the unit tests reports
|
// write the unit tests reports
|
||||||
RNFS.writeFile(path, xmlString , 'utf8')
|
RNFS.writeFile(path, xmlString , 'utf8')
|
||||||
.then((success) => {
|
.then((success) => {
|
||||||
console.log('FILE WRITTEN!!');
|
console.log('__REALM_REACT_ANDROID_TESTS_COMPLETED__');
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log(err.message);
|
console.log(err.message);
|
||||||
|
|
Loading…
Reference in New Issue