forked from upstream-mirrors/OpenTracks
Fix an error about testGPSMenu. Add a method waitTextToDisappear in EndToEndTestUtils.
This commit is contained in:
+11
-1
@@ -56,7 +56,7 @@ public class EndToEndTestUtils {
|
|||||||
|
|
||||||
private static final String ANDROID_LOCAL_IP = "10.0.2.2";
|
private static final String ANDROID_LOCAL_IP = "10.0.2.2";
|
||||||
// usually 5554.
|
// usually 5554.
|
||||||
public static int emulatorPort = 5554;
|
public static int emulatorPort = 5558;
|
||||||
|
|
||||||
private static final int ORIENTATION_PORTRAIT = 1;
|
private static final int ORIENTATION_PORTRAIT = 1;
|
||||||
private static final int ORIENTATION_LANDSCAPE = 0;
|
private static final int ORIENTATION_LANDSCAPE = 0;
|
||||||
@@ -965,5 +965,15 @@ public class EndToEndTestUtils {
|
|||||||
}
|
}
|
||||||
SOLO.goBack();
|
SOLO.goBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Waits a text to disappear.
|
||||||
|
*/
|
||||||
|
public static void waitTextToDisappear(String text) {
|
||||||
|
// The first wait should longer than following waits.
|
||||||
|
SOLO.waitForText(text, 1, SHORT_WAIT_TIME);
|
||||||
|
while (SOLO.waitForText(text, 1, 200)) {}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -190,19 +190,23 @@ public class MenuItemsTest extends ActivityInstrumentationTestCase2<TrackListAct
|
|||||||
public void testGPSMenu() {
|
public void testGPSMenu() {
|
||||||
boolean GPSStatus = EndToEndTestUtils.findMenuItem(
|
boolean GPSStatus = EndToEndTestUtils.findMenuItem(
|
||||||
activityMyTracks.getString(R.string.menu_stop_gps), false);
|
activityMyTracks.getString(R.string.menu_stop_gps), false);
|
||||||
|
|
||||||
// Following starting/stopping or stopping/starting GPS.
|
// Following starting/stopping or stopping/starting GPS.
|
||||||
EndToEndTestUtils.findMenuItem(GPSStatus ? activityMyTracks.getString(R.string.menu_stop_gps)
|
EndToEndTestUtils.findMenuItem(GPSStatus ? activityMyTracks.getString(R.string.menu_stop_gps)
|
||||||
: activityMyTracks.getString(R.string.menu_start_gps), true);
|
: activityMyTracks.getString(R.string.menu_start_gps), true);
|
||||||
GPSStatus = !GPSStatus;
|
GPSStatus = !GPSStatus;
|
||||||
assertEquals(GPSStatus, EndToEndTestUtils.findMenuItem(
|
EndToEndTestUtils.waitTextToDisappear(GPSStatus ? activityMyTracks
|
||||||
activityMyTracks.getString(R.string.menu_stop_gps), false));
|
.getString(R.string.menu_start_gps) : activityMyTracks.getString(R.string.menu_stop_gps));
|
||||||
|
assertEquals(GPSStatus,
|
||||||
|
EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_stop_gps), false));
|
||||||
|
|
||||||
EndToEndTestUtils.findMenuItem(GPSStatus ? activityMyTracks.getString(R.string.menu_stop_gps)
|
EndToEndTestUtils.findMenuItem(GPSStatus ? activityMyTracks.getString(R.string.menu_stop_gps)
|
||||||
: activityMyTracks.getString(R.string.menu_start_gps), true);
|
: activityMyTracks.getString(R.string.menu_start_gps), true);
|
||||||
GPSStatus = !GPSStatus;
|
GPSStatus = !GPSStatus;
|
||||||
assertEquals(GPSStatus, EndToEndTestUtils.findMenuItem(
|
EndToEndTestUtils.waitTextToDisappear(GPSStatus ? activityMyTracks
|
||||||
activityMyTracks.getString(R.string.menu_stop_gps), false));
|
.getString(R.string.menu_start_gps) : activityMyTracks.getString(R.string.menu_stop_gps));
|
||||||
|
assertEquals(GPSStatus,
|
||||||
|
EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_stop_gps), false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+2
-2
@@ -6,8 +6,8 @@ public class BigTestUtils {
|
|||||||
* Set to false as default. True to run the test. Default to false since this
|
* Set to false as default. True to run the test. Default to false since this
|
||||||
* test can take a long time.
|
* test can take a long time.
|
||||||
*/
|
*/
|
||||||
public static boolean runStressTest = false;
|
public static boolean runStressTest = true;
|
||||||
public static boolean runSensorTest = false;
|
public static boolean runSensorTest = true;
|
||||||
|
|
||||||
|
|
||||||
protected static final String DISABLE_MESSAGE = "This test is disabled";
|
protected static final String DISABLE_MESSAGE = "This test is disabled";
|
||||||
|
|||||||
Reference in New Issue
Block a user