mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Move fabric dependecies out of OSS instrumentation tests (#21306)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/21306 This diff moves fabric dependencies out of OSS instrumentation tests (js/react-native-github/ReactAndroid/src/androidTest/java/com/facebook/react/testing/BUCK), this will un-break build of OSS project in CI. Reviewed By: rsnara Differential Revision: D10020517 fbshipit-source-id: e2cf23afeeecf4cfb41345742f59c16af6b108d0
This commit is contained in:
committed by
Facebook Github Bot
parent
783cb8e4a6
commit
a5f1d79adf
+18
-24
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* 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.
|
||||
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.testing;
|
||||
|
||||
import android.content.Intent;
|
||||
@@ -20,17 +19,18 @@ import javax.annotation.Nullable;
|
||||
/**
|
||||
* Base class for instrumentation tests that runs React based application.
|
||||
*
|
||||
* This is similar to ReactAppInstrumentationTestCase except ReactInstrumentationTest allows
|
||||
* <p>This is similar to ReactAppInstrumentationTestCase except ReactInstrumentationTest allows
|
||||
* optional rendering of components. A test case can render no components or render multiple
|
||||
* components.
|
||||
*/
|
||||
public abstract class ReactInstrumentationTest extends
|
||||
ActivityInstrumentationTestCase2<ReactAppTestActivity> implements IdleWaiter {
|
||||
public abstract class ReactInstrumentationTest
|
||||
extends ActivityInstrumentationTestCase2<ReactAppTestActivity> implements IdleWaiter {
|
||||
|
||||
protected StringRecordingModule mRecordingModule;
|
||||
|
||||
@Nullable
|
||||
protected JavaScriptExecutorFactory mJavaScriptExecutorFactory = null;
|
||||
@Nullable protected FabricUIManagerFactory mFabricUIManagerFactory = null;
|
||||
|
||||
@Nullable protected JavaScriptExecutorFactory mJavaScriptExecutorFactory = null;
|
||||
|
||||
public ReactInstrumentationTest() {
|
||||
super(ReactAppTestActivity.class);
|
||||
@@ -45,15 +45,10 @@ public abstract class ReactInstrumentationTest extends
|
||||
setActivityIntent(intent);
|
||||
mRecordingModule = new StringRecordingModule();
|
||||
final ReactAppTestActivity activity = getActivity();
|
||||
activity.loadBundle(
|
||||
createReactInstanceSpecForTest(),
|
||||
getBundleName(),
|
||||
getEnableDevSupport());
|
||||
activity.loadBundle(createReactInstanceSpecForTest(), getBundleName(), getEnableDevSupport());
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders this component within this test's activity
|
||||
*/
|
||||
/** Renders this component within this test's activity */
|
||||
public void renderComponent(final String componentName) {
|
||||
getActivity().renderComponent(componentName, null);
|
||||
waitForBridgeAndUIIdle();
|
||||
@@ -71,8 +66,8 @@ public abstract class ReactInstrumentationTest extends
|
||||
}
|
||||
|
||||
public <T extends View> T getViewByTestId(String testID) {
|
||||
return (T) ReactTestHelper
|
||||
.getViewWithReactTestId((ViewGroup) getRootView().getParent(), testID);
|
||||
return (T)
|
||||
ReactTestHelper.getViewWithReactTestId((ViewGroup) getRootView().getParent(), testID);
|
||||
}
|
||||
|
||||
public SingleTouchGestureGenerator createGestureGenerator() {
|
||||
@@ -99,21 +94,20 @@ public abstract class ReactInstrumentationTest extends
|
||||
return getReactContext().getJSModule(jsInterface);
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this method to provide extra native modules to be loaded before the app starts
|
||||
*/
|
||||
/** Override this method to provide extra native modules to be loaded before the app starts */
|
||||
protected ReactInstanceSpecForTest createReactInstanceSpecForTest() {
|
||||
ReactInstanceSpecForTest reactInstanceSpecForTest =
|
||||
new ReactInstanceSpecForTest().addNativeModule(mRecordingModule);
|
||||
new ReactInstanceSpecForTest().addNativeModule(mRecordingModule);
|
||||
if (mJavaScriptExecutorFactory != null) {
|
||||
reactInstanceSpecForTest.setJavaScriptExecutorFactory(mJavaScriptExecutorFactory);
|
||||
}
|
||||
if (mFabricUIManagerFactory != null) {
|
||||
reactInstanceSpecForTest.setFabricUIManagerFactory(mFabricUIManagerFactory);
|
||||
}
|
||||
return reactInstanceSpecForTest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement this method to provide the bundle for this test
|
||||
*/
|
||||
/** Implement this method to provide the bundle for this test */
|
||||
protected abstract String getBundleName();
|
||||
|
||||
protected ReactContext getReactContext() {
|
||||
|
||||
Reference in New Issue
Block a user