-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into shared/otf-sprint-6
* develop: fix: fix merging of settings state in settings context (#711) chore(tests): Skip waiting for map to completely load in e2e tests (#694) chore: Run Github actions on every push to develop branch (#710) chore: speedup CI e2e tests (#708) chore: enable TestButler for e2e tests (#695)
- Loading branch information
Showing
8 changed files
with
176 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
android/app/src/androidTest/java/com/mapeo/DetoxTestAppJUnitRunner.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.mapeo; | ||
|
||
import android.os.Bundle; | ||
|
||
import com.linkedin.android.testbutler.TestButler; | ||
|
||
import androidx.test.runner.AndroidJUnitRunner; | ||
|
||
public class DetoxTestAppJUnitRunner extends AndroidJUnitRunner { | ||
@Override | ||
public void onStart() { | ||
TestButler.setup(getTargetContext()); | ||
super.onStart(); | ||
} | ||
|
||
@Override | ||
public void finish(int resultCode, Bundle results) { | ||
TestButler.teardown(getTargetContext()); | ||
super.finish(resultCode, results); | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
android/app/src/androidTest/java/com/mapeo/TestButlerProbe.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.mapeo; | ||
|
||
import android.content.pm.PackageManager; | ||
import android.util.Log; | ||
import android.view.Surface; | ||
|
||
import com.linkedin.android.testbutler.TestButler; | ||
|
||
import androidx.test.platform.app.InstrumentationRegistry; | ||
|
||
class TestButlerProbe { | ||
|
||
private static final String LOG_TAG = TestButlerProbe.class.getSimpleName(); | ||
private static final String TEST_BUTLER_PACKAGE_NAME = "com.linkedin.android.testbutler"; | ||
|
||
private TestButlerProbe() { | ||
} | ||
|
||
static void assertReadyIfInstalled() { | ||
Log.i(LOG_TAG, "Test butler service verification started..."); | ||
|
||
if (!isTestButlerServiceInstalled()) { | ||
Log.w(LOG_TAG, "Test butler not installed on device - skipping verification"); | ||
return; | ||
} | ||
|
||
assertTestButlerServiceReady(); | ||
Log.i(LOG_TAG, "Test butler service is up and running!"); | ||
} | ||
|
||
static private boolean isTestButlerServiceInstalled() { | ||
try { | ||
PackageManager pm = InstrumentationRegistry.getInstrumentation().getTargetContext().getPackageManager(); | ||
pm.getPackageInfo(TEST_BUTLER_PACKAGE_NAME, 0); | ||
return true; | ||
} catch (PackageManager.NameNotFoundException e) { | ||
return false; | ||
} | ||
} | ||
|
||
static private void assertTestButlerServiceReady() { | ||
try { | ||
// This has no effect if test-butler is running. However, if it is not, then unlike TestButler.setup(), it would hard-fail. | ||
TestButler.setRotation(Surface.ROTATION_0); | ||
} catch (Exception e) { | ||
throw new RuntimeException("Test butler service is NOT ready!", e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ | |
|
||
beforeAll(async () => { | ||
await device.launchApp(); | ||
await device.setURLBlacklist([".*api.mapbox.com.*"]); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters