9
9
import android .os .Looper ;
10
10
import android .os .RemoteException ;
11
11
import android .support .annotation .NonNull ;
12
- import android .support .test .InstrumentationRegistry ;
13
- import android .support .test .rule .ActivityTestRule ;
14
12
import android .support .test .uiautomator .UiDevice ;
15
13
import android .support .test .uiautomator .UiObject ;
16
14
import android .support .test .uiautomator .UiObjectNotFoundException ;
17
15
import android .support .test .uiautomator .UiSelector ;
16
+ import androidx .test .platform .app .InstrumentationRegistry ;
17
+
18
+ import androidx .test .rule .ActivityTestRule ;
18
19
19
20
/**
20
21
* <p>Static class.</p>
@@ -85,12 +86,12 @@ private Detox() {
85
86
*
86
87
* <p>
87
88
* In case you have a non-standard React Native application, consider using
88
- * {@link Detox #runTests(ActivityTestRule, Object )}}.
89
+ * {@link #runTests(ActivityTestRule, Context )}}.
89
90
* </p>
90
91
* @param activityTestRule the activityTestRule
91
92
*/
92
93
public static void runTests (ActivityTestRule activityTestRule ) {
93
- Context appContext = InstrumentationRegistry .getTargetContext ().getApplicationContext ();
94
+ Context appContext = InstrumentationRegistry .getInstrumentation (). getTargetContext ().getApplicationContext ();
94
95
runTests (activityTestRule , appContext );
95
96
}
96
97
@@ -109,7 +110,7 @@ public static void runTests(ActivityTestRule activityTestRule) {
109
110
* </p>
110
111
*
111
112
* @param activityTestRule the activityTestRule
112
- * @param Context an object that has a {@code getReactNativeHost()} method
113
+ * @param context an object that has a {@code getReactNativeHost()} method
113
114
*/
114
115
public static void runTests (ActivityTestRule activityTestRule , @ NonNull final Context context ) {
115
116
sActivityTestRule = activityTestRule ;
@@ -173,7 +174,7 @@ public static void startActivityFromUrl(String url) {
173
174
// TODO: Can't get to launch the app back to previous instance using only intents from inside instrumentation (not sure why).
174
175
// this is a (hopefully) temp solution. Should use intents instead.
175
176
public static void launchMainActivity () throws RemoteException , UiObjectNotFoundException {
176
- final Context targetContext = InstrumentationRegistry .getTargetContext ();
177
+ final Context targetContext = InstrumentationRegistry .getInstrumentation (). getTargetContext ();
177
178
178
179
// Intent intent = targetContext.getPackageManager().getLaunchIntentForPackage(targetContext.getPackageName());
179
180
// intent.setPackage(null);
0 commit comments