Add test case about sending a paused track to Google.

This commit is contained in:
youtaol
2012-08-28 15:37:57 +08:00
parent 14ea38da8b
commit df06149c6d
@@ -88,80 +88,20 @@ public class CreateAndSendTrackTest extends ActivityInstrumentationTestCase2<Tra
/** /**
* Check all services and send to google. * Check all services and send to google.
*/ */
public void testCreateAndSendTrack_Send() { public void testCreateAndSendTrack_send() {
EndToEndTestUtils.createTrackIfEmpty(1, false); EndToEndTestUtils.createTrackIfEmpty(1, false);
instrumentation.waitForIdleSync(); instrumentation.waitForIdleSync();
EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_send_google), true); checkSendTrackToGoogle();
EndToEndTestUtils.SOLO.waitForText(activityMyTracks.getString(R.string.send_google_title)); }
ArrayList<CheckBox> checkBoxs = EndToEndTestUtils.SOLO.getCurrentCheckBoxes();
for (int i = 0; i < checkBoxs.size(); i++) {
if (!checkBoxs.get(i).isChecked()) {
EndToEndTestUtils.SOLO.clickOnCheckBox(i);
}
}
if (checkBoxs.size() < 3) { /**
EndToEndTestUtils.SOLO.scrollDown(); * Check all services and send to google.
checkBoxs = EndToEndTestUtils.SOLO.getCurrentCheckBoxes(); */
public void testCreateAndSendTrack_sendPausedTrack() {
// Choose all Google service. EndToEndTestUtils.deleteAllTracks();
for (int i = 0; i < checkBoxs.size(); i++) { EndToEndTestUtils.createTrackWithPause(3);
if (!checkBoxs.get(i).isChecked()) {
EndToEndTestUtils.SOLO.clickOnCheckBox(i);
}
}
}
instrumentation.waitForIdleSync(); instrumentation.waitForIdleSync();
EndToEndTestUtils.getButtonOnScreen(activityMyTracks.getString(R.string.send_google_send_now), checkSendTrackToGoogle();
true, true);
// Check whether no account is binded with this device.
if (EndToEndTestUtils.SOLO.waitForText(
activityMyTracks.getString(R.string.send_google_no_account_title), 1,
EndToEndTestUtils.SHORT_WAIT_TIME)) {
EndToEndTestUtils.getButtonOnScreen(activityMyTracks.getString(R.string.generic_ok), true,
true);
return;
}
// Check whether need to choose account.
if (EndToEndTestUtils.SOLO.waitForText(
activityMyTracks.getString(R.string.send_google_choose_account_title), 1,
EndToEndTestUtils.SHORT_WAIT_TIME)) {
EndToEndTestUtils.getButtonOnScreen(activityMyTracks.getString(R.string.generic_ok), false,
true);
return;
}
// Check whether no account permission.
if (EndToEndTestUtils.SOLO.waitForText(
activityMyTracks.getString(R.string.send_google_no_account_permission), 1,
EndToEndTestUtils.SHORT_WAIT_TIME)) {
return;
}
// Following check the process of "Send to Google".
assertTrue(EndToEndTestUtils.SOLO.waitForText(activityMyTracks
.getString(R.string.generic_progress_title)));
// Waiting the send is finish.
while (EndToEndTestUtils.SOLO.waitForText(
activityMyTracks.getString(R.string.generic_progress_title), 1,
EndToEndTestUtils.SHORT_WAIT_TIME)) {}
// Check whether the result dialog is display.
assertTrue(EndToEndTestUtils.SOLO.waitForText(activityMyTracks
.getString(R.string.share_track_share_url)));
EndToEndTestUtils
.getButtonOnScreen(activityMyTracks.getString(R.string.generic_ok), true, true);
// Check whether all data is correct on Google Map, Documents, and
// Spreadsheet.
assertTrue(GoogleUtils.deleteMap(EndToEndTestUtils.trackName, activityMyTracks));
assertTrue(GoogleUtils.searchFusionTableByTitle(EndToEndTestUtils.TRACK_NAME_PREFIX,
activityMyTracks));
assertTrue(GoogleUtils.deleteTrackInSpreadSheet(EndToEndTestUtils.trackName, activityMyTracks));
assertTrue(GoogleUtils.dropFusionTables(EndToEndTestUtils.trackName, activityMyTracks));
} }
/** /**
@@ -306,6 +246,81 @@ public class CreateAndSendTrackTest extends ActivityInstrumentationTestCase2<Tra
EndToEndTestUtils.stopRecording(true); EndToEndTestUtils.stopRecording(true);
} }
/**
* Checks the process of sending track to google.
*/
private void checkSendTrackToGoogle() {
EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_send_google), true);
EndToEndTestUtils.SOLO.waitForText(activityMyTracks.getString(R.string.send_google_title));
ArrayList<CheckBox> checkBoxs = EndToEndTestUtils.SOLO.getCurrentCheckBoxes();
for (int i = 0; i < checkBoxs.size(); i++) {
if (!checkBoxs.get(i).isChecked()) {
EndToEndTestUtils.SOLO.clickOnCheckBox(i);
}
}
if (checkBoxs.size() < 3) {
EndToEndTestUtils.SOLO.scrollDown();
checkBoxs = EndToEndTestUtils.SOLO.getCurrentCheckBoxes();
// Choose all Google service.
for (int i = 0; i < checkBoxs.size(); i++) {
if (!checkBoxs.get(i).isChecked()) {
EndToEndTestUtils.SOLO.clickOnCheckBox(i);
}
}
}
instrumentation.waitForIdleSync();
EndToEndTestUtils.getButtonOnScreen(activityMyTracks.getString(R.string.send_google_send_now),
true, true);
// Check whether no account is binded with this device.
if (EndToEndTestUtils.SOLO.waitForText(
activityMyTracks.getString(R.string.send_google_no_account_title), 1,
EndToEndTestUtils.SHORT_WAIT_TIME)) {
EndToEndTestUtils.getButtonOnScreen(activityMyTracks.getString(R.string.generic_ok), true,
true);
return;
}
// Check whether need to choose account.
if (EndToEndTestUtils.SOLO.waitForText(
activityMyTracks.getString(R.string.send_google_choose_account_title), 1,
EndToEndTestUtils.SHORT_WAIT_TIME)) {
EndToEndTestUtils.getButtonOnScreen(activityMyTracks.getString(R.string.generic_ok), false,
true);
}
// Check whether no account permission.
if (EndToEndTestUtils.SOLO.waitForText(
activityMyTracks.getString(R.string.send_google_no_account_permission), 1,
EndToEndTestUtils.SHORT_WAIT_TIME)) {
return;
}
// Following check the process of "Send to Google".
assertTrue(EndToEndTestUtils.SOLO.waitForText(activityMyTracks
.getString(R.string.generic_progress_title)));
// Waiting the send is finish.
while (EndToEndTestUtils.SOLO.waitForText(
activityMyTracks.getString(R.string.generic_progress_title), 1,
EndToEndTestUtils.SHORT_WAIT_TIME)) {}
// Check whether the result dialog is display.
assertTrue(EndToEndTestUtils.SOLO.waitForText(activityMyTracks
.getString(R.string.share_track_share_url)));
EndToEndTestUtils
.getButtonOnScreen(activityMyTracks.getString(R.string.generic_ok), true, true);
// Check whether all data is correct on Google Map, Documents, and
// Spreadsheet.
assertTrue(GoogleUtils.deleteMap(EndToEndTestUtils.trackName, activityMyTracks));
assertTrue(GoogleUtils.searchFusionTableByTitle(EndToEndTestUtils.TRACK_NAME_PREFIX,
activityMyTracks));
assertTrue(GoogleUtils.deleteTrackInSpreadSheet(EndToEndTestUtils.trackName, activityMyTracks));
assertTrue(GoogleUtils.dropFusionTables(EndToEndTestUtils.trackName, activityMyTracks));
}
/** /**
* Creates a way point and a split maker during track recording. * Creates a way point and a split maker during track recording.
*/ */