[android] #3941 - update espresso tests

This commit is contained in:
Tobrun
2016-02-16 13:18:06 +01:00
parent 373cd33df0
commit 6249f9f674
17 changed files with 443 additions and 35 deletions

View File

@@ -0,0 +1,35 @@
package com.mapbox.mapboxsdk.testapp;
import android.app.Activity;
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 CameraActivity
*/
@RunWith(AndroidJUnit4.class)
@LargeTest
public class CameraActivityTest extends BaseTest {
@Rule
public ActivityTestRule<CameraActivity> mActivityRule = new ActivityTestRule<>(CameraActivity.class);
private Activity mActivity = null;
@Before
public void setActivity() {
mActivity = mActivityRule.getActivity();
}
@Test
public void testSanity() {
checkViewIsDisplayed(R.id.cameraMapView);
}
}

View File

@@ -0,0 +1,34 @@
package com.mapbox.mapboxsdk.testapp;
import android.app.Activity;
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 CameraActivity
*/
@RunWith(AndroidJUnit4.class)
@LargeTest
public class CoordinateChangeActivityTest extends BaseTest {
@Rule
public ActivityTestRule<CoordinateChangeActivity> mActivityRule = new ActivityTestRule<>(CoordinateChangeActivity.class);
private Activity mActivity = null;
@Before
public void setActivity() {
mActivity = mActivityRule.getActivity();
}
@Test
public void testSanity() {
checkViewIsDisplayed(R.id.mapView);
}
}

View File

@@ -0,0 +1,34 @@
package com.mapbox.mapboxsdk.testapp;
import android.app.Activity;
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 DirectionsActivity
*/
@RunWith(AndroidJUnit4.class)
@LargeTest
public class DirectionsActivityTest extends BaseTest {
@Rule
public ActivityTestRule<DirectionsActivity> mActivityRule = new ActivityTestRule<>(DirectionsActivity.class);
private Activity mActivity = null;
@Before
public void setActivity() {
mActivity = mActivityRule.getActivity();
}
@Test
public void testSanity() {
checkViewIsDisplayed(R.id.mapView);
}
}

View File

@@ -0,0 +1,35 @@
package com.mapbox.mapboxsdk.testapp;
import android.app.Activity;
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 DoubleMapActivity
*/
@RunWith(AndroidJUnit4.class)
@LargeTest
public class DoubleMapActivityTest extends BaseTest {
@Rule
public ActivityTestRule<DoubleMapActivity> mActivityRule = new ActivityTestRule<>(DoubleMapActivity.class);
private Activity mActivity = null;
@Before
public void setActivity() {
mActivity = mActivityRule.getActivity();
}
@Test
public void testSanity() {
checkViewIsDisplayed(R.id.mapView);
checkViewIsDisplayed(R.id.mini_map);
}
}

View File

@@ -0,0 +1,34 @@
package com.mapbox.mapboxsdk.testapp;
import android.app.Activity;
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 GeocoderActivity
*/
@RunWith(AndroidJUnit4.class)
@LargeTest
public class GeocoderActivityTest extends BaseTest {
@Rule
public ActivityTestRule<GeocoderActivity> mActivityRule = new ActivityTestRule<>(GeocoderActivity.class);
private Activity mActivity = null;
@Before
public void setActivity() {
mActivity = mActivityRule.getActivity();
}
@Test
public void testSanity() {
checkViewIsDisplayed(R.id.mapView);
}
}

View File

@@ -0,0 +1,34 @@
package com.mapbox.mapboxsdk.testapp;
import android.app.Activity;
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 InfoWindowConcurrentActivity
*/
@RunWith(AndroidJUnit4.class)
@LargeTest
public class InfoWindowConcurrentActivityTest extends BaseTest {
@Rule
public ActivityTestRule<InfoWindowConcurrentActivity> mActivityRule = new ActivityTestRule<>(InfoWindowConcurrentActivity.class);
private Activity mActivity = null;
@Before
public void setActivity() {
mActivity = mActivityRule.getActivity();
}
@Test
public void testSanity() {
checkViewIsDisplayed(R.id.infoWindowConcurrentMapView);
}
}

View File

@@ -14,7 +14,7 @@ import org.junit.runner.RunWith;
*/
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VisibleCoordinateBoundsActivityTest extends BaseTest {
public class LatLngBoundsActivityTest extends BaseTest {
@Rule
public ActivityTestRule<LatLngBoundsActivity> mActivityRule = new ActivityTestRule<>(

View File

@@ -40,11 +40,8 @@ public class MainActivityScreenTest extends BaseTest {
checkViewIsDisplayed(R.id.mainMapView);
}
/*
* Take a screenshot of Mapbox Streets to monitor #1649
*/
@Test
public void testMapboxStreetsBlackAndWhite() {
public void testStyleEmerald() {
DrawerUtils.openDrawer();
DrawerUtils.clickItem(R.string.styleEmerald);
GestureUtils.doubleClickGesture(R.id.mainMapView);
@@ -52,4 +49,40 @@ public class MainActivityScreenTest extends BaseTest {
takeNamedScreenshot(mActivity, "testEmeraldStyle");
}
@Test
public void testStyleStreets() {
DrawerUtils.openDrawer();
DrawerUtils.clickItem(R.string.styleMapboxStreets);
GestureUtils.doubleClickGesture(R.id.mainMapView);
GestureUtils.doubleClickGesture(R.id.mainMapView);
takeNamedScreenshot(mActivity, "testStreetsStyle");
}
@Test
public void testStyleDark() {
DrawerUtils.openDrawer();
DrawerUtils.clickItem(R.string.styleDark);
GestureUtils.doubleClickGesture(R.id.mainMapView);
GestureUtils.doubleClickGesture(R.id.mainMapView);
takeNamedScreenshot(mActivity, "testDarkStyle");
}
@Test
public void testStyleLight() {
DrawerUtils.openDrawer();
DrawerUtils.clickItem(R.string.styleLight);
GestureUtils.doubleClickGesture(R.id.mainMapView);
GestureUtils.doubleClickGesture(R.id.mainMapView);
takeNamedScreenshot(mActivity, "testLightStyle");
}
@Test
public void testStyleSatellite() {
DrawerUtils.openDrawer();
DrawerUtils.clickItem(R.string.styleSatellite);
GestureUtils.doubleClickGesture(R.id.mainMapView);
GestureUtils.doubleClickGesture(R.id.mainMapView);
takeNamedScreenshot(mActivity, "testSatelliteStyle");
}
}

View File

@@ -129,34 +129,6 @@ public class MainActivityTest extends BaseTest {
.check(matches(isDisplayed()));
}
@Test
public void testSwipeLeftMap() {
onView(withId(R.id.mainMapView))
.perform(swipeLeft())
.check(matches(isDisplayed()));
}
@Test
public void testSwipeRightMap() {
onView(withId(R.id.mainMapView))
.perform(swipeRight())
.check(matches(isDisplayed()));
}
@Test
public void testSwipeDownMap() {
onView(withId(R.id.mainMapView))
.perform(swipeDown())
.check(matches(isDisplayed()));
}
@Test
public void testSwipeUpMap() {
onView(withId(R.id.mainMapView))
.perform(swipeUp())
.check(matches(isDisplayed()));
}
/*
* Test the main drawer options
*/

View File

@@ -0,0 +1,34 @@
package com.mapbox.mapboxsdk.testapp;
import android.app.Activity;
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 ManualZoomActivity
*/
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ManualZoomActivityTest extends BaseTest {
@Rule
public ActivityTestRule<ManualZoomActivity> mActivityRule = new ActivityTestRule<>(ManualZoomActivity.class);
private Activity mActivity = null;
@Before
public void setActivity() {
mActivity = mActivityRule.getActivity();
}
@Test
public void testSanity() {
checkViewIsDisplayed(R.id.manualZoomMapView);
}
}

View File

@@ -0,0 +1,34 @@
package com.mapbox.mapboxsdk.testapp;
import android.app.Activity;
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 MapPaddingActivity
*/
@RunWith(AndroidJUnit4.class)
@LargeTest
public class MapPaddingActivityTest extends BaseTest {
@Rule
public ActivityTestRule<MapPaddingActivity> mActivityRule = new ActivityTestRule<>(MapPaddingActivity.class);
private Activity mActivity = null;
@Before
public void setActivity() {
mActivity = mActivityRule.getActivity();
}
@Test
public void testSanity() {
checkViewIsDisplayed(R.id.mapView);
}
}

View File

@@ -0,0 +1,34 @@
package com.mapbox.mapboxsdk.testapp;
import android.app.Activity;
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 MapboxMapActivity
*/
@RunWith(AndroidJUnit4.class)
@LargeTest
public class MapboxMapActivityTest extends BaseTest {
@Rule
public ActivityTestRule<MapboxMapActivity> mActivityRule = new ActivityTestRule<>(MapboxMapActivity.class);
private Activity mActivity = null;
@Before
public void setActivity() {
mActivity = mActivityRule.getActivity();
}
@Test
public void testSanity() {
checkViewIsDisplayed(R.id.mapView);
}
}

View File

@@ -0,0 +1,34 @@
package com.mapbox.mapboxsdk.testapp;
import android.app.Activity;
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 MaxMinZoomActivity
*/
@RunWith(AndroidJUnit4.class)
@LargeTest
public class MaxMinZoomActivityTest extends BaseTest {
@Rule
public ActivityTestRule<MaxMinZoomActivity> mActivityRule = new ActivityTestRule<>(MaxMinZoomActivity.class);
private Activity mActivity = null;
@Before
public void setActivity() {
mActivity = mActivityRule.getActivity();
}
@Test
public void testSanity() {
checkViewIsDisplayed(R.id.manualZoomMapView);
}
}

View File

@@ -0,0 +1,26 @@
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.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* Tests on ScrollByActivity
*/
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ScrollByActivityTest extends BaseTest {
@Rule
public ActivityTestRule<ScrollByActivity> mActivityRule = new ActivityTestRule<>(ScrollByActivity.class);
@Test
public void testSanity() {
checkViewIsDisplayed(R.id.mapView);
}
}

View File

@@ -0,0 +1,35 @@
package com.mapbox.mapboxsdk.testapp;
import android.app.Activity;
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 SupportMapFragmentActivity
*/
@RunWith(AndroidJUnit4.class)
@LargeTest
public class SupportMapFragmentActivityTest extends BaseTest {
@Rule
public ActivityTestRule<SupportMapFragmentActivity> mActivityRule = new ActivityTestRule<>(SupportMapFragmentActivity.class);
private Activity mActivity = null;
@Before
public void setActivity() {
mActivity = mActivityRule.getActivity();
}
@Test
public void testSanity() {
checkViewIsDisplayed(R.id.fragment_container);
}
}