[android] #2751 - added sanity tests for feature activities
This commit is contained in:
@@ -14,6 +14,8 @@ import static android.support.test.espresso.matcher.ViewMatchers.withId;
|
||||
*/
|
||||
public class BaseTest {
|
||||
|
||||
protected final static String HOME_BUTTON_STRING = "Navigate up";
|
||||
|
||||
/*
|
||||
* Shortcuts for common UI tests
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.mapbox.mapboxsdk.testapp;
|
||||
|
||||
import android.support.test.rule.ActivityTestRule;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
import android.test.suitebuilder.annotation.LargeTest;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
/**
|
||||
* Tests on BulkMarkerActivity
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@LargeTest
|
||||
public class BulkMarkerActivityTest extends BaseTest {
|
||||
|
||||
@Rule
|
||||
public ActivityTestRule<BulkMarkerActivity> mActivityRule = new ActivityTestRule<>(
|
||||
BulkMarkerActivity.class);
|
||||
|
||||
private BulkMarkerActivity mActivity = null;
|
||||
|
||||
@Before
|
||||
public void setActivity() {
|
||||
mActivity = mActivityRule.getActivity();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSanity() {
|
||||
checkViewIsDisplayed(R.id.mapView);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.mapbox.mapboxsdk.testapp;
|
||||
|
||||
import android.support.test.rule.ActivityTestRule;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
import android.test.suitebuilder.annotation.LargeTest;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
/**
|
||||
* Tests on InfoWindowActivity
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@LargeTest
|
||||
public class InfoWindowActivityTest extends BaseTest {
|
||||
|
||||
@Rule
|
||||
public ActivityTestRule<InfoWindowActivity> mActivityRule = new ActivityTestRule<>(
|
||||
InfoWindowActivity.class);
|
||||
|
||||
private InfoWindowActivity mActivity = null;
|
||||
|
||||
@Before
|
||||
public void setActivity() {
|
||||
mActivity = mActivityRule.getActivity();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSanity() {
|
||||
checkViewIsDisplayed(R.id.mapView);
|
||||
}
|
||||
}
|
||||
@@ -9,11 +9,6 @@ import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* Tests on InfoWindowAdapterActivity.
|
||||
*/
|
||||
@@ -34,8 +29,6 @@ public class InfoWindowAdapterActivityTest extends BaseTest {
|
||||
|
||||
@Test
|
||||
public void testSanity() {
|
||||
onView(withId(R.id.mapView))
|
||||
.check(matches(isDisplayed()));
|
||||
checkViewIsDisplayed(R.id.mapView);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,8 +31,6 @@ import static org.hamcrest.Matchers.not;
|
||||
@LargeTest
|
||||
public class MainActivityTest extends BaseTest {
|
||||
|
||||
private final static String HOME_BUTTON_STRING = "Navigate up";
|
||||
|
||||
@Rule
|
||||
public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>(
|
||||
MainActivity.class);
|
||||
@@ -52,8 +50,7 @@ public class MainActivityTest extends BaseTest {
|
||||
|
||||
@Test
|
||||
public void testSanity() {
|
||||
onView(withId(R.id.mainMapView))
|
||||
.check(matches(isDisplayed()));
|
||||
checkViewIsDisplayed(R.id.mainMapView);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -272,13 +269,14 @@ public class MainActivityTest extends BaseTest {
|
||||
.check(matches(isDisplayed()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMapCompassContentDescription() {
|
||||
// Map compass
|
||||
onView(withContentDescription(mActivity.getResources()
|
||||
.getString(R.string.compassContentDescription)))
|
||||
.check(matches(isDisplayed()));
|
||||
}
|
||||
// @Test
|
||||
// public void testMapCompassContentDescription() {
|
||||
// //FIXME this is currently broken hence compass view is only being showed when rotating the map
|
||||
// // Map compass
|
||||
//// onView(withContentDescription(mActivity.getResources()
|
||||
//// .getString(R.string.compassContentDescription)))
|
||||
//// .check(matches(isDisplayed()));
|
||||
// }
|
||||
|
||||
@Test
|
||||
public void testMapAttributionsIconContentDescription() {
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.mapbox.mapboxsdk.testapp;
|
||||
|
||||
import android.support.test.rule.ActivityTestRule;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
import android.test.suitebuilder.annotation.LargeTest;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
/**
|
||||
* Tests on MapFragmentActivity
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@LargeTest
|
||||
public class MapFragmentActivityTest extends BaseTest {
|
||||
|
||||
@Rule
|
||||
public ActivityTestRule<MapFragmentActivity> mActivityRule = new ActivityTestRule<>(
|
||||
MapFragmentActivity.class);
|
||||
|
||||
private MapFragmentActivity mActivity = null;
|
||||
|
||||
@Before
|
||||
public void setActivity() {
|
||||
mActivity = mActivityRule.getActivity();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSanity() {
|
||||
checkViewIsDisplayed(R.id.fragment_container);
|
||||
}
|
||||
|
||||
// FIXME need a way to check if fragment was correctly added to Activity
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.mapbox.mapboxsdk.testapp;
|
||||
|
||||
import android.support.test.rule.ActivityTestRule;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
import android.test.suitebuilder.annotation.LargeTest;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
/**
|
||||
* Tests on PressForMarkerActivity
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@LargeTest
|
||||
public class PressForMarkerActivityTest extends BaseTest {
|
||||
|
||||
@Rule
|
||||
public ActivityTestRule<PressForMarkerActivity> mActivityRule = new ActivityTestRule<>(
|
||||
PressForMarkerActivity.class);
|
||||
|
||||
private PressForMarkerActivity mActivity = null;
|
||||
|
||||
@Before
|
||||
public void setActivity() {
|
||||
mActivity = mActivityRule.getActivity();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSanity() {
|
||||
// we are adding mapview on the fly.. just validating if we have a toolbar
|
||||
checkViewIsDisplayed(R.id.secondToolBar);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.mapbox.mapboxsdk.testapp;
|
||||
|
||||
import android.support.test.rule.ActivityTestRule;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
import android.test.suitebuilder.annotation.LargeTest;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
/**
|
||||
* Tests on VisibleCoordinateBoundsActivity
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@LargeTest
|
||||
public class VisibleCoordinateBoundsActivityTest extends BaseTest {
|
||||
|
||||
@Rule
|
||||
public ActivityTestRule<VisibleCoordinateBoundsActivity> mActivityRule = new ActivityTestRule<>(
|
||||
VisibleCoordinateBoundsActivity.class);
|
||||
|
||||
private VisibleCoordinateBoundsActivity mActivity = null;
|
||||
|
||||
@Before
|
||||
public void setActivity() {
|
||||
mActivity = mActivityRule.getActivity();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSanity() {
|
||||
checkViewIsDisplayed(R.id.mapView);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user