summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/MainActivityScreenTest.java
blob: 7c56f4c8746dd3c441b841d944f326edb17eefa0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package com.mapbox.mapboxsdk.testapp;

import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.LargeTest;

import com.mapbox.mapboxsdk.testapp.utils.DrawerUtils;
import com.mapbox.mapboxsdk.testapp.utils.GestureUtils;
import com.mapbox.mapboxsdk.testapp.utils.ScreenshotUtil;

import org.junit.Before;
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.action.ViewActions.doubleClick;
import static android.support.test.espresso.matcher.ViewMatchers.withId;

/**
 * Tests on MainActivity with screenshots
 */
@RunWith(AndroidJUnit4.class)
@LargeTest
public class MainActivityScreenTest extends BaseTest {

    @Rule
    public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>(
            MainActivity.class);

    private MainActivity mActivity = null;

    @Before
    public void setActivity() {
        mActivity = mActivityRule.getActivity();
    }

    @Test
    public void testSanity() {
        checkViewIsDisplayed(R.id.mainMapView);
    }

    @Test
    public void testStyleEmerald() {
        DrawerUtils.openDrawer();
        DrawerUtils.clickItem(R.string.styleEmerald);
        GestureUtils.doubleClickGesture(R.id.mainMapView);
        GestureUtils.doubleClickGesture(R.id.mainMapView);
        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");
    }

}