forked from upstream-mirrors/OpenTracks
Add test case about sending a paused track to Google.
This commit is contained in:
+86
-71
@@ -88,80 +88,20 @@ public class CreateAndSendTrackTest extends ActivityInstrumentationTestCase2<Tra
|
||||
/**
|
||||
* Check all services and send to google.
|
||||
*/
|
||||
public void testCreateAndSendTrack_Send() {
|
||||
public void testCreateAndSendTrack_send() {
|
||||
EndToEndTestUtils.createTrackIfEmpty(1, false);
|
||||
instrumentation.waitForIdleSync();
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
checkSendTrackToGoogle();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check all services and send to google.
|
||||
*/
|
||||
public void testCreateAndSendTrack_sendPausedTrack() {
|
||||
EndToEndTestUtils.deleteAllTracks();
|
||||
EndToEndTestUtils.createTrackWithPause(3);
|
||||
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);
|
||||
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));
|
||||
|
||||
checkSendTrackToGoogle();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -306,6 +246,81 @@ public class CreateAndSendTrackTest extends ActivityInstrumentationTestCase2<Tra
|
||||
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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user