Automate test (#704)

* test automation

* accept PR comments and update the script.

* upgrade the auto script

* update the script comment.

* tackle all comments.
This commit is contained in:
BO KANG
2017-02-21 14:57:22 -08:00
committed by GitHub
parent 0c2aa44f5f
commit 6d878bcde2
3 changed files with 76 additions and 7 deletions

3
.gitignore vendored
View File

@@ -186,3 +186,6 @@ ipch/
[Dd]ebug*/
[Rr]elease*/
Ankh.NoLoad
# RN New Version App Generation
Examples/testapp_rn

View File

@@ -11,12 +11,6 @@ import {
import CodePush from "react-native-code-push";
/**
* Configured with a MANUAL check frequency for easy testing. For production apps, it is recommended to configure a
* different check frequency, such as ON_APP_START, for a 'hands-off' approach where CodePush.sync() does not
* need to be explicitly called. All options of CodePush.sync() are also available in this decorator.
*/
@CodePush({ checkFrequency: CodePush.CheckFrequency.MANUAL })
class CodePushDemoApp extends Component {
constructor() {
super();
@@ -156,4 +150,13 @@ const styles = StyleSheet.create({
},
});
AppRegistry.registerComponent("CodePushDemoApp", () => CodePushDemoApp);
/**
* Configured with a MANUAL check frequency for easy testing. For production apps, it is recommended to configure a
* different check frequency, such as ON_APP_START, for a 'hands-off' approach where CodePush.sync() does not
* need to be explicitly called. All options of CodePush.sync() are also available in this decorator.
*/
let codePushOptions = { checkFrequency: CodePush.CheckFrequency.MANUAL };
CodePushDemoApp = CodePush(codePushOptions)(CodePushDemoApp);
AppRegistry.registerComponent("CodePushDemoApp", () => CodePushDemoApp);

63
Examples/generate-app.sh Executable file
View File

@@ -0,0 +1,63 @@
#!/bin/bash
# Copyright (c) 2015-present, Microsoft Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
echo 'CodePush + RN sample app generation script';
echo
rm -rf testapp_rn
echo '************************ Configuration ***********************************';
#################### Configure versions #################################################
read -p "Enter React Native version (default: latest):" react_native_version
read -p "Enter CodePush version (default: latest): " react_native_code_push_version
echo
if [ ! $react_native_version]; then
react_native_version=`npm view react-native version`
fi
echo 'React Native version: ' + $react_native_version
if [ ! $react_native_code_push_version ]; then
react_native_code_push_version=`npm view react-native-code-push version`
fi
echo 'React Native Code Push version: ' + $react_native_code_push_version
echo
#################### Create app #########################################################
echo '********************* Creating app ***************************************';
current_dir=`pwd`;
echo 'Current directory: ' + $current_dir;
echo 'Create testapp_rn app';
rninit init testapp_rn --source react-native@$react_native_version
cd testapp_rn
echo 'Install React Native Code Push Version $react_native_code_push_version'
npm install --save react-native-code-push@$react_native_code_push_version
echo 'react native link to react native code push'
react-native link react-native-code-push
rm index.android.js
rm index.ios.js
cp ../CodePushDemoApp/*js .
mkdir images
cp ../CodePushDemoApp/images/* images
# Make changes required to test CodePush in debug mode (see OneNote)
sed -ie '162s/AppRegistry.registerComponent("CodePushDemoApp", () => CodePushDemoApp);/AppRegistry.registerComponent("testapp_rn", () => CodePushDemoApp);/' demo.js
perl -i -p0e 's/#ifdef DEBUG.*?#endif/jsCodeLocation = [CodePush bundleURL];/s' ios/testapp_rn/AppDelegate.m
sed -ie '17,20d' node_modules/react-native/packager/react-native-xcode.sh
sed -ie '90s/targetName.toLowerCase().contains("release")/true/' node_modules/react-native/react.gradle