mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-11 13:33:07 +02:00
Add some code to change the activity type during exit a track.
This commit is contained in:
+20
-9
@@ -91,7 +91,7 @@ public class CreateTrackTest extends ActivityInstrumentationTestCase2<TrackListA
|
|||||||
EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_edit), true);
|
EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_edit), true);
|
||||||
|
|
||||||
String newTrackName = EndToEndTestUtils.TRACK_NAME_PREFIX + "_new" + System.currentTimeMillis();
|
String newTrackName = EndToEndTestUtils.TRACK_NAME_PREFIX + "_new" + System.currentTimeMillis();
|
||||||
String newType = EndToEndTestUtils.activityType;
|
String newType = EndToEndTestUtils.activityType;
|
||||||
String newDesc = "desc" + newTrackName;
|
String newDesc = "desc" + newTrackName;
|
||||||
|
|
||||||
instrumentation.waitForIdleSync();
|
instrumentation.waitForIdleSync();
|
||||||
@@ -101,6 +101,15 @@ public class CreateTrackTest extends ActivityInstrumentationTestCase2<TrackListA
|
|||||||
|
|
||||||
EndToEndTestUtils.enterTextAvoidSoftKeyBoard(0, newTrackName);
|
EndToEndTestUtils.enterTextAvoidSoftKeyBoard(0, newTrackName);
|
||||||
EndToEndTestUtils.enterTextAvoidSoftKeyBoard(1, newType);
|
EndToEndTestUtils.enterTextAvoidSoftKeyBoard(1, newType);
|
||||||
|
|
||||||
|
EndToEndTestUtils.SOLO.clickOnView(EndToEndTestUtils.SOLO.getCurrentActivity().findViewById(
|
||||||
|
R.id.track_edit_activity_type_icon));
|
||||||
|
EndToEndTestUtils.SOLO.waitForText(activityMyTracks
|
||||||
|
.getString(R.string.track_edit_activity_type_hint));
|
||||||
|
EndToEndTestUtils.SOLO.clickOnView(EndToEndTestUtils.SOLO.getImage(0));
|
||||||
|
// The test type should be replaced by the first type option.
|
||||||
|
assertFalse(EndToEndTestUtils.SOLO.searchText(newType));
|
||||||
|
|
||||||
EndToEndTestUtils.enterTextAvoidSoftKeyBoard(2, newDesc);
|
EndToEndTestUtils.enterTextAvoidSoftKeyBoard(2, newDesc);
|
||||||
EndToEndTestUtils.SOLO.clickOnButton(activityMyTracks.getString(R.string.generic_save));
|
EndToEndTestUtils.SOLO.clickOnButton(activityMyTracks.getString(R.string.generic_save));
|
||||||
instrumentation.waitForIdleSync();
|
instrumentation.waitForIdleSync();
|
||||||
@@ -124,7 +133,7 @@ public class CreateTrackTest extends ActivityInstrumentationTestCase2<TrackListA
|
|||||||
assertTrue(EndToEndTestUtils.SOLO.searchText(activityMyTracks
|
assertTrue(EndToEndTestUtils.SOLO.searchText(activityMyTracks
|
||||||
.getString(R.string.generic_recording)));
|
.getString(R.string.generic_recording)));
|
||||||
}
|
}
|
||||||
|
|
||||||
EndToEndTestUtils.createWaypoint(0);
|
EndToEndTestUtils.createWaypoint(0);
|
||||||
EndToEndTestUtils.sendGps(2, 2);
|
EndToEndTestUtils.sendGps(2, 2);
|
||||||
// Back to tracks list.
|
// Back to tracks list.
|
||||||
@@ -150,11 +159,12 @@ public class CreateTrackTest extends ActivityInstrumentationTestCase2<TrackListA
|
|||||||
*/
|
*/
|
||||||
public void testTrackRelativeTime() {
|
public void testTrackRelativeTime() {
|
||||||
// Delete all track first.
|
// Delete all track first.
|
||||||
EndToEndTestUtils.deleteAllTracks();
|
EndToEndTestUtils.deleteAllTracks();
|
||||||
// Reset all settings.
|
// Reset all settings.
|
||||||
EndToEndTestUtils.resetAllSettings(activityMyTracks, false);
|
EndToEndTestUtils.resetAllSettings(activityMyTracks, false);
|
||||||
|
|
||||||
assertTrue(EndToEndTestUtils.SOLO.waitForText(activityMyTracks.getString(R.string.track_list_empty_message)));
|
assertTrue(EndToEndTestUtils.SOLO.waitForText(activityMyTracks
|
||||||
|
.getString(R.string.track_list_empty_message)));
|
||||||
// Test should not show relative time.
|
// Test should not show relative time.
|
||||||
EndToEndTestUtils.startRecording();
|
EndToEndTestUtils.startRecording();
|
||||||
instrumentation.waitForIdleSync();
|
instrumentation.waitForIdleSync();
|
||||||
@@ -165,9 +175,10 @@ public class CreateTrackTest extends ActivityInstrumentationTestCase2<TrackListA
|
|||||||
instrumentation.waitForIdleSync();
|
instrumentation.waitForIdleSync();
|
||||||
EndToEndTestUtils.SOLO.goBack();
|
EndToEndTestUtils.SOLO.goBack();
|
||||||
instrumentation.waitForIdleSync();
|
instrumentation.waitForIdleSync();
|
||||||
assertTrue(EndToEndTestUtils.SOLO.searchText(EndToEndTestUtils.RELATIVE_STARTTIME_POSTFIX, 1, false, true));
|
assertTrue(EndToEndTestUtils.SOLO.searchText(EndToEndTestUtils.RELATIVE_STARTTIME_POSTFIX, 1,
|
||||||
|
false, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests whether the split marker is created as setting.
|
* Tests whether the split marker is created as setting.
|
||||||
*/
|
*/
|
||||||
@@ -185,7 +196,7 @@ public class CreateTrackTest extends ActivityInstrumentationTestCase2<TrackListA
|
|||||||
EndToEndTestUtils
|
EndToEndTestUtils
|
||||||
.getButtonOnScreen(activityMyTracks.getString(R.string.generic_ok), true, true);
|
.getButtonOnScreen(activityMyTracks.getString(R.string.generic_ok), true, true);
|
||||||
// Send Gps to give a distance more than one kilometer or one mile.
|
// Send Gps to give a distance more than one kilometer or one mile.
|
||||||
EndToEndTestUtils.sendGps(20);
|
EndToEndTestUtils.sendGps(20);
|
||||||
assertTrue(EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_markers),
|
assertTrue(EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_markers),
|
||||||
true));
|
true));
|
||||||
instrumentation.waitForIdleSync();
|
instrumentation.waitForIdleSync();
|
||||||
@@ -198,7 +209,7 @@ public class CreateTrackTest extends ActivityInstrumentationTestCase2<TrackListA
|
|||||||
|
|
||||||
EndToEndTestUtils.stopRecording(true);
|
EndToEndTestUtils.stopRecording(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
protected void tearDown() throws Exception {
|
||||||
EndToEndTestUtils.SOLO.finishOpenedActivities();
|
EndToEndTestUtils.SOLO.finishOpenedActivities();
|
||||||
|
|||||||
+2
-2
@@ -53,7 +53,7 @@ import junit.framework.Assert;
|
|||||||
* @author Youtao Liu
|
* @author Youtao Liu
|
||||||
*/
|
*/
|
||||||
public class EndToEndTestUtils {
|
public class EndToEndTestUtils {
|
||||||
public static int emulatorPort = 5560;
|
public static int emulatorPort = 5556;
|
||||||
// usually 5554.
|
// usually 5554.
|
||||||
private static final int ORIENTATION_PORTRAIT = 1;
|
private static final int ORIENTATION_PORTRAIT = 1;
|
||||||
private static final int ORIENTATION_LANDSCAPE = 0;
|
private static final int ORIENTATION_LANDSCAPE = 0;
|
||||||
@@ -682,7 +682,7 @@ public class EndToEndTestUtils {
|
|||||||
return findResult;
|
return findResult;
|
||||||
}
|
}
|
||||||
showMenuItem();
|
showMenuItem();
|
||||||
findResult = SOLO.waitForText(menuName, 1, NORMAL_WAIT_TIME, true);
|
findResult = SOLO.waitForText(menuName, 1, LONG_WAIT_TIME, true);
|
||||||
} else {
|
} else {
|
||||||
// Non-ICS phone.
|
// Non-ICS phone.
|
||||||
SOLO.sendKey(KeyEvent.KEYCODE_MENU);
|
SOLO.sendKey(KeyEvent.KEYCODE_MENU);
|
||||||
|
|||||||
Reference in New Issue
Block a user