forked from upstream-mirrors/OpenTracks
Move the code about checking status of GPS signal back to make the test runs well on real devices. Fix a warning in CreateAndSendTrackTest.
This commit is contained in:
+1
-2
@@ -262,9 +262,8 @@ public class CreateAndSendTrackTest extends ActivityInstrumentationTestCase2<Tra
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests whether the split marker is created as setting.
|
* Tests whether the split marker is created as setting.
|
||||||
* @throws InterruptedException
|
|
||||||
*/
|
*/
|
||||||
public void testSplitSetting() throws InterruptedException {
|
public void testSplitSetting() {
|
||||||
EndToEndTestUtils.startRecording();
|
EndToEndTestUtils.startRecording();
|
||||||
|
|
||||||
EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_split_frequency), true);
|
EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_split_frequency), true);
|
||||||
|
|||||||
+9
-10
@@ -215,24 +215,15 @@ public class EndToEndTestUtils {
|
|||||||
* @param activityMyTracks the startup activity
|
* @param activityMyTracks the startup activity
|
||||||
*/
|
*/
|
||||||
static void setupForAllTest(Instrumentation instrumentation, TrackListActivity activityMyTracks) {
|
static void setupForAllTest(Instrumentation instrumentation, TrackListActivity activityMyTracks) {
|
||||||
setIsEmulator();
|
|
||||||
|
|
||||||
EndToEndTestUtils.instrumentation = instrumentation;
|
EndToEndTestUtils.instrumentation = instrumentation;
|
||||||
EndToEndTestUtils.activityMytracks = activityMyTracks;
|
EndToEndTestUtils.activityMytracks = activityMyTracks;
|
||||||
SOLO = new Solo(EndToEndTestUtils.instrumentation,
|
SOLO = new Solo(EndToEndTestUtils.instrumentation,
|
||||||
EndToEndTestUtils.activityMytracks);
|
EndToEndTestUtils.activityMytracks);
|
||||||
|
|
||||||
// For emulator, we would fix GPS signal.
|
|
||||||
if(!isEmulator) {
|
|
||||||
GoToMyLocationTest.findAndClickMyLocation(activityMyTracks);
|
|
||||||
hasGpsSingal = !SOLO.waitForText(NO_GPS_MESSAGE_PREFIX, 1,
|
|
||||||
EndToEndTestUtils.SHORT_WAIT_TIME);
|
|
||||||
SOLO.goBack();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if open MyTracks first time after install. If so, there would be a
|
// Check if open MyTracks first time after install. If so, there would be a
|
||||||
// welcome view with accept buttons. And makes sure only check once.
|
// welcome view with accept buttons. And makes sure only check once.
|
||||||
if (!isCheckedFirstLaunch) {
|
if (!isCheckedFirstLaunch) {
|
||||||
|
setIsEmulator();
|
||||||
if ((getButtonOnScreen(EndToEndTestUtils.activityMytracks
|
if ((getButtonOnScreen(EndToEndTestUtils.activityMytracks
|
||||||
.getString(R.string.eula_accept), false, false) != null)) {
|
.getString(R.string.eula_accept), false, false) != null)) {
|
||||||
verifyFirstLaunch();
|
verifyFirstLaunch();
|
||||||
@@ -246,6 +237,14 @@ public class EndToEndTestUtils {
|
|||||||
isCheckedFirstLaunch = true;
|
isCheckedFirstLaunch = true;
|
||||||
deleteAllTracks();
|
deleteAllTracks();
|
||||||
resetAllSettings(activityMyTracks, false);
|
resetAllSettings(activityMyTracks, false);
|
||||||
|
|
||||||
|
// Check the status of real phone. For emulator, we would fix GPS signal.
|
||||||
|
if(!isEmulator) {
|
||||||
|
GoToMyLocationTest.findAndClickMyLocation(activityMyTracks);
|
||||||
|
hasGpsSingal = !SOLO.waitForText(NO_GPS_MESSAGE_PREFIX, 1,
|
||||||
|
EndToEndTestUtils.SHORT_WAIT_TIME);
|
||||||
|
SOLO.goBack();
|
||||||
|
}
|
||||||
} else if (SOLO.waitForText(
|
} else if (SOLO.waitForText(
|
||||||
// After reset setting, welcome page will show again.
|
// After reset setting, welcome page will show again.
|
||||||
activityMytracks.getString(R.string.welcome_title), 0, SHORT_WAIT_TIME)) {
|
activityMytracks.getString(R.string.welcome_title), 0, SHORT_WAIT_TIME)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user