Revert D4770368: [rn] Use tag ids for testID

Differential Revision: D4770368

fbshipit-source-id: 4bf8131a2a2974c8db072f62e8fb26686faa100d
This commit is contained in:
Andrew Y. Chen 2017-04-04 14:58:47 -07:00 committed by Facebook Github Bot
parent c0b64ce519
commit eb300b60f3
6 changed files with 4 additions and 27 deletions

View File

@ -21,8 +21,6 @@ android_library(
react_native_dep("third-party/java/junit:junit"), react_native_dep("third-party/java/junit:junit"),
react_native_dep("third-party/java/mockito:mockito"), react_native_dep("third-party/java/mockito:mockito"),
react_native_dep("third-party/java/testing-support-lib:runner"), react_native_dep("third-party/java/testing-support-lib:runner"),
react_native_integration_tests_target("java/com/facebook/react/testing/idledetection:idledetection"),
react_native_integration_tests_target("java/com/facebook/react/testing/network:network"),
react_native_target("java/com/facebook/react:react"), react_native_target("java/com/facebook/react:react"),
react_native_target("java/com/facebook/react/bridge:bridge"), react_native_target("java/com/facebook/react/bridge:bridge"),
react_native_target("java/com/facebook/react/common:common"), react_native_target("java/com/facebook/react/common:common"),
@ -34,6 +32,7 @@ android_library(
react_native_target("java/com/facebook/react/modules/debug:interfaces"), react_native_target("java/com/facebook/react/modules/debug:interfaces"),
react_native_target("java/com/facebook/react/shell:shell"), react_native_target("java/com/facebook/react/shell:shell"),
react_native_target("java/com/facebook/react/uimanager:uimanager"), react_native_target("java/com/facebook/react/uimanager:uimanager"),
react_native_target("res:uimanager"), react_native_integration_tests_target("java/com/facebook/react/testing/idledetection:idledetection"),
react_native_integration_tests_target("java/com/facebook/react/testing/network:network"),
], ],
) )

View File

@ -17,7 +17,6 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import com.facebook.react.NativeModuleRegistryBuilder; import com.facebook.react.NativeModuleRegistryBuilder;
import com.facebook.react.R;
import com.facebook.react.ReactInstanceManager; import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactInstanceManagerBuilder; import com.facebook.react.ReactInstanceManagerBuilder;
import com.facebook.react.bridge.CatalystInstance; import com.facebook.react.bridge.CatalystInstance;
@ -188,9 +187,7 @@ public class ReactTestHelper {
} }
public static String getTestId(View view) { public static String getTestId(View view) {
return view.getTag(R.id.react_test_id) instanceof String return view.getTag() instanceof String ? (String) view.getTag() : null;
? (String) view.getTag(R.id.react_test_id)
: null;
} }
private static View findChild(View root, Predicate<View> predicate) { private static View findChild(View root, Predicate<View> predicate) {
@ -214,7 +211,7 @@ public class ReactTestHelper {
return new Predicate<View>() { return new Predicate<View>() {
@Override @Override
public boolean apply(View view) { public boolean apply(View view) {
Object tag = getTestId(view); Object tag = view.getTag();
return tag != null && tag.equals(tagValue); return tag != null && tag.equals(tagValue);
} }
}; };

View File

@ -26,6 +26,5 @@ android_library(
react_native_target("java/com/facebook/react/modules/i18nmanager:i18nmanager"), react_native_target("java/com/facebook/react/modules/i18nmanager:i18nmanager"),
react_native_target("java/com/facebook/react/touch:touch"), react_native_target("java/com/facebook/react/touch:touch"),
react_native_target("java/com/facebook/react/uimanager/annotations:annotations"), react_native_target("java/com/facebook/react/uimanager/annotations:annotations"),
react_native_target("res:uimanager"),
], ],
) )

View File

@ -5,7 +5,6 @@ package com.facebook.react.uimanager;
import android.graphics.Color; import android.graphics.Color;
import android.os.Build; import android.os.Build;
import android.view.View; import android.view.View;
import com.facebook.react.R;
import com.facebook.react.bridge.ReadableArray; import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.uimanager.annotations.ReactProp; import com.facebook.react.uimanager.annotations.ReactProp;
@ -86,9 +85,6 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
@ReactProp(name = PROP_TEST_ID) @ReactProp(name = PROP_TEST_ID)
public void setTestId(T view, String testId) { public void setTestId(T view, String testId) {
view.setTag(R.id.react_test_id, testId);
// temporarily set the tag and keyed tags to avoid end to end test regressions
view.setTag(testId); view.setTag(testId);
} }

View File

@ -26,12 +26,3 @@ android_resource(
"PUBLIC", "PUBLIC",
], ],
) )
android_resource(
name = "uimanager",
package = "com.facebook.react",
res = "views/uimanager",
visibility = [
"PUBLIC",
],
)

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- tag is used to store the testID tag -->
<item type="id" name="react_test_id"/>
</resources>