Update Robotium to 4.1.

This commit is contained in:
youtaol
2013-06-09 20:06:16 +08:00
parent e1d2a09207
commit e9bb0d84a6
14 changed files with 74 additions and 68 deletions
Binary file not shown.
Binary file not shown.
@@ -26,15 +26,14 @@ import com.jayway.android.robotium.solo.Solo;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Instrumentation;
import android.content.Context;
import android.content.res.Configuration;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ListView;
import android.widget.TextView;
import java.io.File;
@@ -306,7 +305,7 @@ public class EndToEndTestUtils {
}
}
int trackNumber = SOLO.getCurrentListViews().get(0).getCount();
int trackNumber = SOLO.getCurrentViews(ListView.class).get(0).getCount();
// Delete all tracks when there are two many tracks which may make some test
// run slowly, such as sync test cases.
if (trackNumber > 3) {
@@ -393,11 +392,11 @@ public class EndToEndTestUtils {
*/
public static boolean isTrackListEmpty(boolean isClick) {
instrumentation.waitForIdleSync();
int trackNumber = SOLO.getCurrentListViews().get(0).getCount();
int trackNumber = SOLO.getCurrentViews(ListView.class).get(0).getCount();
if (trackNumber <= 0) {
return true;
}
View oneTrack = SOLO.getCurrentListViews().get(0).getChildAt(0);
View oneTrack = SOLO.getCurrentViews(ListView.class).get(0).getChildAt(0);
View aa = oneTrack.findViewById(R.id.list_item_name);
if (aa != null) {
trackName = (String) ((TextView) oneTrack.findViewById(R.id.list_item_name)).getText();
@@ -587,7 +586,7 @@ public class EndToEndTestUtils {
// Get all buttons and find.
if (button == null) {
ArrayList<Button> currentButtons = SOLO.getCurrentButtons();
ArrayList<Button> currentButtons = SOLO.getCurrentViews(Button.class);
for (Button oneButton : currentButtons) {
String title = (String) oneButton.getText();
if (title.equalsIgnoreCase(buttonName)) {
@@ -623,26 +622,13 @@ public class EndToEndTestUtils {
}
/**
* Rotates the current activity.
* Rotates all activities.
*/
public static void rotateCurrentActivity() {
rotateActivity(SOLO.getCurrentActivity());
instrumentation.waitForIdleSync();
}
/**
* Rotates all activities.
*/
public static void rotateAllActivities() {
if (hasActionBar) {
ArrayList<Activity> allActivities = SOLO.getAllOpenedActivities();
for (Activity activity : allActivities) {
rotateActivity(activity);
}
}
instrumentation.waitForIdleSync();
}
/**
* Finds an item in the menu with the option to click the item.
*
@@ -774,7 +760,7 @@ public class EndToEndTestUtils {
* @return the text view, null means can not find it
*/
public static TextView findTextViewInView(String text, View parent) {
ArrayList<TextView> textViews = SOLO.getCurrentTextViews(parent);
ArrayList<TextView> textViews = SOLO.getCurrentViews(TextView.class, parent);
for (TextView textView : textViews) {
String textString = (String) textView.getText();
if (textView.isShown() && textString.endsWith(text)) {
@@ -876,11 +862,9 @@ public class EndToEndTestUtils {
* @param text to enter
*/
public static void enterTextAvoidSoftKeyBoard(int editTextIndex, String text) {
InputMethodManager imm = (InputMethodManager) activityMytracks.getApplicationContext()
.getSystemService(Context.INPUT_METHOD_SERVICE);
EditText editText = SOLO.getEditText(editTextIndex);
imm.hideSoftInputFromWindow(editText.getWindowToken(), InputMethodManager.HIDE_IMPLICIT_ONLY);
SOLO.enterText(editText, text);
SOLO.hideSoftKeyboard();
}
/**
@@ -961,7 +945,7 @@ public class EndToEndTestUtils {
findMenuItem(activityMytracks.getString(R.string.menu_markers), true);
if (markerNumber > 0 && hasGpsSingal) {
SOLO.waitForText(WAYPOINT_NAME);
int actualMarkerNumber = SOLO.getCurrentListViews().get(0).getCount();
int actualMarkerNumber = SOLO.getCurrentViews(ListView.class).get(0).getCount();
Assert.assertEquals(markerNumber, actualMarkerNumber);
} else {
Assert.assertTrue(SOLO.waitForText(activityMytracks
@@ -1004,7 +988,7 @@ public class EndToEndTestUtils {
instrumentation.waitForIdleSync();
// Find the My Location button in another if null.
if (myLocation == null) {
ArrayList<ImageButton> aa = SOLO.getCurrentImageButtons();
ArrayList<ImageButton> aa = SOLO.getCurrentViews(ImageButton.class);
for (ImageButton imageButton : aa) {
if (imageButton.getContentDescription() != null
&& imageButton.getContentDescription().equals(
@@ -22,6 +22,7 @@ import com.google.android.maps.mytracks.R;
import android.app.Instrumentation;
import android.test.ActivityInstrumentationTestCase2;
import android.view.KeyEvent;
import android.widget.ListView;
/**
* Tests creating a track with markers, and editing and sending send a track.
@@ -58,7 +59,7 @@ public class CreateTrackTest extends ActivityInstrumentationTestCase2<TrackListA
String newDesc = "desc" + newTrackName;
instrumentation.waitForIdleSync();
EndToEndTestUtils.rotateAllActivities();
EndToEndTestUtils.rotateCurrentActivity();
EndToEndTestUtils.SOLO.waitForText(activityMyTracks.getString(R.string.generic_save));
sendKeys(KeyEvent.KEYCODE_DEL);
@@ -102,7 +103,7 @@ public class CreateTrackTest extends ActivityInstrumentationTestCase2<TrackListA
// Back to tracks list.
EndToEndTestUtils.SOLO.goBack();
instrumentation.waitForIdleSync();
EndToEndTestUtils.rotateAllActivities();
EndToEndTestUtils.rotateCurrentActivity();
EndToEndTestUtils.stopRecording(false);
EndToEndTestUtils.trackName = EndToEndTestUtils.TRACK_NAME_PREFIX + System.currentTimeMillis();
EndToEndTestUtils.SOLO.enterText(0, EndToEndTestUtils.trackName);
@@ -164,9 +165,9 @@ public class CreateTrackTest extends ActivityInstrumentationTestCase2<TrackListA
true));
instrumentation.waitForIdleSync();
if (EndToEndTestUtils.hasGpsSingal) {
assertTrue(EndToEndTestUtils.SOLO.getCurrentListViews().get(0).getCount() > 0);
assertTrue(EndToEndTestUtils.SOLO.getCurrentViews(ListView.class).get(0).getCount() > 0);
} else {
assertTrue(EndToEndTestUtils.SOLO.getCurrentListViews().get(0).getCount() == 0);
assertTrue(EndToEndTestUtils.SOLO.getCurrentViews(ListView.class).get(0).getCount() == 0);
}
EndToEndTestUtils.SOLO.goBack();
@@ -55,20 +55,20 @@ public class DeleteTest extends ActivityInstrumentationTestCase2<TrackListActivi
EndToEndTestUtils.createTrackIfEmpty(1, true);
instrumentation.waitForIdleSync();
// There is at least one track.
ArrayList<ListView> trackListView = EndToEndTestUtils.SOLO.getCurrentListViews();
ArrayList<ListView> trackListView = EndToEndTestUtils.SOLO.getCurrentViews(ListView.class);
assertTrue(trackListView.size() > 0);
assertTrue(trackListView.get(0).getCount() > 0);
EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_delete_all), true);
instrumentation.waitForIdleSync();
EndToEndTestUtils.rotateAllActivities();
EndToEndTestUtils.rotateCurrentActivity();
EndToEndTestUtils.getButtonOnScreen(activityMyTracks.getString(R.string.generic_yes), true,
true);
instrumentation.waitForIdleSync();
assertTrue(EndToEndTestUtils.SOLO.waitForText(activityMyTracks
.getString(R.string.track_list_empty_message)));
// There is no track now.
trackListView = EndToEndTestUtils.SOLO.getCurrentListViews();
trackListView = EndToEndTestUtils.SOLO.getCurrentViews(ListView.class);
assertEquals(0, trackListView.get(0).getCount());
// Export when there is no track.
EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_export_all), true);
@@ -96,7 +96,7 @@ public class DeleteTest extends ActivityInstrumentationTestCase2<TrackListActivi
EndToEndTestUtils.createTrackIfEmpty(1, true);
instrumentation.waitForIdleSync();
// Get the number of track( or tracks)
ArrayList<ListView> trackListView = EndToEndTestUtils.SOLO.getCurrentListViews();
ArrayList<ListView> trackListView = EndToEndTestUtils.SOLO.getCurrentViews(ListView.class);
int trackNumberOld = trackListView.get(0).getCount();
EndToEndTestUtils.SOLO.clickOnView(trackListView.get(0).getChildAt(0));
@@ -105,7 +105,7 @@ public class DeleteTest extends ActivityInstrumentationTestCase2<TrackListActivi
EndToEndTestUtils.getButtonOnScreen(activityMyTracks.getString(R.string.generic_yes), true,
true);
instrumentation.waitForIdleSync();
trackListView = EndToEndTestUtils.SOLO.getCurrentListViews();
trackListView = EndToEndTestUtils.SOLO.getCurrentViews(ListView.class);
int trackNumberNew = trackListView.get(0).getCount();
assertEquals(trackNumberOld - 1, trackNumberNew);
}
@@ -119,7 +119,7 @@ public class DeleteTest extends ActivityInstrumentationTestCase2<TrackListActivi
}
// Get the number of track( or tracks)
ArrayList<ListView> trackListView = EndToEndTestUtils.SOLO.getCurrentListViews();
ArrayList<ListView> trackListView = EndToEndTestUtils.SOLO.getCurrentViews(ListView.class);
int trackNumber = trackListView.get(0).getCount();
if (trackNumber < 3) {
@@ -130,7 +130,7 @@ public class DeleteTest extends ActivityInstrumentationTestCase2<TrackListActivi
}
// Get the number of track( or tracks)
trackListView = EndToEndTestUtils.SOLO.getCurrentListViews();
trackListView = EndToEndTestUtils.SOLO.getCurrentViews(ListView.class);
int trackNumberOld = trackListView.get(0).getCount();
assertTrue(trackNumberOld > 2);
@@ -161,7 +161,7 @@ public class DeleteTest extends ActivityInstrumentationTestCase2<TrackListActivi
// Wait a few seconds for the delete.
while (trackNumberNew != trackNumberOld - 2
&& (System.currentTimeMillis() - startTime) < EndToEndTestUtils.SHORT_WAIT_TIME) {
trackListView = EndToEndTestUtils.SOLO.getCurrentListViews();
trackListView = EndToEndTestUtils.SOLO.getCurrentViews(ListView.class);
trackNumberNew = trackListView.get(0).getCount();
EndToEndTestUtils.sleep(EndToEndTestUtils.VERY_SHORT_WAIT_TIME);
}
@@ -22,6 +22,7 @@ import com.google.android.maps.mytracks.R;
import android.app.Instrumentation;
import android.test.ActivityInstrumentationTestCase2;
import android.widget.ListView;
import java.io.File;
@@ -46,7 +47,7 @@ public class ExportAllAndImportAllTest extends ActivityInstrumentationTestCase2<
instrumentation = getInstrumentation();
activityMyTracks = getActivity();
EndToEndTestUtils.setupForAllTest(instrumentation, activityMyTracks);
trackNumber = EndToEndTestUtils.SOLO.getCurrentListViews().get(0).getCount();
trackNumber = EndToEndTestUtils.SOLO.getCurrentViews(ListView.class).get(0).getCount();
EndToEndTestUtils.createTrackIfEmpty(1, true);
}
@@ -199,7 +200,7 @@ public class ExportAllAndImportAllTest extends ActivityInstrumentationTestCase2<
}
// Get track number in current track list of MyTracks.
trackNumber = EndToEndTestUtils.SOLO.getCurrentListViews().get(0).getCount();
trackNumber = EndToEndTestUtils.SOLO.getCurrentViews(ListView.class).get(0).getCount();
// No Gpx file to imported.
importTracks(EndToEndTestUtils.GPX);
@@ -225,10 +226,10 @@ public class ExportAllAndImportAllTest extends ActivityInstrumentationTestCase2<
// Click to import Gpx track.
gpxFilesNumber = EndToEndTestUtils.getExportedFiles(EndToEndTestUtils.GPX).length;
trackNumber = EndToEndTestUtils.SOLO.getCurrentListViews().get(0).getCount();
trackNumber = EndToEndTestUtils.SOLO.getCurrentViews(ListView.class).get(0).getCount();
importTracks(EndToEndTestUtils.GPX);
EndToEndTestUtils.rotateAllActivities();
EndToEndTestUtils.rotateCurrentActivity();
/*
* Wait for the prefix of import success string is much faster than wait the
@@ -245,12 +246,12 @@ public class ExportAllAndImportAllTest extends ActivityInstrumentationTestCase2<
.getButtonOnScreen(activityMyTracks.getString(R.string.generic_ok), true, true);
instrumentation.waitForIdleSync();
assertTrue(EndToEndTestUtils.SOLO.waitForText(EndToEndTestUtils.trackName));
assertEquals(trackNumber + gpxFilesNumber, EndToEndTestUtils.SOLO.getCurrentListViews().get(0)
assertEquals(trackNumber + gpxFilesNumber, EndToEndTestUtils.SOLO.getCurrentViews(ListView.class).get(0)
.getCount());
// Click to export tracks(At least two tracks) to KML files.
gpxFilesNumber = EndToEndTestUtils.getExportedFiles(EndToEndTestUtils.GPX).length;
trackNumber = EndToEndTestUtils.SOLO.getCurrentListViews().get(0).getCount();
trackNumber = EndToEndTestUtils.SOLO.getCurrentViews(ListView.class).get(0).getCount();
EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_export_all), true);
EndToEndTestUtils.SOLO.clickOnText(String.format(
activityMyTracks.getString(R.string.export_all_option),
@@ -268,7 +269,7 @@ public class ExportAllAndImportAllTest extends ActivityInstrumentationTestCase2<
// Click to import KML track.
int KMLFilesNumber = EndToEndTestUtils.getExportedFiles(EndToEndTestUtils.KML).length;
instrumentation.waitForIdleSync();
trackNumber = EndToEndTestUtils.SOLO.getCurrentListViews().get(0).getCount();
trackNumber = EndToEndTestUtils.SOLO.getCurrentViews(ListView.class).get(0).getCount();
importTracks(EndToEndTestUtils.KML);
@@ -288,7 +289,7 @@ public class ExportAllAndImportAllTest extends ActivityInstrumentationTestCase2<
EndToEndTestUtils
.getButtonOnScreen(activityMyTracks.getString(R.string.generic_ok), true, true);
instrumentation.waitForIdleSync();
assertEquals(trackNumber + KMLFilesNumber, EndToEndTestUtils.SOLO.getCurrentListViews().get(0)
assertEquals(trackNumber + KMLFilesNumber, EndToEndTestUtils.SOLO.getCurrentViews(ListView.class).get(0)
.getCount());
}
@@ -1,3 +1,18 @@
/*
* Copyright 2012 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks.endtoendtest.common;
import com.google.android.apps.mytracks.TrackListActivity;
@@ -22,6 +22,7 @@ import com.google.android.maps.mytracks.R;
import android.app.Instrumentation;
import android.test.ActivityInstrumentationTestCase2;
import android.view.KeyEvent;
import android.widget.ListView;
/**
* Tests some menu items of MyTracks.
@@ -92,7 +93,7 @@ public class MenuItemsTest extends ActivityInstrumentationTestCase2<TrackListAct
EndToEndTestUtils.enterTextAvoidSoftKeyBoard(0, EndToEndTestUtils.trackName);
sendKeys(KeyEvent.KEYCODE_ENTER);
instrumentation.waitForIdleSync();
assertEquals(1, EndToEndTestUtils.SOLO.getCurrentListViews().size());
assertEquals(1, EndToEndTestUtils.SOLO.getCurrentViews(ListView.class).size());
EndToEndTestUtils.SOLO.goBack();
assertTrue(isControllerShown());
}
@@ -26,6 +26,7 @@ import android.app.Instrumentation;
import android.content.Context;
import android.test.ActivityInstrumentationTestCase2;
import android.widget.CheckBox;
import android.widget.ListView;
import java.util.ArrayList;
@@ -68,10 +69,10 @@ public class SettingTest extends ActivityInstrumentationTestCase2<TrackListActiv
instrumentation.waitForIdleSync();
// Rotate on a sub setting page.
EndToEndTestUtils.rotateAllActivities();
EndToEndTestUtils.rotateCurrentActivity();
EndToEndTestUtils.SOLO.waitForText(activityMyTracks
.getString(R.string.settings_stats_units_title));
ArrayList<CheckBox> displayCheckBoxs = EndToEndTestUtils.SOLO.getCurrentCheckBoxes();
ArrayList<CheckBox> displayCheckBoxs = EndToEndTestUtils.SOLO.getCurrentViews(CheckBox.class);
boolean useMetric = displayCheckBoxs.get(0).isChecked();
EndToEndTestUtils.SOLO.clickOnCheckBox(0);
instrumentation.waitForIdleSync();
@@ -82,7 +83,7 @@ public class SettingTest extends ActivityInstrumentationTestCase2<TrackListActiv
assertTrue(EndToEndTestUtils.SOLO.waitForText(
activityMyTracks.getString(R.string.settings_sharing_allow_access), 1,
EndToEndTestUtils.NORMAL_WAIT_TIME));
ArrayList<CheckBox> sharingCheckBoxs = EndToEndTestUtils.SOLO.getCurrentCheckBoxes();
ArrayList<CheckBox> sharingCheckBoxs = EndToEndTestUtils.SOLO.getCurrentViews(CheckBox.class);
boolean newMapsPublic = sharingCheckBoxs.get(0).isChecked();
EndToEndTestUtils.SOLO.clickOnCheckBox(0);
instrumentation.waitForIdleSync();
@@ -91,7 +92,7 @@ public class SettingTest extends ActivityInstrumentationTestCase2<TrackListActiv
EndToEndTestUtils.NORMAL_WAIT_TIME));
EndToEndTestUtils.SOLO.clickOnButton(activityMyTracks.getString(R.string.generic_yes));
instrumentation.waitForIdleSync();
assertEquals(!newMapsPublic, EndToEndTestUtils.SOLO.getCurrentCheckBoxes().get(0).isChecked());
assertEquals(!newMapsPublic, EndToEndTestUtils.SOLO.getCurrentViews(CheckBox.class).get(0).isChecked());
EndToEndTestUtils.SOLO.goBack();
// Reset all settings.
@@ -112,14 +113,14 @@ public class SettingTest extends ActivityInstrumentationTestCase2<TrackListActiv
assertTrue(EndToEndTestUtils.SOLO.waitForText(
activityMyTracks.getString(R.string.settings_stats_units_title), 1,
EndToEndTestUtils.LONG_WAIT_TIME));
displayCheckBoxs = EndToEndTestUtils.SOLO.getCurrentCheckBoxes();
displayCheckBoxs = EndToEndTestUtils.SOLO.getCurrentViews(CheckBox.class);
assertEquals(useMetric, displayCheckBoxs.get(0).isChecked());
EndToEndTestUtils.SOLO.goBack();
EndToEndTestUtils.SOLO.clickOnText(activityMyTracks.getString(R.string.settings_sharing));
EndToEndTestUtils.SOLO.waitForText(activityMyTracks
.getString(R.string.settings_sharing_allow_access));
sharingCheckBoxs = EndToEndTestUtils.SOLO.getCurrentCheckBoxes();
sharingCheckBoxs = EndToEndTestUtils.SOLO.getCurrentViews(CheckBox.class);
assertEquals(newMapsPublic, sharingCheckBoxs.get(0).isChecked());
}
@@ -239,7 +240,7 @@ public class SettingTest extends ActivityInstrumentationTestCase2<TrackListActiv
boolean isImperial = EndToEndTestUtils.findTextViewInView(activityMyTracks
.getString(R.string.settings_stats_units_imperial), EndToEndTestUtils.SOLO
.getCurrentListViews().get(0)) != null;
.getCurrentViews(ListView.class).get(0)) != null;
// Change preferred units.
EndToEndTestUtils.SOLO.clickOnText(activityMyTracks
@@ -287,10 +288,10 @@ public class SettingTest extends ActivityInstrumentationTestCase2<TrackListActiv
// Now there should be 2 backups.
instrumentation.waitForIdleSync();
assertEquals(2, EndToEndTestUtils.SOLO.getCurrentListViews().get(0).getCount());
assertEquals(2, EndToEndTestUtils.SOLO.getCurrentViews(ListView.class).get(0).getCount());
// Click the first one.
EndToEndTestUtils.SOLO.clickOnView(EndToEndTestUtils.SOLO.getCurrentListViews().get(0)
EndToEndTestUtils.SOLO.clickOnView(EndToEndTestUtils.SOLO.getCurrentViews(ListView.class).get(0)
.getChildAt(0));
assertTrue(EndToEndTestUtils.SOLO.waitForText(
activityMyTracks.getString(R.string.settings_backup_restore_success), 0,
@@ -308,7 +309,7 @@ public class SettingTest extends ActivityInstrumentationTestCase2<TrackListActiv
instrumentation.waitForIdleSync();
// Click the second one.
EndToEndTestUtils.SOLO.clickOnView(EndToEndTestUtils.SOLO.getCurrentListViews().get(0)
EndToEndTestUtils.SOLO.clickOnView(EndToEndTestUtils.SOLO.getCurrentViews(ListView.class).get(0)
.getChildAt(1));
assertTrue(EndToEndTestUtils.SOLO.waitForText(
activityMyTracks.getString(R.string.settings_backup_restore_success), 0,
@@ -67,7 +67,7 @@ public class ViewsTest extends ActivityInstrumentationTestCase2<TrackListActivit
EndToEndTestUtils.SOLO.clickOnText(EndToEndTestUtils.trackName, 1, true);
EndToEndTestUtils.SOLO.clickOnText(activityMyTracks.getString(R.string.track_detail_chart_tab));
EndToEndTestUtils.rotateAllActivities();
EndToEndTestUtils.rotateCurrentActivity();
assertTrue(EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_settings),
false));
@@ -81,7 +81,7 @@ public class ViewsTest extends ActivityInstrumentationTestCase2<TrackListActivit
false));
EndToEndTestUtils.SOLO.clickOnText(activityMyTracks.getString(R.string.track_detail_map_tab));
EndToEndTestUtils.rotateAllActivities();
EndToEndTestUtils.rotateCurrentActivity();
assertTrue(EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_settings),
false));
assertTrue(EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_map_layer),
@@ -122,14 +122,14 @@ public class ViewsTest extends ActivityInstrumentationTestCase2<TrackListActivit
*/
public void testTrackControllerPostion() {
checkTrackController();
EndToEndTestUtils.rotateAllActivities();
EndToEndTestUtils.rotateCurrentActivity();
instrumentation.waitForIdleSync();
checkTrackController();
EndToEndTestUtils.startRecording();
instrumentation.waitForIdleSync();
checkTrackController();
EndToEndTestUtils.rotateAllActivities();
EndToEndTestUtils.rotateCurrentActivity();
instrumentation.waitForIdleSync();
checkTrackController();
@@ -138,7 +138,7 @@ public class SensorTest extends ActivityInstrumentationTestCase2<TrackListActivi
EndToEndTestUtils.SOLO.clickOnText(trackListActivity
.getString(R.string.settings_sensor_bluetooth_sensor));
instrumentation.waitForIdleSync();
ArrayList<ListView> allListViews = EndToEndTestUtils.SOLO.getCurrentListViews();
ArrayList<ListView> allListViews = EndToEndTestUtils.SOLO.getCurrentViews(ListView.class);
int number = allListViews.get(0).getCount();
if (number > 0
&& EndToEndTestUtils.SOLO.waitForText(nameString, 1, EndToEndTestUtils.SHORT_WAIT_TIME)) {
@@ -23,6 +23,7 @@ import com.google.android.maps.mytracks.R;
import android.app.Instrumentation;
import android.test.ActivityInstrumentationTestCase2;
import android.util.Log;
import android.widget.ListView;
/**
* Stress test of MyTracks.
@@ -76,7 +77,7 @@ public class StressTest extends ActivityInstrumentationTestCase2<TrackListActivi
EndToEndTestUtils.stopRecording(true);
EndToEndTestUtils.SOLO.goBack();
EndToEndTestUtils.instrumentation.waitForIdleSync();
numberOfTracks = EndToEndTestUtils.SOLO.getCurrentListViews().get(0).getCount();
numberOfTracks = EndToEndTestUtils.SOLO.getCurrentViews(ListView.class).get(0).getCount();
if (numberOfTracks > MAX_TRACK_NUMBER) {
EndToEndTestUtils.deleteAllTracks();
}
@@ -24,6 +24,7 @@ import com.google.api.services.drive.Drive;
import android.app.Instrumentation;
import android.test.ActivityInstrumentationTestCase2;
import android.widget.ListView;
/**
* Tests the situation when user use multiple account in MyTracks.
@@ -115,7 +116,7 @@ public class MultiAccountsSyncTest extends ActivityInstrumentationTestCase2<Trac
EndToEndTestUtils.createSimpleTrack(0, true);
// Delete one track.
EndToEndTestUtils.SOLO.clickOnView(EndToEndTestUtils.SOLO.getCurrentListViews().get(0)
EndToEndTestUtils.SOLO.clickOnView(EndToEndTestUtils.SOLO.getCurrentViews(ListView.class).get(0)
.getChildAt(0));
EndToEndTestUtils.instrumentation.waitForIdleSync();
EndToEndTestUtils.SOLO.clickOnMenuItem(EndToEndTestUtils.activityMytracks
@@ -125,7 +126,7 @@ public class MultiAccountsSyncTest extends ActivityInstrumentationTestCase2<Trac
// Switch account and delete another track.
SyncTestUtils.enableSync(GoogleUtils.ACCOUNT_NAME_2);
EndToEndTestUtils.SOLO.clickOnView(EndToEndTestUtils.SOLO.getCurrentListViews().get(0)
EndToEndTestUtils.SOLO.clickOnView(EndToEndTestUtils.SOLO.getCurrentViews(ListView.class).get(0)
.getChildAt(0));
EndToEndTestUtils.SOLO.clickOnMenuItem(EndToEndTestUtils.activityMytracks
.getString(R.string.menu_delete));
@@ -35,6 +35,7 @@ import android.app.Instrumentation;
import android.content.Context;
import android.util.Log;
import android.widget.CheckBox;
import android.widget.ListView;
import java.io.BufferedReader;
import java.io.IOException;
@@ -199,7 +200,7 @@ public class SyncTestUtils {
EndToEndTestUtils.SOLO.waitForDialogToClose(EndToEndTestUtils.SHORT_WAIT_TIME);
EndToEndTestUtils.instrumentation.waitForIdleSync();
CheckBox syncCheckBox = EndToEndTestUtils.SOLO.getCurrentCheckBoxes().get(0);
CheckBox syncCheckBox = EndToEndTestUtils.SOLO.getCurrentViews(CheckBox.class).get(0);
if (!syncCheckBox.isChecked()) {
EndToEndTestUtils.SOLO.clickOnText(EndToEndTestUtils.activityMytracks
.getString(R.string.settings_google_drive_sync_title));
@@ -230,7 +231,7 @@ public class SyncTestUtils {
EndToEndTestUtils.sleep(EndToEndTestUtils.SHORT_WAIT_TIME);
EndToEndTestUtils.findMenuItem(
EndToEndTestUtils.activityMytracks.getString(R.string.menu_sync_now), true);
int trackNumber = EndToEndTestUtils.SOLO.getCurrentListViews().get(0).getCount();
int trackNumber = EndToEndTestUtils.SOLO.getCurrentViews(ListView.class).get(0).getCount();
List<File> files = getDriveFiles(
EndToEndTestUtils.activityMytracks.getApplicationContext(), drive);
if (files.size() == trackNumber) {
@@ -251,7 +252,7 @@ public class SyncTestUtils {
public static void checkTracksNumber(int number) {
long startTime = System.currentTimeMillis();
while (System.currentTimeMillis() - startTime < MAX_TIME_TO_WAIT_SYNC) {
int trackNumber = EndToEndTestUtils.SOLO.getCurrentListViews().get(0).getCount();
int trackNumber = EndToEndTestUtils.SOLO.getCurrentViews(ListView.class).get(0).getCount();
if (trackNumber == number) {
return;
}