mirror of
https://github.com/status-im/react-native.git
synced 2025-02-05 14:13:26 +00:00
Update tests to work better with async runJSBundle
Reviewed By: bestander Differential Revision: D3932963 fbshipit-source-id: 16967987b3f777104ab3a41d5967ff1b2f4678db
This commit is contained in:
parent
ba8066d7f3
commit
fc62b00880
@ -52,7 +52,8 @@ import static org.mockito.Mockito.mock;
|
|||||||
*/
|
*/
|
||||||
public abstract class ReactIntegrationTestCase extends AndroidTestCase {
|
public abstract class ReactIntegrationTestCase extends AndroidTestCase {
|
||||||
|
|
||||||
private static final long IDLE_TIMEOUT_MS = 15000;
|
// we need a bigger timeout for CI builds because they run on a slow emulator
|
||||||
|
private static final long IDLE_TIMEOUT_MS = 60000;
|
||||||
|
|
||||||
private @Nullable CatalystInstance mInstance;
|
private @Nullable CatalystInstance mInstance;
|
||||||
private @Nullable ReactBridgeIdleSignaler mBridgeIdleSignaler;
|
private @Nullable ReactBridgeIdleSignaler mBridgeIdleSignaler;
|
||||||
|
@ -13,7 +13,6 @@ import javax.annotation.Nullable;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.Callable;
|
|
||||||
|
|
||||||
import android.app.Instrumentation;
|
import android.app.Instrumentation;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -144,25 +143,14 @@ public class ReactTestHelper {
|
|||||||
@Override
|
@Override
|
||||||
public CatalystInstance build() {
|
public CatalystInstance build() {
|
||||||
final CatalystInstance instance = builder.build();
|
final CatalystInstance instance = builder.build();
|
||||||
try {
|
testCase.initializeWithInstance(instance);
|
||||||
instance.getReactQueueConfiguration().getJSQueueThread().callOnQueue(
|
instance.runJSBundle();
|
||||||
new Callable<Void>() {
|
InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public Void call() throws Exception {
|
public void run() {
|
||||||
testCase.initializeWithInstance(instance);
|
instance.initialize();
|
||||||
instance.runJSBundle();
|
}
|
||||||
return null;
|
});
|
||||||
}
|
|
||||||
}).get();
|
|
||||||
InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
instance.initialize();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
testCase.waitForBridgeAndUIIdle();
|
testCase.waitForBridgeAndUIIdle();
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user