mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-02 09:33:06 +02:00
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";
|
||||
// usually 5554.
|
||||
public static int emulatorPort = 5554;
|
||||
public static int emulatorPort = 5558;
|
||||
|
||||
private static final int ORIENTATION_PORTRAIT = 1;
|
||||
private static final int ORIENTATION_LANDSCAPE = 0;
|
||||
@@ -965,5 +965,15 @@ public class EndToEndTestUtils {
|
||||
}
|
||||
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() {
|
||||
boolean GPSStatus = EndToEndTestUtils.findMenuItem(
|
||||
activityMyTracks.getString(R.string.menu_stop_gps), false);
|
||||
|
||||
|
||||
// Following starting/stopping or stopping/starting GPS.
|
||||
EndToEndTestUtils.findMenuItem(GPSStatus ? activityMyTracks.getString(R.string.menu_stop_gps)
|
||||
: activityMyTracks.getString(R.string.menu_start_gps), true);
|
||||
GPSStatus = !GPSStatus;
|
||||
assertEquals(GPSStatus, EndToEndTestUtils.findMenuItem(
|
||||
activityMyTracks.getString(R.string.menu_stop_gps), false));
|
||||
|
||||
EndToEndTestUtils.waitTextToDisappear(GPSStatus ? activityMyTracks
|
||||
.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)
|
||||
: activityMyTracks.getString(R.string.menu_start_gps), true);
|
||||
GPSStatus = !GPSStatus;
|
||||
assertEquals(GPSStatus, EndToEndTestUtils.findMenuItem(
|
||||
activityMyTracks.getString(R.string.menu_stop_gps), false));
|
||||
EndToEndTestUtils.waitTextToDisappear(GPSStatus ? activityMyTracks
|
||||
.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
|
||||
|
||||
+2
-2
@@ -6,8 +6,8 @@ public class BigTestUtils {
|
||||
* Set to false as default. True to run the test. Default to false since this
|
||||
* test can take a long time.
|
||||
*/
|
||||
public static boolean runStressTest = false;
|
||||
public static boolean runSensorTest = false;
|
||||
public static boolean runStressTest = true;
|
||||
public static boolean runSensorTest = true;
|
||||
|
||||
|
||||
protected static final String DISABLE_MESSAGE = "This test is disabled";
|
||||
|
||||
Reference in New Issue
Block a user