forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-manual-e2e.sh
executable file
·121 lines (92 loc) · 3.59 KB
/
test-manual-e2e.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/bin/bash
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
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)
rm -rf android
./gradlew :ReactAndroid:installArchives || error "Couldn't generate artifacts"
success "Generated artifacts for Maven"
npm install
success "Killing any running packagers"
lsof -i :8081 | grep LISTEN
lsof -i :8081 | grep LISTEN | /usr/bin/awk '{print $2}' | xargs kill
info "Start the packager in another terminal by running 'npm start' from the root"
info "and then press any key."
info ""
read -n 1
./gradlew :RNTester:android:app:installJscDebug || error "Couldn't build RNTester Android"
info "Press any key to run RNTester in an already running Android emulator/device"
info ""
read -n 1
adb shell am start -n com.facebook.react.uiapp/.RNTesterActivity
info "Press any key to open the workspace in Xcode, then build and test manually."
info ""
read -n 1
success "Installing CocoaPods dependencies"
rm -rf RNTester/Pods && cd RNTester && pod install
open "RNTester/RNTesterPods.xcworkspace"
info "When done testing RNTester app on iOS and Android press any key to continue."
info ""
read -n 1
success "Killing packager"
lsof -i :8081 | grep LISTEN
lsof -i :8081 | grep LISTEN | /usr/bin/awk '{print $2}' | xargs kill
npm pack
PACKAGE=$(pwd)/react-native-$PACKAGE_VERSION.tgz
success "Package bundled ($PACKAGE)"
node scripts/set-rn-template-version.js "file:$PACKAGE"
success "React Native version changed in the template"
project_name="RNTestProject"
cd /tmp/
rm -rf "$project_name"
node "$repo_root/cli.js" init "$project_name" --template "$repo_root"
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 on Android:"
info " - Disable Fast Refresh. It might be enabled from last time (the setting is stored on the device)"
info " - Verify 'Reload JS' works"
info ""
info "Press any key to run the sample in Android emulator/device"
info ""
read -n 1
cd "/tmp/${project_name}" && npx react-native run-android
info "Test the following on iOS:"
info " - Disable Fast Refresh. It might be enabled from last time (the setting is stored on the device)"
info " - Verify 'Reload JS' works"
info " - Test Chrome debugger by adding breakpoints and reloading JS. We don't have tests for Chrome debugging."
info " - Disable Chrome debugging."
info " - Enable Fast Refresh, change a file (index.js) and save. The UI should refresh."
info " - Disable Fast Refresh."
info ""
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"