forked from upstream-mirrors/OpenTracks
Make some change to make sync test run more stable.
This commit is contained in:
+2
-1
@@ -59,7 +59,8 @@ public class SendToGoogleTest extends ActivityInstrumentationTestCase2<TrackList
|
|||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void testCreateAndSendTrack_send() throws IOException, GoogleAuthException {
|
public void testCreateAndSendTrack_send() throws IOException, GoogleAuthException {
|
||||||
EndToEndTestUtils.createTrackIfEmpty(1, false);
|
// Create a new track.
|
||||||
|
EndToEndTestUtils.createSimpleTrack(1, false);
|
||||||
instrumentation.waitForIdleSync();
|
instrumentation.waitForIdleSync();
|
||||||
checkSendTrackToGoogle();
|
checkSendTrackToGoogle();
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -117,6 +117,7 @@ public class MultiAccountsSyncTest extends ActivityInstrumentationTestCase2<Trac
|
|||||||
// Delete one track.
|
// Delete one track.
|
||||||
EndToEndTestUtils.SOLO.clickOnView(EndToEndTestUtils.SOLO.getCurrentListViews().get(0)
|
EndToEndTestUtils.SOLO.clickOnView(EndToEndTestUtils.SOLO.getCurrentListViews().get(0)
|
||||||
.getChildAt(0));
|
.getChildAt(0));
|
||||||
|
EndToEndTestUtils.instrumentation.waitForIdleSync();
|
||||||
EndToEndTestUtils.SOLO.clickOnMenuItem(EndToEndTestUtils.activityMytracks
|
EndToEndTestUtils.SOLO.clickOnMenuItem(EndToEndTestUtils.activityMytracks
|
||||||
.getString(R.string.menu_delete));
|
.getString(R.string.menu_delete));
|
||||||
EndToEndTestUtils.SOLO.clickOnText(EndToEndTestUtils.activityMytracks
|
EndToEndTestUtils.SOLO.clickOnText(EndToEndTestUtils.activityMytracks
|
||||||
|
|||||||
+8
-4
@@ -53,7 +53,7 @@ public class SyncTestUtils {
|
|||||||
|
|
||||||
public static boolean isCheckedRunSyncTest = false;
|
public static boolean isCheckedRunSyncTest = false;
|
||||||
public static final String KML_FILE_POSTFIX = ".kml";
|
public static final String KML_FILE_POSTFIX = ".kml";
|
||||||
public static final long MAX_TIME_TO_WAIT_SYNC = 50000;
|
public static final long MAX_TIME_TO_WAIT_SYNC = 100000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets up sync tests.
|
* Sets up sync tests.
|
||||||
@@ -64,7 +64,7 @@ public class SyncTestUtils {
|
|||||||
*/
|
*/
|
||||||
public static Drive setUpForSyncTest(Instrumentation instrumentation,
|
public static Drive setUpForSyncTest(Instrumentation instrumentation,
|
||||||
TrackListActivity trackListActivity) throws IOException, GoogleAuthException {
|
TrackListActivity trackListActivity) throws IOException, GoogleAuthException {
|
||||||
if (RunConfiguration.getInstance().runSyncTest || !isCheckedRunSyncTest) {
|
if (!isCheckedRunSyncTest || RunConfiguration.getInstance().runSyncTest) {
|
||||||
EndToEndTestUtils.setupForAllTest(instrumentation, trackListActivity);
|
EndToEndTestUtils.setupForAllTest(instrumentation, trackListActivity);
|
||||||
}
|
}
|
||||||
if (!isCheckedRunSyncTest) {
|
if (!isCheckedRunSyncTest) {
|
||||||
@@ -171,20 +171,22 @@ public class SyncTestUtils {
|
|||||||
* @param accountName the account which is used to sync with
|
* @param accountName the account which is used to sync with
|
||||||
*/
|
*/
|
||||||
public static void enableSync(String accountName) {
|
public static void enableSync(String accountName) {
|
||||||
|
EndToEndTestUtils.instrumentation.waitForIdleSync();
|
||||||
EndToEndTestUtils.findMenuItem(
|
EndToEndTestUtils.findMenuItem(
|
||||||
EndToEndTestUtils.activityMytracks.getString(R.string.menu_settings), true);
|
EndToEndTestUtils.activityMytracks.getString(R.string.menu_settings), true);
|
||||||
EndToEndTestUtils.SOLO.clickOnText(EndToEndTestUtils.activityMytracks
|
EndToEndTestUtils.SOLO.clickOnText(EndToEndTestUtils.activityMytracks
|
||||||
.getString(R.string.settings_google));
|
.getString(R.string.settings_google));
|
||||||
EndToEndTestUtils.SOLO.clickOnText(EndToEndTestUtils.activityMytracks
|
EndToEndTestUtils.SOLO.clickOnText(EndToEndTestUtils.activityMytracks
|
||||||
.getString(R.string.settings_google_account_title));
|
.getString(R.string.settings_google_account_title));
|
||||||
|
EndToEndTestUtils.instrumentation.waitForIdleSync();
|
||||||
|
|
||||||
// Whether test account is bound.
|
// Whether test account is bound.
|
||||||
if (EndToEndTestUtils.SOLO.waitForText(accountName, 1, EndToEndTestUtils.TINY_WAIT_TIME)) {
|
if (EndToEndTestUtils.SOLO.waitForText(accountName, 1, EndToEndTestUtils.SHORT_WAIT_TIME)) {
|
||||||
EndToEndTestUtils.SOLO.clickOnText(accountName);
|
EndToEndTestUtils.SOLO.clickOnText(accountName);
|
||||||
EndToEndTestUtils.instrumentation.waitForIdleSync();
|
EndToEndTestUtils.instrumentation.waitForIdleSync();
|
||||||
if (EndToEndTestUtils.SOLO.waitForText(
|
if (EndToEndTestUtils.SOLO.waitForText(
|
||||||
EndToEndTestUtils.activityMytracks.getString(
|
EndToEndTestUtils.activityMytracks.getString(
|
||||||
R.string.settings_google_account_confirm_message).split("%")[0], 1,
|
R.string.generic_confirm_title), 1,
|
||||||
EndToEndTestUtils.SHORT_WAIT_TIME)) {
|
EndToEndTestUtils.SHORT_WAIT_TIME)) {
|
||||||
EndToEndTestUtils.SOLO.clickOnText(EndToEndTestUtils.activityMytracks
|
EndToEndTestUtils.SOLO.clickOnText(EndToEndTestUtils.activityMytracks
|
||||||
.getString(R.string.generic_ok));
|
.getString(R.string.generic_ok));
|
||||||
@@ -210,6 +212,7 @@ public class SyncTestUtils {
|
|||||||
}
|
}
|
||||||
EndToEndTestUtils.SOLO.goBack();
|
EndToEndTestUtils.SOLO.goBack();
|
||||||
EndToEndTestUtils.SOLO.goBack();
|
EndToEndTestUtils.SOLO.goBack();
|
||||||
|
EndToEndTestUtils.instrumentation.waitForIdleSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -222,6 +225,7 @@ public class SyncTestUtils {
|
|||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
while (System.currentTimeMillis() - startTime < MAX_TIME_TO_WAIT_SYNC) {
|
while (System.currentTimeMillis() - startTime < MAX_TIME_TO_WAIT_SYNC) {
|
||||||
try {
|
try {
|
||||||
|
EndToEndTestUtils.sleep(EndToEndTestUtils.SHORT_WAIT_TIME);
|
||||||
int trackNumber = EndToEndTestUtils.SOLO.getCurrentListViews().get(0).getCount();
|
int trackNumber = EndToEndTestUtils.SOLO.getCurrentListViews().get(0).getCount();
|
||||||
List<File> files = getDriveFiles(
|
List<File> files = getDriveFiles(
|
||||||
EndToEndTestUtils.activityMytracks.getApplicationContext(), drive);
|
EndToEndTestUtils.activityMytracks.getApplicationContext(), drive);
|
||||||
|
|||||||
Reference in New Issue
Block a user