This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[android] #5859 - generate espresso tests
[android] #5859 - cleanup xml files, use all the same resource id for map view [android] #5859 - update scripts [android] #5859 - update Activity to match mapboxMap naming [android] #5859 - make SurfaceViewMediaControlActivity compatible [android] #5859 - make MarkerViewScaleActivity test generation compatible [android] #5859 - make PolygonActivity test generation compatible [android] #5859 - integration within make file [android] #5859 - made CameraPostion generation safe [android] #5859 - generate sanity test [android] #5859 - add generated test cases [android] #5859 - add documentation
- Loading branch information
Showing
124 changed files
with
2,039 additions
and
1,243 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
36 changes: 0 additions & 36 deletions
36
...droidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/activity/BaseMapboxMapTest.java
This file was deleted.
Oops, something went wrong.
52 changes: 35 additions & 17 deletions
52
...apboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/activity/BaseTest.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 |
---|---|---|
@@ -1,44 +1,62 @@ | ||
package com.mapbox.mapboxsdk.activity; | ||
|
||
import android.app.Activity; | ||
import android.support.test.espresso.Espresso; | ||
import android.support.test.rule.ActivityTestRule; | ||
import android.util.Log; | ||
|
||
import com.mapbox.mapboxsdk.activity.utils.ScreenshotUtil; | ||
import com.mapbox.mapboxsdk.utils.OnMapReadyIdlingResource; | ||
import com.mapbox.mapboxsdk.utils.ScreenshotUtil; | ||
import com.mapbox.mapboxsdk.constants.MapboxConstants; | ||
import com.mapbox.mapboxsdk.maps.MapboxMap; | ||
import com.mapbox.mapboxsdk.testapp.R; | ||
|
||
import org.junit.After; | ||
import org.junit.Before; | ||
import org.junit.Rule; | ||
|
||
import static android.support.test.espresso.Espresso.onView; | ||
import static android.support.test.espresso.assertion.ViewAssertions.matches; | ||
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; | ||
import static android.support.test.espresso.matcher.ViewMatchers.withId; | ||
|
||
/** | ||
* Base Espresso class for all tests, helps working with ActivityInstrumentationTestCase2 | ||
*/ | ||
public class BaseTest { | ||
public abstract class BaseTest { | ||
|
||
@Rule | ||
public ActivityTestRule<Activity> rule = new ActivityTestRule<>(getActivityClass()); | ||
protected MapboxMap mapboxMap; | ||
protected OnMapReadyIdlingResource idlingResource; | ||
|
||
protected final static String HOME_BUTTON_STRING = "Navigate up"; | ||
@Before | ||
public void beforeTest() { | ||
Log.e(MapboxConstants.TAG, "@Before test: register idle resource"); | ||
idlingResource = new OnMapReadyIdlingResource(rule.getActivity()); | ||
Espresso.registerIdlingResources(idlingResource); | ||
checkViewIsDisplayed(R.id.mapView); | ||
mapboxMap = idlingResource.getMapboxMap(); | ||
} | ||
|
||
/* | ||
* Shortcuts for common UI tests | ||
*/ | ||
protected abstract Class getActivityClass(); | ||
|
||
protected void checkViewIsDisplayed(int id) { | ||
onView(withId(id)) | ||
.check(matches(isDisplayed())); | ||
} | ||
|
||
/* | ||
* Screenshots logic | ||
*/ | ||
|
||
protected void takeNamedScreenshot(final Activity activity, final String name) { | ||
|
||
// Screenshots need to be taken on the UI thread | ||
protected void takeScreenshot(final String name) { | ||
final Activity activity = rule.getActivity(); | ||
activity.runOnUiThread(new Runnable() { | ||
@Override | ||
public void run() { | ||
ScreenshotUtil.take(activity, name); | ||
} | ||
}); | ||
|
||
} | ||
|
||
@After | ||
public void afterTest() { | ||
Log.e(MapboxConstants.TAG, "@After test: unregister idle resource"); | ||
Espresso.unregisterIdlingResources(idlingResource); | ||
} | ||
} | ||
|
37 changes: 0 additions & 37 deletions
37
...SDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/activity/BulkMarkerActivityTest.java
This file was deleted.
Oops, something went wrong.
37 changes: 0 additions & 37 deletions
37
...SDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/activity/DirectionsActivityTest.java
This file was deleted.
Oops, something went wrong.
35 changes: 0 additions & 35 deletions
35
...p/src/androidTest/java/com/mapbox/mapboxsdk/activity/DynamicMarkerChangeActivityTest.java
This file was deleted.
Oops, something went wrong.
37 changes: 0 additions & 37 deletions
37
...idSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/activity/GeocoderActivityTest.java
This file was deleted.
Oops, something went wrong.
37 changes: 0 additions & 37 deletions
37
...SDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/activity/InfoWindowActivityTest.java
This file was deleted.
Oops, something went wrong.
37 changes: 0 additions & 37 deletions
37
...App/src/androidTest/java/com/mapbox/mapboxsdk/activity/InfoWindowAdapterActivityTest.java
This file was deleted.
Oops, something went wrong.
37 changes: 0 additions & 37 deletions
37
...KTestApp/src/androidTest/java/com/mapbox/mapboxsdk/activity/LatLngBoundsActivityTest.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.