forked from upstream-mirrors/OpenTracks
Fix an error of backup and restore e2e test.
This commit is contained in:
+25
-4
@@ -278,15 +278,36 @@ public class SettingTest extends ActivityInstrumentationTestCase2<TrackListActiv
|
|||||||
// Now there should be 2 backups.
|
// Now there should be 2 backups.
|
||||||
instrumentation.waitForIdleSync();
|
instrumentation.waitForIdleSync();
|
||||||
assertEquals(2, EndToEndTestUtils.SOLO.getCurrentListViews().get(0).getCount());
|
assertEquals(2, EndToEndTestUtils.SOLO.getCurrentListViews().get(0).getCount());
|
||||||
// Click the older one for the older one contains tracks and the newer backup is empty.
|
|
||||||
EndToEndTestUtils.SOLO.clickOnText(EndToEndTestUtils.SOLO.getCurrentListViews().get(0)
|
// Click the first one.
|
||||||
.getItemAtPosition(1).toString());
|
EndToEndTestUtils.SOLO.clickOnView(EndToEndTestUtils.SOLO.getCurrentListViews().get(0)
|
||||||
|
.getChildAt(0));
|
||||||
assertTrue(EndToEndTestUtils.SOLO.waitForText(
|
assertTrue(EndToEndTestUtils.SOLO.waitForText(
|
||||||
activityMyTracks.getString(R.string.settings_backup_restore_success), 0,
|
activityMyTracks.getString(R.string.settings_backup_restore_success), 0,
|
||||||
EndToEndTestUtils.SUPER_LONG_WAIT_TIME));
|
EndToEndTestUtils.SUPER_LONG_WAIT_TIME));
|
||||||
|
|
||||||
// Check restore track.
|
// Check restore track.
|
||||||
assertTrue(EndToEndTestUtils.SOLO.searchText(EndToEndTestUtils.trackName));
|
instrumentation.waitForIdleSync();
|
||||||
|
boolean isContainTrack = EndToEndTestUtils.SOLO.searchText(EndToEndTestUtils.trackName);
|
||||||
|
EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_settings), true);
|
||||||
|
EndToEndTestUtils.SOLO.clickOnText(activityMyTracks.getString(R.string.settings_backup_reset));
|
||||||
|
EndToEndTestUtils.SOLO
|
||||||
|
.clickOnText(activityMyTracks.getString(R.string.settings_backup_restore));
|
||||||
|
EndToEndTestUtils
|
||||||
|
.getButtonOnScreen(activityMyTracks.getString(R.string.generic_ok), true, true);
|
||||||
|
instrumentation.waitForIdleSync();
|
||||||
|
|
||||||
|
// Click the second one.
|
||||||
|
EndToEndTestUtils.SOLO.clickOnView(EndToEndTestUtils.SOLO.getCurrentListViews().get(0)
|
||||||
|
.getChildAt(1));
|
||||||
|
assertTrue(EndToEndTestUtils.SOLO.waitForText(
|
||||||
|
activityMyTracks.getString(R.string.settings_backup_restore_success), 0,
|
||||||
|
EndToEndTestUtils.SUPER_LONG_WAIT_TIME));
|
||||||
|
|
||||||
|
// For the older backup contains tracks and the newer backup is empty. The
|
||||||
|
// search result of twice must be different.
|
||||||
|
instrumentation.waitForIdleSync();
|
||||||
|
assertTrue(isContainTrack != EndToEndTestUtils.SOLO.searchText(EndToEndTestUtils.trackName));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user