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 f460ff2b0..fe3983b88 100644 --- a/MyTracksTest/src/com/google/android/apps/mytracks/endtoendtest/CreateAndSendTrackTest.java +++ b/MyTracksTest/src/com/google/android/apps/mytracks/endtoendtest/CreateAndSendTrackTest.java @@ -53,9 +53,9 @@ 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(); + for (int i = 0; i < checkBoxs.size(); i++) { + if (!checkBoxs.get(i).isChecked()) { + EndToEndTestUtils.SOLO.clickOnCheckBox(i); + } + } + } + instrumentation.waitForIdleSync(); + EndToEndTestUtils.SOLO.clickOnText(activityMyTracks.getString(R.string.send_google_send_now)); + + // If no account is binded with this device. + if (EndToEndTestUtils.SOLO.waitForText(activityMyTracks + .getString(R.string.send_google_no_account_title), 1, 500)) { + EndToEndTestUtils.SOLO.clickOnText(activityMyTracks.getString(R.string.generic_ok)); + } else { + 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, 500)) { + } + + // For we not sure the send will be successful, just check whether the result dialog is display. + assertTrue(EndToEndTestUtils.SOLO.waitForText(activityMyTracks + .getString(R.string.share_track_share_url))); + EndToEndTestUtils.SOLO.clickOnText(activityMyTracks.getString(R.string.generic_ok)); + } + + } /** * Tests editing a track.