aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/cgeo/geocaching/waypointactivity/AddWaypointActivityTest.java32
1 files changed, 30 insertions, 2 deletions
diff --git a/tests/src/cgeo/geocaching/waypointactivity/AddWaypointActivityTest.java b/tests/src/cgeo/geocaching/waypointactivity/AddWaypointActivityTest.java
index 86a7684..cffdcfb 100644
--- a/tests/src/cgeo/geocaching/waypointactivity/AddWaypointActivityTest.java
+++ b/tests/src/cgeo/geocaching/waypointactivity/AddWaypointActivityTest.java
@@ -1,15 +1,27 @@
package cgeo.geocaching.waypointactivity;
+import cgeo.geocaching.R;
+import cgeo.geocaching.enumerations.WaypointType;
+
+import com.google.android.apps.common.testing.ui.espresso.action.ViewActions;
+
+import static com.google.android.apps.common.testing.ui.espresso.Espresso.onData;
import static com.google.android.apps.common.testing.ui.espresso.Espresso.onView;
+
import static com.google.android.apps.common.testing.ui.espresso.assertion.ViewAssertions.matches;
+
+import static com.google.android.apps.common.testing.ui.espresso.matcher.ViewMatchers.isClickable;
import static com.google.android.apps.common.testing.ui.espresso.matcher.ViewMatchers.isDisplayed;
import static com.google.android.apps.common.testing.ui.espresso.matcher.ViewMatchers.isNotChecked;
import static com.google.android.apps.common.testing.ui.espresso.matcher.ViewMatchers.withChild;
import static com.google.android.apps.common.testing.ui.espresso.matcher.ViewMatchers.withId;
import static com.google.android.apps.common.testing.ui.espresso.matcher.ViewMatchers.withText;
-import cgeo.geocaching.R;
-import cgeo.geocaching.enumerations.WaypointType;
+import static com.google.android.apps.common.testing.ui.espresso.action.ViewActions.click;
+
+import static org.hamcrest.Matchers.hasToString;
+import static org.hamcrest.Matchers.not;
+import static org.hamcrest.Matchers.startsWith;
public class AddWaypointActivityTest extends AbstractAddWaypointActivityTest {
@@ -31,4 +43,20 @@ public class AddWaypointActivityTest extends AbstractAddWaypointActivityTest {
public static void testNewWaypointNotVisited() {
onView(withId(R.id.wpt_visited_checkbox)).check(matches(isNotChecked()));
}
+
+ public static void testSwitchingWaypointTypeChangesWaypointName() {
+ WaypointType waypointType = WaypointType.FINAL;
+
+ // verify we don't have a final type yet
+ onView(withId(R.id.name)).check(matches(not(withText(waypointType.getL10n()))));
+
+ // open type selector
+ onView(withId(R.id.type)).perform(ViewActions.click());
+
+ // select final type
+ onData(hasToString(startsWith(waypointType.getL10n()))).inAdapterView(isClickable()).perform(click());
+
+ // verify changed name
+ onView(withId(R.id.name)).check(matches(withText(waypointType.getL10n())));
+ }
}