react-native/scripts/test-manual-e2e.sh

76 lines
2.0 KiB
Bash
Raw Normal View History

#! /bin/bash
JAVA_VERSION="1.7"
RED="\033[0;31m"
GREEN="\033[0;32m"
BLUE="\033[0;35m"
ENDCOLOR="\033[0m"
error() {
echo -e $RED"$@"$ENDCOLOR
exit 1
}
success() {
echo -e $GREEN"$@"$ENDCOLOR
}
info() {
echo -e $BLUE"$@"$ENDCOLOR
}
PACKAGE_VERSION=$(cat package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g' \
| tr -d '[[:space:]]')
success "Preparing version $PACKAGE_VERSION"
repo_root=$(pwd)
./gradlew :ReactAndroid:installArchives || error "Couldn't generate artifacts"
success "Generated artifacts for Maven"
npm pack
PACKAGE=$(pwd)/react-native-$PACKAGE_VERSION.tgz
success "Package bundled ($PACKAGE)"
project_name="RNTestProject"
cd /tmp/
rm -rf "$project_name"
react-native init "$project_name" --version $PACKAGE
2016-01-05 18:51:50 +00:00
info "Double checking the versions in package.json are correct:"
grep "\"react-native\": \".*react-native-$PACKAGE_VERSION.tgz\"" "/tmp/${project_name}/package.json" || error "Incorrect version number in /tmp/${project_name}/package.json"
grep -E "com.facebook.react:react-native:\\+" "${project_name}/android/app/build.gradle" || error "Dependency in /tmp/${project_name}/android/app/build.gradle must be com.facebook.react:react-native:+"
success "New sample project generated at /tmp/${project_name}"
info "Test the following both on Android and iOS:"
info " - Verify that packager opens in new Window"
info " - Verify that you see the 'Welcome to React Native' screen"
info " - Verify 'Reload JS' works"
2016-01-05 18:51:50 +00:00
info " - Test Chrome debugger by adding breakpoints. We don't have tests for Chrome debugging."
info ""
info "Press any key to run the sample in Android emulator/device"
info ""
read -n 1
cd "/tmp/${project_name}" && react-native run-android
info "Press any key to open the project in XCode"
info ""
read -n 1
open "/tmp/${project_name}/ios/${project_name}.xcodeproj"
cd "$repo_root"
info "Next steps:"
info " - https://github.com/facebook/react-native/blob/master/Releases.md"