Add end-to-end test
This commit is contained in:
parent
3d602de8c1
commit
80102c56cf
|
@ -47,6 +47,9 @@ script:
|
|||
node server/generate.js
|
||||
fi
|
||||
|
||||
elif [ "$TEST_TYPE" = e2e ]
|
||||
then
|
||||
./scripts/e2e-test.sh
|
||||
else
|
||||
echo "Unknown test type: $TEST_TYPE"
|
||||
exit 1
|
||||
|
@ -57,6 +60,7 @@ env:
|
|||
- TEST_TYPE=objc
|
||||
- TEST_TYPE=js
|
||||
- TEST_TYPE=build_website
|
||||
- TEST_TYPE=e2e
|
||||
global:
|
||||
- secure: "HlmG8M2DmBUSBh6KH1yVIe/8gR4iibg4WfcHq1x/xYQxGbvleq7NOo04V6eFHnl9cvZCu+PKH0841WLnGR7c4BBf47GVu/o16nXzggPumHKy++lDzxFPlJ1faMDfjg/5vjbAxRUe7D3y98hQSeGHH4tedc8LvTaFLVu7iiGqvjU="
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
.published-packages
|
|
@ -0,0 +1,5 @@
|
|||
; travis:travis
|
||||
_auth=dHJhdmlzOnRyYXZpcw==
|
||||
email=travis@example.com
|
||||
spin=false
|
||||
registry=http://localhost:4873/
|
|
@ -0,0 +1,21 @@
|
|||
storage: .published-packages
|
||||
|
||||
uplinks:
|
||||
npmjs:
|
||||
url: https://registry.npmjs.org/
|
||||
|
||||
packages:
|
||||
'react-native':
|
||||
allow_access: $all
|
||||
allow_publish: $all
|
||||
|
||||
'react-native-cli':
|
||||
allow_access: $all
|
||||
allow_publish: $all
|
||||
|
||||
'*':
|
||||
allow_access: $all
|
||||
proxy: npmjs
|
||||
|
||||
logs:
|
||||
- {type: file, path: sinopia.log, format: pretty, level: http}
|
|
@ -0,0 +1,47 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Abort the mission if any command fails
|
||||
set -e
|
||||
|
||||
SCRIPTS=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
ROOT=$(dirname $SCRIPTS)
|
||||
TEMP=$(mktemp -d /tmp/react-native-XXXXXXXX)
|
||||
|
||||
# To make sure we actually installed the local version
|
||||
# of react-native, we will create a temp file inside SampleApp
|
||||
# and check that it exists after `react-native init`
|
||||
MARKER=$(mktemp $ROOT/Examples/SampleApp/XXXXXXXX)
|
||||
|
||||
function cleanup {
|
||||
kill -9 $SINOPIA_PID
|
||||
mv ~/.npmrc.bak ~/.npmrc
|
||||
rm $MARKER
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
cd $TEMP
|
||||
|
||||
# sinopia is npm registry proxy, it is used to make npm
|
||||
# think react-native and react-native-cli are actually
|
||||
# published on npm
|
||||
which sinopia || npm install -g sinopia
|
||||
|
||||
# but in order to make npm use sinopia we temporarily
|
||||
# replace its config file
|
||||
[ -f ~/.npmrc ] && cp ~/.npmrc ~/.npmrc.bak
|
||||
cp $SCRIPTS/e2e-npmrc ~/.npmrc
|
||||
|
||||
[ -d $SCRIPTS/.published-packages ] && rm -r $SCRIPTS/.published-packages
|
||||
sinopia --config $SCRIPTS/e2e-sinopia.config.yml &
|
||||
SINOPIA_PID=$!
|
||||
|
||||
npm publish $ROOT
|
||||
npm publish $ROOT/react-native-cli
|
||||
|
||||
npm install -g react-native-cli
|
||||
react-native init EndToEndTest
|
||||
cd EndToEndTest
|
||||
|
||||
# Make sure we installed local version of react-native
|
||||
ls `basename $MARKER` > /dev/null
|
||||
xctool -scheme EndToEndTest -sdk iphonesimulator8.2 test
|
Loading…
Reference in New Issue