Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit fc7c109

Browse files
authored
Test automation (#687)
* accept PR comments and update the script.
1 parent ffe95cb commit fc7c109

File tree

3 files changed

+104
-1
lines changed

3 files changed

+104
-1
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,3 +150,6 @@ captures/
150150

151151
# Remove after this framework is published on NPM
152152
code-push-plugin-testing-framework/node_modules
153+
154+
# RN New Version App Generation
155+
Examples/testapp_rn

Examples/CodePushDemoApp/demo.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import CodePush from "react-native-code-push";
1616
* different check frequency, such as ON_APP_START, for a 'hands-off' approach where CodePush.sync() does not
1717
* need to be explicitly called. All options of CodePush.sync() are also available in this decorator.
1818
*/
19-
@CodePush({ checkFrequency: CodePush.CheckFrequency.MANUAL })
19+
// @CodePush({ checkFrequency: CodePush.CheckFrequency.MANUAL })
2020
class CodePushDemoApp extends Component {
2121
constructor() {
2222
super();
@@ -156,4 +156,6 @@ const styles = StyleSheet.create({
156156
},
157157
});
158158

159+
CodePushDemoApp = new CodePush(CodePushDemoApp);
160+
159161
AppRegistry.registerComponent("CodePushDemoApp", () => CodePushDemoApp);

Examples/generate-app.sh

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
#!/bin/bash
2+
3+
# Copyright (c) 2015-present, Microsoft Inc.
4+
# All rights reserved.
5+
#
6+
# This source code is licensed under the BSD-style license found in the
7+
# LICENSE file in the root directory of this source tree. An additional grant
8+
# of patent rights can be found in the PATENTS file in the same directory.
9+
10+
# The goal of this script is to automate the testing of react-native, react-native-code-push and
11+
# their internal compatibility. Run **./run.sh** to create an app and test it.
12+
13+
# You can configure below variables in the bash.
14+
15+
# 1. `code_push_version`
16+
# 2. `react_native_code_push_version`
17+
# 3. `react_native_version`
18+
# 4. `mobile_env`
19+
20+
# If you use other libs or packages, and fail to run this test, welcome to modify this script
21+
# so that we can reproduce any issues that you have.
22+
23+
24+
echo 'Automate synchronization testing between React Native and React Native Code Push';
25+
echo
26+
27+
rm -rf testapp_rn
28+
29+
# Please make sure you installed react native in your mac machine
30+
31+
echo '************************ Configuration ***********************************';
32+
33+
#################### Code Push Config #########################W#########################
34+
35+
code_push_cli_version=`code-push --version`;
36+
echo 'Code Push CLI version: ' + ${code_push_cli_version};
37+
38+
#################### React Native Config #################################################
39+
40+
echo "list all react native versions: npm show react-native versions --json"
41+
read -p "Enter react native version, [default] is the latest version:" react_native_version
42+
43+
if [ ! $react_native_version]; then
44+
react_native_version=`npm view react-native version`
45+
fi
46+
echo 'React Native version: ' + $react_native_version
47+
48+
npm list -g rninit
49+
50+
#################### React Native Code Push Config ######################################
51+
52+
echo "list all react native versions: npm show react-native-code-push versions --json"
53+
read -p "Enter react native code push version, [default] is the latest version: " react_native_code_push_version
54+
55+
if [ ! $react_native_code_push_version ]; then
56+
react_native_code_push_version=`npm view react-native-code-push version`
57+
fi
58+
echo 'React Native Code Push version: ' + $react_native_code_push_version
59+
echo
60+
61+
62+
#################### Start Testing #########################################################
63+
64+
echo '********************* Yo, start to test ***************************************';
65+
66+
current_dir=`pwd`;
67+
echo 'Current directory: ' + $current_dir;
68+
69+
echo 'Create testapp_rn app';
70+
rninit init testapp_rn --source react-native@$react_native_version
71+
72+
cd testapp_rn
73+
74+
echo 'Install React Native Code Push Version $react_native_code_push_version'
75+
npm install --save react-native-code-push@$react_native_code_push_version
76+
77+
echo 'react native link to react native code push'
78+
react-native link react-native-code-push
79+
80+
rm index.android.js
81+
rm index.ios.js
82+
cp ../CodePushDemoApp/*js .
83+
mkdir images
84+
cp ../CodePushDemoApp/images/* images
85+
86+
echo '********************* Running IOS ***************************************';
87+
88+
react-native run-ios
89+
90+
echo '********************* Running Android ***************************************';
91+
92+
read -p "you need to open the android simulator manually before continue running this script. Enter [Enter] to continue"
93+
94+
react-native run-android
95+
96+
# cd ..
97+
# rm -rf testapp
98+
# exit;

0 commit comments

Comments
 (0)