Skip to content

Commit

Permalink
Test automation (#687)
Browse files Browse the repository at this point in the history
* accept PR comments and update the script.
  • Loading branch information
buptkang committed Feb 13, 2017
1 parent ffe95cb commit fc7c109
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -150,3 +150,6 @@ captures/

# Remove after this framework is published on NPM
code-push-plugin-testing-framework/node_modules

# RN New Version App Generation
Examples/testapp_rn
4 changes: 3 additions & 1 deletion Examples/CodePushDemoApp/demo.js
Expand Up @@ -16,7 +16,7 @@ import CodePush from "react-native-code-push";
* 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 })
// @CodePush({ checkFrequency: CodePush.CheckFrequency.MANUAL })
class CodePushDemoApp extends Component {
constructor() {
super();
Expand Down Expand Up @@ -156,4 +156,6 @@ const styles = StyleSheet.create({
},
});

CodePushDemoApp = new CodePush(CodePushDemoApp);

AppRegistry.registerComponent("CodePushDemoApp", () => CodePushDemoApp);
98 changes: 98 additions & 0 deletions Examples/generate-app.sh
@@ -0,0 +1,98 @@
#!/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.

# The goal of this script is to automate the testing of react-native, react-native-code-push and
# their internal compatibility. Run **./run.sh** to create an app and test it.

# You can configure below variables in the bash.

# 1. `code_push_version`
# 2. `react_native_code_push_version`
# 3. `react_native_version`
# 4. `mobile_env`

# If you use other libs or packages, and fail to run this test, welcome to modify this script
# so that we can reproduce any issues that you have.


echo 'Automate synchronization testing between React Native and React Native Code Push';
echo

rm -rf testapp_rn

# Please make sure you installed react native in your mac machine

echo '************************ Configuration ***********************************';

#################### Code Push Config #########################W#########################

code_push_cli_version=`code-push --version`;
echo 'Code Push CLI version: ' + ${code_push_cli_version};

#################### React Native Config #################################################

echo "list all react native versions: npm show react-native versions --json"
read -p "Enter react native version, [default] is the latest version:" react_native_version

if [ ! $react_native_version]; then
react_native_version=`npm view react-native version`
fi
echo 'React Native version: ' + $react_native_version

npm list -g rninit

#################### React Native Code Push Config ######################################

echo "list all react native versions: npm show react-native-code-push versions --json"
read -p "Enter react native code push version, [default] is the latest version: " react_native_code_push_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


#################### Start Testing #########################################################

echo '********************* Yo, start to test ***************************************';

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

echo '********************* Running IOS ***************************************';

react-native run-ios

echo '********************* Running Android ***************************************';

read -p "you need to open the android simulator manually before continue running this script. Enter [Enter] to continue"

react-native run-android

# cd ..
# rm -rf testapp
# exit;

0 comments on commit fc7c109

Please sign in to comment.