aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2014-09-07 12:19:19 +0200
committerBananeweizen <bananeweizen@gmx.de>2014-09-07 12:19:46 +0200
commit06d6621f6667b8547530995ed85d827f79ba8fc2 (patch)
tree6ca74c2478691b9d4b2b362199d9e55ecf9f4c31 /tests/src
parente94d81f768afd376fa0e63f498b6d7e66359fb30 (diff)
downloadcgeo-06d6621f6667b8547530995ed85d827f79ba8fc2.zip
cgeo-06d6621f6667b8547530995ed85d827f79ba8fc2.tar.gz
cgeo-06d6621f6667b8547530995ed85d827f79ba8fc2.tar.bz2
verify waypoint name change on type change
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())));
+ }
}