basic espresso testSanity() working locally and on was device farm
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package com.mapbox.mapboxgl.testapp;
|
||||
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.test.ActivityInstrumentationTestCase2;
|
||||
|
||||
import org.junit.Before;
|
||||
|
||||
/**
|
||||
* Base Espresso class for all tests, helps working with ActivityInstrumentationTestCase2
|
||||
*/
|
||||
public class BaseTest
|
||||
extends ActivityInstrumentationTestCase2<MainActivity> {
|
||||
|
||||
private MainActivity mActivity;
|
||||
|
||||
public BaseTest() {
|
||||
super(MainActivity.class);
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
injectInstrumentation(InstrumentationRegistry.getInstrumentation());
|
||||
mActivity = getActivity();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.mapbox.mapboxgl.testapp;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
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 MainActivity
|
||||
*/
|
||||
public class MainActivityTest extends BaseTest {
|
||||
|
||||
/*
|
||||
* Note that we need to keep the `test` prefix if we want to be able to run these
|
||||
* tests on AWS Device Farm, annotations are not enough:
|
||||
* https://github.com/awslabs/aws-device-farm-sample-app-for-android/issues/5#issuecomment-138258444
|
||||
*/
|
||||
|
||||
@Test
|
||||
public void testSanity() {
|
||||
onView(withId(R.id.layout_map))
|
||||
.check(matches(isDisplayed()));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user