Skip to content

Commit

Permalink
fixed a crash when there are no testInstrumentationRunnerArguments, a…
Browse files Browse the repository at this point in the history
…pp can now be init from Android Studio
  • Loading branch information
rotemmiz committed Jul 27, 2017
1 parent 6184f6e commit 7653381
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ class DetoxManager implements WebSocketClient.ActionHandler {
handler = new Handler();

Bundle arguments = InstrumentationRegistry.getArguments();
detoxServerUrl = arguments.getString(DETOX_SERVER_ARG_KEY).replace(Environment.DEVICE_LOCALHOST, Environment.getServerHost());
detoxServerUrl = arguments.getString(DETOX_SERVER_ARG_KEY);
if (detoxServerUrl != null) {
detoxServerUrl = detoxServerUrl.replace(Environment.DEVICE_LOCALHOST, Environment.getServerHost());
}
detoxSessionId = arguments.getString(DETOX_SESSION_ID_ARG_KEY);

if (detoxServerUrl == null || detoxSessionId == null) {
Expand Down
8 changes: 4 additions & 4 deletions detox/test/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ android {
abiFilters "armeabi-v7a", "x86"
}
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
// testInstrumentationRunnerArguments = [
// 'detoxServer': 'ws://localhost:8099',
// 'detoxSessionId': 'test'
// ]
testInstrumentationRunnerArguments = [
'detoxServer': 'ws://localhost:8099',
'detoxSessionId': 'test'
]

}

Expand Down

0 comments on commit 7653381

Please sign in to comment.