1#!/bin/bash
2# Copyright (c) Meta Platforms, Inc. and affiliates.
3#
4# This source code is licensed under the MIT license found in the
5# LICENSE file in the root directory of this source tree.
6
7# Runs all Android integration tests locally.
8# See https://reactnative.dev/docs/testing
9
10source $(dirname $0)/validate-android-sdk.sh
11source $(dirname $0)/validate-android-test-env.sh
12source $(dirname $0)/validate-android-device-env.sh
13
14set -e
15
16echo "Compiling native code..."
17./gradlew :ReactAndroid:packageReactNdkLibsForBuck
18
19echo "Building JS bundle..."
20node cli.js bundle --platform android --dev true --entry-file ReactAndroid/src/androidTest/js/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
21
22echo "Installing test app on the device..."
23buck fetch ReactAndroid/src/androidTest/buck-runner:instrumentation-tests
24buck install ReactAndroid/src/androidTest/buck-runner:instrumentation-tests
25
26echo "Running integration tests..."
27# Use the JS script that runs all tests in a loop and is easy to tweak
28node ./scripts/run-android-ci-instrumentation-tests.js --path ./ReactAndroid/src/androidTest/java/com/facebook/react/tests --package com.facebook.react.tests
29