From df06149c6df8e057c417cb2c408971149ae1a5c0 Mon Sep 17 00:00:00 2001 From: youtaol Date: Tue, 28 Aug 2012 15:37:57 +0800 Subject: [PATCH] Add test case about sending a paused track to Google. --- .../endtoendtest/CreateAndSendTrackTest.java | 157 ++++++++++-------- 1 file changed, 86 insertions(+), 71 deletions(-) diff --git a/MyTracksTest/src/com/google/android/apps/mytracks/endtoendtest/CreateAndSendTrackTest.java b/MyTracksTest/src/com/google/android/apps/mytracks/endtoendtest/CreateAndSendTrackTest.java index 423f1afb0..09115b74d 100644 --- a/MyTracksTest/src/com/google/android/apps/mytracks/endtoendtest/CreateAndSendTrackTest.java +++ b/MyTracksTest/src/com/google/android/apps/mytracks/endtoendtest/CreateAndSendTrackTest.java @@ -88,80 +88,20 @@ public class CreateAndSendTrackTest extends ActivityInstrumentationTestCase2 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 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. */