Add some code to change the activity type during exit a track.

This commit is contained in:
youtaol
2013-03-08 16:15:26 +08:00
parent f93149191e
commit d2708ca2a5
2 changed files with 22 additions and 11 deletions
@@ -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();
@@ -154,7 +163,8 @@ public class CreateTrackTest extends ActivityInstrumentationTestCase2<TrackListA
// 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,7 +175,8 @@ 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));
} }
/** /**
@@ -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);