Enable js e2e tests (#23571)
Summary: Part of #23561. Small refactor to use 1 marker for the different tests, as it doesn't matter where it is- so long as we can detect it. [General] [Fixed] - turn on JS e2e tests Pull Request resolved: https://github.com/facebook/react-native/pull/23571 Differential Revision: D14172069 Pulled By: hramos fbshipit-source-id: cdde369a09d3528d05fec01d015613b3397714e6
This commit is contained in:
Родитель
d9489c4e9c
Коммит
9ca7565563
|
@ -245,12 +245,9 @@ aliases:
|
|||
name: iOS End-to-End Test Suite
|
||||
command: node ./scripts/run-ci-e2e-tests.js --ios --retries 3;
|
||||
|
||||
- &display-broken-tests-warning
|
||||
name: Running broken tests (Ignore any failures past this point)
|
||||
command: |
|
||||
echo 'The following steps are known to be failing on master.'
|
||||
echo 'They will no-op for most users.'
|
||||
echo 'PRs that bring these back to green are appreciated.'
|
||||
- &run-js-e2e-tests
|
||||
name: JavaScript End-to-End Test Suite
|
||||
command: node ./scripts/run-ci-e2e-tests.js --js --retries 3;
|
||||
|
||||
# DISABLED TESTS
|
||||
- &run-podspec-tests
|
||||
|
@ -262,9 +259,6 @@ aliases:
|
|||
- &run-android-e2e-tests
|
||||
name: Android End-to-End Test Suite
|
||||
command: node ./scripts/run-ci-e2e-tests.js --android --retries 3;
|
||||
- &run-js-e2e-tests
|
||||
name: JavaScript End-to-End Test Suite
|
||||
command: node ./scripts/run-ci-e2e-tests.js --js --retries 3;
|
||||
|
||||
defaults: &defaults
|
||||
working_directory: ~/react-native
|
||||
|
@ -338,6 +332,7 @@ jobs:
|
|||
at: ~/react-native
|
||||
|
||||
- run: *run-js-tests
|
||||
- run: *run-js-e2e-tests
|
||||
|
||||
- store_test_results:
|
||||
path: ~/react-native/reports/junit
|
||||
|
|
|
@ -34,22 +34,26 @@ const TEMP = exec('mktemp -d /tmp/react-native-XXXXXXXX').stdout.trim();
|
|||
// To make sure we actually installed the local version
|
||||
// of react-native, we will create a temp file inside the template
|
||||
// and check that it exists after `react-native init
|
||||
const MARKER_IOS = exec(
|
||||
`mktemp ${ROOT}/template/ios/HelloWorld/XXXXXXXX`,
|
||||
).stdout.trim();
|
||||
const MARKER_ANDROID = exec(
|
||||
`mktemp ${ROOT}/template/android/XXXXXXXX`,
|
||||
).stdout.trim();
|
||||
const MARKER = exec(`mktemp ${ROOT}/template/XXXXXXXX`).stdout.trim();
|
||||
const numberOfRetries = argv.retries || 1;
|
||||
let SERVER_PID;
|
||||
let APPIUM_PID;
|
||||
let exitCode;
|
||||
|
||||
// Make sure we installed local version of react-native
|
||||
function checkMarker() {
|
||||
if (!test('-e', path.basename(MARKER))) {
|
||||
echo('Marker was not found, react native init command failed?');
|
||||
exitCode = 1;
|
||||
throw Error(exitCode);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
// install CLI
|
||||
const CLI_PACKAGE = 'react-native-cli';
|
||||
if (!argv['skip-cli-install']) {
|
||||
if (exec(`sudo yarn global add ${CLI_PACKAGE}`).code) {
|
||||
if (exec(`yarn global add ${CLI_PACKAGE}`).code) {
|
||||
echo('Could not install react-native-cli globally.');
|
||||
echo('Run with --skip-cli-install to skip this step');
|
||||
exitCode = 1;
|
||||
|
@ -97,6 +101,7 @@ try {
|
|||
|
||||
if (argv.android) {
|
||||
echo('Running an Android end-to-end test');
|
||||
checkMarker();
|
||||
echo('Installing end-to-end framework');
|
||||
if (
|
||||
tryExecNTimes(
|
||||
|
@ -117,12 +122,6 @@ try {
|
|||
cd('android');
|
||||
echo('Downloading Maven deps');
|
||||
exec('./gradlew :app:copyDownloadableDepsToLibs');
|
||||
// Make sure we installed local version of react-native
|
||||
if (!test('-e', path.basename(MARKER_ANDROID))) {
|
||||
echo('Android marker was not found, react native init command failed?');
|
||||
exitCode = 1;
|
||||
throw Error(exitCode);
|
||||
}
|
||||
cd('..');
|
||||
exec(
|
||||
'keytool -genkey -v -keystore android/keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"',
|
||||
|
@ -162,15 +161,10 @@ try {
|
|||
}
|
||||
|
||||
if (argv.ios || argv.tvos) {
|
||||
checkMarker();
|
||||
var iosTestType = argv.tvos ? 'tvOS' : 'iOS';
|
||||
echo('Running the ' + iosTestType + ' app');
|
||||
cd('ios');
|
||||
// Make sure we installed local version of react-native
|
||||
if (!test('-e', path.join('EndToEndTest', path.basename(MARKER_IOS)))) {
|
||||
echo('iOS marker was not found, `react-native init` command failed?');
|
||||
exitCode = 1;
|
||||
throw Error(exitCode);
|
||||
}
|
||||
// shelljs exec('', {async: true}) does not emit stdout events, so we rely on good old spawn
|
||||
const packagerEnv = Object.create(process.env);
|
||||
packagerEnv.REACT_NATIVE_MAX_WORKERS = 1;
|
||||
|
@ -232,6 +226,7 @@ try {
|
|||
}
|
||||
|
||||
if (argv.js) {
|
||||
checkMarker();
|
||||
// Check the packager produces a bundle (doesn't throw an error)
|
||||
if (
|
||||
exec(
|
||||
|
@ -251,22 +246,11 @@ try {
|
|||
exitCode = 1;
|
||||
throw Error(exitCode);
|
||||
}
|
||||
if (exec(`${ROOT}/node_modules/.bin/flow check`).code) {
|
||||
echo('Flow check does not pass');
|
||||
exitCode = 1;
|
||||
throw Error(exitCode);
|
||||
}
|
||||
if (exec('yarn test').code) {
|
||||
echo('Jest test failure');
|
||||
exitCode = 1;
|
||||
throw Error(exitCode);
|
||||
}
|
||||
}
|
||||
exitCode = 0;
|
||||
} finally {
|
||||
cd(ROOT);
|
||||
rm(MARKER_IOS);
|
||||
rm(MARKER_ANDROID);
|
||||
rm(MARKER);
|
||||
|
||||
if (SERVER_PID) {
|
||||
echo(`Killing packager ${SERVER_PID}`);
|
||||
|
|
Загрузка…
Ссылка в новой задаче