Fix errors of e2e tests.

This commit is contained in:
youtaol
2012-11-07 15:32:34 +08:00
parent 7decb2fab0
commit bca97bbd2e
3 changed files with 15 additions and 9 deletions
@@ -259,6 +259,7 @@ public class EndToEndTestUtils {
deleteAllTracks(); deleteAllTracks();
resetAllSettings(activityMyTracks, false); resetAllSettings(activityMyTracks, false);
instrumentation.waitForIdleSync();
// Check the status of real phone. For emulator, we would fix GPS signal. // Check the status of real phone. For emulator, we would fix GPS signal.
if(!isEmulator) { if(!isEmulator) {
GoToMyLocationTest.findAndClickMyLocation(activityMyTracks); GoToMyLocationTest.findAndClickMyLocation(activityMyTracks);
@@ -349,10 +349,9 @@ public class GoogleUtils {
for (String row : rowsTable) { for (String row : rowsTable) {
String firstColumn = row.split(",")[0]; String firstColumn = row.split(",")[0];
String secondColumn = row.split(",")[1]; String secondColumn = row.split(",")[1];
// If the first column is all figure, it is the table id. // The first column is the table id.
String regularExpression = "^[0-9]*$"; if (secondColumn.equals(title)) {
if (firstColumn.matches(regularExpression) && secondColumn.equals(title)) { sendFusionTableQuery("DROP TABLE " + firstColumn, context);
sendFusionTableQuery("DROP TABLE " + row.split(",")[0], context);
return true; return true;
} }
} }
@@ -77,12 +77,17 @@ public class SendToGoogleTest extends ActivityInstrumentationTestCase2<TrackList
String testActivity = "(TestActivity)"; String testActivity = "(TestActivity)";
EndToEndTestUtils.activityType = testActivity; EndToEndTestUtils.activityType = testActivity;
EndToEndTestUtils.createSimpleTrack(1, false); EndToEndTestUtils.createSimpleTrack(1, false);
sendToGoogle(); boolean result = sendToGoogle();
sendToGoogle(); result = result && sendToGoogle();
List<Entry> spreadsheetEntry = GoogleUtils.searchAllSpreadsheetByTitle(GoogleUtils.DOCUMENT_NAME_PREFIX + "-" // Result is true mean has account bound with this device and send
+ EndToEndTestUtils.activityType, activityMyTracks); // successful.
assertEquals(1, spreadsheetEntry.size()); if (result) {
List<Entry> spreadsheetEntry = GoogleUtils
.searchAllSpreadsheetByTitle(GoogleUtils.DOCUMENT_NAME_PREFIX + "-"
+ EndToEndTestUtils.activityType, activityMyTracks);
assertEquals(1, spreadsheetEntry.size());
}
} }
/** /**
@@ -154,6 +159,7 @@ public class SendToGoogleTest extends ActivityInstrumentationTestCase2<TrackList
@Override @Override
protected void tearDown() throws Exception { protected void tearDown() throws Exception {
EndToEndTestUtils.activityType = EndToEndTestUtils.DEFAULTACTIVITYTYPE; EndToEndTestUtils.activityType = EndToEndTestUtils.DEFAULTACTIVITYTYPE;
EndToEndTestUtils.SOLO.finishOpenedActivities();
super.tearDown(); super.tearDown();
} }