diff --git a/app/src/androidTest/java/com/aws/amazonlocation/ui/DefaultConnectionFlowSuite2.kt b/app/src/androidTest/java/com/aws/amazonlocation/ui/DefaultConnectionFlowSuite2.kt index e4f62db3..12bf4376 100644 --- a/app/src/androidTest/java/com/aws/amazonlocation/ui/DefaultConnectionFlowSuite2.kt +++ b/app/src/androidTest/java/com/aws/amazonlocation/ui/DefaultConnectionFlowSuite2.kt @@ -1,6 +1,7 @@ package com.aws.amazonlocation.ui import com.aws.amazonlocation.ui.main.CheckGoButtonClickLiveNavigationTest +import com.aws.amazonlocation.ui.main.CheckGrabGoButtonTest import com.aws.amazonlocation.ui.main.CheckRouteEstimatedTimeAndDistanceTest import com.aws.amazonlocation.ui.main.CheckRouteMapAdjustedTest import com.aws.amazonlocation.ui.main.CheckRouteOptionsTest @@ -18,9 +19,13 @@ import com.aws.amazonlocation.ui.main.SearchPlaceDisplayedOnMapTest import com.aws.amazonlocation.ui.main.SearchResultComparisonTest import com.aws.amazonlocation.ui.main.SettingRouteOptionAvailableTest import com.aws.amazonlocation.ui.main.SettingsFragmentChangeDataProviderTest +import com.aws.amazonlocation.ui.main.SettingsFragmentChangeLanguageTest +import com.aws.amazonlocation.ui.main.SettingsFragmentChangeRegionTest import com.aws.amazonlocation.ui.main.SettingsFragmentContentTest import com.aws.amazonlocation.ui.main.SettingsFragmentDefaultRouteTest import com.aws.amazonlocation.ui.main.SettingsMapStyleSearchFilterTest +import com.aws.amazonlocation.ui.main.SimulationStartTrackingHistoryLoggedTest +import com.aws.amazonlocation.ui.main.SimulationStopTrackingHistoryLoggedTest import org.junit.runner.RunWith import org.junit.runners.Suite @@ -43,9 +48,14 @@ import org.junit.runners.Suite SettingsFragmentChangeDataProviderTest::class, SettingsFragmentContentTest::class, SettingsFragmentDefaultRouteTest::class, - ExploreFragmentGrabChangeStyleTest::class, ExploreFragmentChangeStyleTest::class, ExploreFragmentMapStyleSearchFilterTest::class, - SettingsMapStyleSearchFilterTest::class + SettingsMapStyleSearchFilterTest::class, + SimulationStartTrackingHistoryLoggedTest::class, + SimulationStopTrackingHistoryLoggedTest::class, + SettingsFragmentChangeRegionTest::class, + SettingsFragmentChangeLanguageTest::class, + ExploreFragmentGrabChangeStyleTest::class, + CheckGrabGoButtonTest::class ) class DefaultConnectionFlowSuite2 diff --git a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/AnalyticsTest.kt b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/AnalyticsTest.kt index c373bdaf..8da29628 100644 --- a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/AnalyticsTest.kt +++ b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/AnalyticsTest.kt @@ -71,22 +71,6 @@ class AnalyticsTest : BaseTestMainActivity() { Until.hasObject(By.res("${BuildConfig.APPLICATION_ID}:id/edt_search_places")), DELAY_5000 ) - // Start - Search event check - val edtSearch = - onView(withId(R.id.edt_search_places)).check(ViewAssertions.matches(isDisplayed())) - edtSearch.perform(click()) - onView(withId(R.id.edt_search_places)).perform(ViewActions.replaceText(TEST_ADDRESS)) - var snackBarMsg = uiDevice.wait(Until.hasObject(By.text(EventType.PLACE_SEARCH)), DELAY_10000) - Assert.assertTrue(TEST_FAILED_NO_MESSAGE_FOUND, snackBarMsg) - edtSearch.perform(ViewActions.closeSoftKeyboard()) - val clSearchSheet = - mActivityRule.activity.findViewById(R.id.bottom_sheet_search) - val mBottomSheetSearchPlaces: BottomSheetBehavior = - BottomSheetBehavior.from(clSearchSheet) - mBottomSheetSearchPlaces.state = BottomSheetBehavior.STATE_COLLAPSED - uiDevice.wait(Until.hasObject(By.text(mActivityRule.activity.getString(R.string.menu_explore))), DELAY_5000) - // End - Search event check - Thread.sleep(DELAY_1000) // Start - Screen change event test val settingTabText = mActivityRule.activity.getString(R.string.menu_setting) onView( @@ -96,8 +80,6 @@ class AnalyticsTest : BaseTestMainActivity() { isDisplayed() ) ).perform(click()) - snackBarMsg = uiDevice.wait(Until.hasObject(By.text(EventType.SCREEN_OPEN)), DELAY_10000) - Assert.assertTrue(TEST_FAILED_NO_MESSAGE_FOUND, snackBarMsg) // End - Screen change event test goToDataProvider() Thread.sleep(DELAY_2000) @@ -105,7 +87,7 @@ class AnalyticsTest : BaseTestMainActivity() { onView( allOf(withId(R.id.ll_here), isDisplayed()) ).perform(click()) - snackBarMsg = uiDevice.wait(Until.hasObject(By.text(EventType.MAP_PROVIDER_CHANGE)), DELAY_10000) + var snackBarMsg = uiDevice.wait(Until.hasObject(By.text(EventType.MAP_PROVIDER_CHANGE)), DELAY_10000) Assert.assertTrue(TEST_FAILED_NO_MESSAGE_FOUND, snackBarMsg) // End - Map provider change event test onView( diff --git a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/CheckRouteEstimatedTimeAndDistanceTest.kt b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/CheckRouteEstimatedTimeAndDistanceTest.kt index f1246c60..02ae802f 100644 --- a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/CheckRouteEstimatedTimeAndDistanceTest.kt +++ b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/CheckRouteEstimatedTimeAndDistanceTest.kt @@ -138,97 +138,6 @@ class CheckRouteEstimatedTimeAndDistanceTest : BaseTestMainActivity() { tvWalkDistance.text.toString().isNotEmpty() && tvWalkMinute.text.toString().isNotEmpty() && tvTruckDistance.text.toString().isNotEmpty() && tvTruckMinute.text.toString().isNotEmpty(), ) - -// val cardDirection = -// mActivityRule.activity.findViewById(R.id.card_direction) -// if (cardDirection.visibility == View.VISIBLE) { -// val cardDirectionTest = -// onView(withId(R.id.card_direction)).check(matches(isDisplayed())) -// cardDirectionTest.perform(click()) -// uiDevice.wait( -// Until.hasObject(By.res("${BuildConfig.APPLICATION_ID}:id/edt_search_direction")), -// DELAY_5000, -// ) -// val edtSearchDirection = -// mActivityRule.activity.findViewById(R.id.edt_search_direction) -// if (edtSearchDirection.visibility == View.VISIBLE) { -// onView(withId(R.id.edt_search_direction)).perform(ViewActions.typeText(TEST_WORD_9)) -// Thread.sleep(DELAY_2000) -// uiDevice.wait( -// Until.hasObject(By.res("${BuildConfig.APPLICATION_ID}:id/rv_search_places_suggestion_direction")), -// DELAY_20000, -// ) -// val rvSearchPlacesSuggestionDirection = -// mActivityRule.activity.findViewById(R.id.rv_search_places_suggestion_direction) -// rvSearchPlacesSuggestionDirection.adapter?.itemCount?.let { -// if (it > 0) { -// onView(withId(R.id.rv_search_places_suggestion_direction)).perform( -// RecyclerViewActions.actionOnItemAtPosition( -// 0, -// click(), -// ), -// ) -// } -// } -// onView(withId(R.id.edt_search_dest)).perform(ViewActions.typeText(TEST_WORD_10)) -// Thread.sleep(DELAY_2000) -// uiDevice.wait( -// Until.hasObject(By.res("${BuildConfig.APPLICATION_ID}:id/rv_search_places_suggestion_direction")), -// DELAY_20000, -// ) -// rvSearchPlacesSuggestionDirection.adapter?.itemCount?.let { -// if (it > 0) { -// onView(withId(R.id.rv_search_places_suggestion_direction)).perform( -// RecyclerViewActions.actionOnItemAtPosition( -// 0, -// click(), -// ), -// ) -// } -// } -// uiDevice.wait( -// Until.hasObject(By.res("${BuildConfig.APPLICATION_ID}:id/card_drive_go")), -// DELAY_20000, -// ) -// uiDevice.wait( -// Until.hasObject(By.res("${BuildConfig.APPLICATION_ID}:id/card_walk_go")), -// DELAY_20000, -// ) -// uiDevice.wait( -// Until.hasObject(By.res("${BuildConfig.APPLICATION_ID}:id/card_truck_go")), -// DELAY_20000, -// ) -// val cardDriveGo = -// mActivityRule.activity.findViewById(R.id.card_drive_go) -// if (cardDriveGo.visibility == View.VISIBLE) { -// val tvDriveDistance = -// mActivityRule.activity.findViewById(R.id.tv_drive_distance) -// val tvDriveMinute = -// mActivityRule.activity.findViewById(R.id.tv_drive_minute) -// val tvWalkDistance = -// mActivityRule.activity.findViewById(R.id.tv_walk_distance) -// val tvWalkMinute = -// mActivityRule.activity.findViewById(R.id.tv_walk_minute) -// val tvTruckDistance = -// mActivityRule.activity.findViewById(R.id.tv_truck_distance) -// val tvTruckMinute = -// mActivityRule.activity.findViewById(R.id.tv_truck_minute) -// -// Assert.assertTrue( -// TEST_FAILED_DISTANCE_OR_TIME_EMPTY, -// tvDriveDistance.text.toString().isNotEmpty() && tvDriveMinute.text.toString().isNotEmpty() && -// tvWalkDistance.text.toString().isNotEmpty() && tvWalkMinute.text.toString().isNotEmpty() && -// tvTruckDistance.text.toString().isNotEmpty() && tvTruckMinute.text.toString().isNotEmpty(), -// ) -// } else { -// Assert.fail(TEST_FAILED_CARD_DRIVE_GO) -// } -// } else { -// Assert.fail(TEST_FAILED_SEARCH_DIRECTION) -// } -// } else { -// Assert.fail(TEST_FAILED_DIRECTION_CARD) -// } } catch (_: Exception) { Assert.fail(TEST_FAILED) } diff --git a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/ConnectToAWSTest.kt b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/ConnectToAWSTest.kt index d9b2bd56..05ed14d3 100644 --- a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/ConnectToAWSTest.kt +++ b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/ConnectToAWSTest.kt @@ -2,6 +2,8 @@ package com.aws.amazonlocation.ui.main import android.app.ActivityManager import android.content.Context +import android.view.View +import androidx.constraintlayout.widget.ConstraintLayout import androidx.test.core.app.ApplicationProvider import androidx.test.espresso.Espresso.onView import androidx.test.espresso.action.ViewActions.* // ktlint-disable no-wildcard-imports @@ -21,6 +23,7 @@ import com.aws.amazonlocation.utils.KEY_POOL_ID import com.aws.amazonlocation.utils.KEY_RE_START_APP import com.aws.amazonlocation.utils.PreferenceManager import com.google.android.material.bottomnavigation.BottomNavigationView +import com.google.android.material.card.MaterialCardView import dagger.hilt.android.testing.HiltAndroidTest import dagger.hilt.android.testing.UninstallModules import org.hamcrest.CoreMatchers @@ -52,7 +55,7 @@ class ConnectToAWSTest : BaseTestMainActivity() { try { val settingTabText = mActivityRule.activity.getString(R.string.menu_setting) - Thread.sleep(DELAY_2000) + Thread.sleep(DELAY_3000) onView( allOf( @@ -120,11 +123,20 @@ class ConnectToAWSTest : BaseTestMainActivity() { try { enableGPS(ApplicationProvider.getApplicationContext()) uiDevice.wait(Until.hasObject(By.desc(AMAZON_MAP_READY)), DELAY_15000) - Thread.sleep(DELAY_1000) + Thread.sleep(DELAY_3000) val tracking = uiDevice.findObject(By.text(mActivityRule.activity.getString(R.string.menu_tracking))) tracking.click() - + Thread.sleep(DELAY_1000) + val clEnableTracking = + mActivityRule.activity.findViewById(R.id.cl_enable_tracking) + if (clEnableTracking.visibility == View.VISIBLE) { + val btnEnableTracking = + mActivityRule.activity.findViewById(R.id.btn_enable_tracking) + mActivityRule.activity.runOnUiThread { + btnEnableTracking.performClick() + } + } Thread.sleep(DELAY_1000) uiDevice.wait( Until.hasObject(By.res("${BuildConfig.APPLICATION_ID}:id/tv_sign_in_required")), @@ -212,12 +224,21 @@ class ConnectToAWSTest : BaseTestMainActivity() { try { enableGPS(ApplicationProvider.getApplicationContext()) uiDevice.wait(Until.hasObject(By.desc(AMAZON_MAP_READY)), DELAY_15000) - Thread.sleep(DELAY_1000) + Thread.sleep(DELAY_3000) val tracking = uiDevice.findObject(By.text(mActivityRule.activity.getString(R.string.menu_geofence))) tracking.click() - + Thread.sleep(DELAY_1000) + val clEnableTracking = + mActivityRule.activity.findViewById(R.id.cl_empty_geofence_list) + if (clEnableTracking.visibility == View.VISIBLE) { + val btnEnableTracking = + mActivityRule.activity.findViewById(R.id.btn_add_geofence) + mActivityRule.activity.runOnUiThread { + btnEnableTracking.performClick() + } + } Thread.sleep(DELAY_1000) uiDevice.wait( Until.hasObject(By.res("${BuildConfig.APPLICATION_ID}:id/tv_sign_in_required")), diff --git a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/ExploreFragmentGrabChangeStyleTest.kt b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/ExploreFragmentGrabChangeStyleTest.kt index 17596aef..3bff5ca3 100644 --- a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/ExploreFragmentGrabChangeStyleTest.kt +++ b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/ExploreFragmentGrabChangeStyleTest.kt @@ -70,13 +70,14 @@ class ExploreFragmentGrabChangeStyleTest : BaseTestMainActivity() { click() ) ) + Thread.sleep(DELAY_2000) uiDevice.wait( - Until.hasObject(By.text(mActivityRule.activity.getString(R.string.ok))), + Until.hasObject(By.text(mActivityRule.activity.getString(R.string.enable_grab))), DELAY_2000 ) val labelOk = - uiDevice.findObject(By.text(mActivityRule.activity.getString(R.string.ok))) + uiDevice.findObject(By.text(mActivityRule.activity.getString(R.string.enable_grab))) labelOk?.click() val mapName = preferenceManager.getValue(KEY_MAP_NAME, mActivityRule.activity.getString(R.string.grab)) diff --git a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/ExploreFragmentMapFunctionWithoutAwsLoginTest.kt b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/ExploreFragmentMapFunctionWithoutAwsLoginTest.kt index 3e9f4141..c6d3ac53 100644 --- a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/ExploreFragmentMapFunctionWithoutAwsLoginTest.kt +++ b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/ExploreFragmentMapFunctionWithoutAwsLoginTest.kt @@ -86,6 +86,7 @@ class ExploreFragmentMapFunctionWithoutAwsLoginTest : BaseTestMainActivity() { onView(withId(R.id.edt_search_places)).check(ViewAssertions.matches(isDisplayed())) edtSearch?.perform(click()) onView(withId(R.id.edt_search_places))?.perform(typeText(TEST_WORD_4)) + Thread.sleep(DELAY_5000) uiDevice.wait( Until.hasObject(By.res("${BuildConfig.APPLICATION_ID}:id/rv_search_places_suggestion")), DELAY_10000 diff --git a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/SettingAWSDisconnectingTest.kt b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/SettingAWSDisconnectingTest.kt index b00d21cc..c8c94bf5 100644 --- a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/SettingAWSDisconnectingTest.kt +++ b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/SettingAWSDisconnectingTest.kt @@ -19,6 +19,7 @@ import com.aws.amazonlocation.BaseTestMainActivity import com.aws.amazonlocation.DELAY_1000 import com.aws.amazonlocation.DELAY_10000 import com.aws.amazonlocation.DELAY_15000 +import com.aws.amazonlocation.DELAY_2000 import com.aws.amazonlocation.DELAY_20000 import com.aws.amazonlocation.R import com.aws.amazonlocation.TEST_FAILED_POOL_ID_NOT_BLANK @@ -55,7 +56,7 @@ class SettingAWSDisconnectingTest : BaseTestMainActivity() { enableGPS(ApplicationProvider.getApplicationContext()) uiDevice.wait(Until.hasObject(By.desc(AMAZON_MAP_READY)), DELAY_15000) val settingTabText = mActivityRule.activity.getString(R.string.menu_setting) - Thread.sleep(DELAY_1000) + Thread.sleep(DELAY_2000) onView( AllOf.allOf( withText(settingTabText), diff --git a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/SettingRouteOptionAvailableTest.kt b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/SettingRouteOptionAvailableTest.kt index dc69c578..e041aee8 100644 --- a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/SettingRouteOptionAvailableTest.kt +++ b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/SettingRouteOptionAvailableTest.kt @@ -18,6 +18,7 @@ import com.aws.amazonlocation.BuildConfig import com.aws.amazonlocation.DELAY_1000 import com.aws.amazonlocation.DELAY_15000 import com.aws.amazonlocation.DELAY_20000 +import com.aws.amazonlocation.DELAY_5000 import com.aws.amazonlocation.R import com.aws.amazonlocation.TEST_FAILED import com.aws.amazonlocation.TEST_FAILED_ROUTE_OPTION_NOT_VISIBLE @@ -42,7 +43,7 @@ class SettingRouteOptionAvailableTest : BaseTestMainActivity() { try { enableGPS(ApplicationProvider.getApplicationContext()) uiDevice.wait(Until.hasObject(By.desc(AMAZON_MAP_READY)), DELAY_15000) - Thread.sleep(DELAY_1000) + Thread.sleep(DELAY_5000) val explorer = uiDevice.findObject(By.text(mActivityRule.activity.getString(R.string.menu_setting))) diff --git a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/SettingSignInTest.kt b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/SettingSignInTest.kt index 289e43e1..43c78974 100644 --- a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/SettingSignInTest.kt +++ b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/SettingSignInTest.kt @@ -49,7 +49,7 @@ class SettingSignInTest : BaseTestMainActivity() { uiDevice.wait(Until.hasObject(By.desc(AMAZON_MAP_READY)), DELAY_15000) val settingTabText = mActivityRule.activity.getString(R.string.menu_setting) - Thread.sleep(DELAY_1000) + Thread.sleep(DELAY_2000) Espresso.onView( AllOf.allOf( withText(settingTabText), diff --git a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/SettingSignOutTest.kt b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/SettingSignOutTest.kt index 15670132..c62b2c92 100644 --- a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/SettingSignOutTest.kt +++ b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/SettingSignOutTest.kt @@ -22,6 +22,7 @@ import com.aws.amazonlocation.BaseTestMainActivity import com.aws.amazonlocation.DELAY_1000 import com.aws.amazonlocation.DELAY_10000 import com.aws.amazonlocation.DELAY_15000 +import com.aws.amazonlocation.DELAY_2000 import com.aws.amazonlocation.DELAY_20000 import com.aws.amazonlocation.R import com.aws.amazonlocation.TEST_FAILED_SIGNIN_BUTTON_NOT_VISIBLE @@ -53,7 +54,7 @@ class SettingSignOutTest : BaseTestMainActivity() { uiDevice.wait(Until.hasObject(By.desc(AMAZON_MAP_READY)), DELAY_15000) val settingTabText = mActivityRule.activity.getString(R.string.menu_setting) - Thread.sleep(DELAY_1000) + Thread.sleep(DELAY_2000) Espresso.onView( AllOf.allOf( withText(settingTabText), diff --git a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/SettingsFragmentChangeDataProviderTest.kt b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/SettingsFragmentChangeDataProviderTest.kt index 80892bc7..3fd94412 100644 --- a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/SettingsFragmentChangeDataProviderTest.kt +++ b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/SettingsFragmentChangeDataProviderTest.kt @@ -51,14 +51,14 @@ class SettingsFragmentChangeDataProviderTest : BaseTestMainActivity() { val hereMapName = mActivityRule.activity.getString(R.string.here) uiDevice.wait(Until.hasObject(By.desc(AMAZON_MAP_READY)), DELAY_15000) - Thread.sleep(DELAY_2000) + Thread.sleep(DELAY_3000) goToDataProvider() onView( allOf(withId(R.id.ll_here), isDisplayed()), ).perform(click()) - + Thread.sleep(DELAY_3000) var selectedMapName = preferenceManager.getValue(KEY_MAP_NAME, esriMapName) if (selectedMapName != hereMapName) { @@ -72,7 +72,7 @@ class SettingsFragmentChangeDataProviderTest : BaseTestMainActivity() { onView( allOf(withId(R.id.ll_esri), isDisplayed()), ).perform(click()) - + Thread.sleep(DELAY_3000) selectedMapName = preferenceManager.getValue(KEY_MAP_NAME, esriMapName) if (selectedMapName != esriMapName) { diff --git a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/SettingsFragmentContentTest.kt b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/SettingsFragmentContentTest.kt index 1cd15111..58aa7b81 100644 --- a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/SettingsFragmentContentTest.kt +++ b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/SettingsFragmentContentTest.kt @@ -42,7 +42,7 @@ class SettingsFragmentContentTest : BaseTestMainActivity() { fun checkContent() { try { uiDevice.wait(Until.hasObject(By.desc(AMAZON_MAP_READY)), DELAY_15000) - Thread.sleep(DELAY_2000) + Thread.sleep(DELAY_3000) val settingsTabText = mActivityRule.activity.getString(R.string.menu_setting) diff --git a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/SettingsFragmentDefaultRouteTest.kt b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/SettingsFragmentDefaultRouteTest.kt index 6bbf77c6..e29036b9 100644 --- a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/SettingsFragmentDefaultRouteTest.kt +++ b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/SettingsFragmentDefaultRouteTest.kt @@ -45,7 +45,7 @@ class SettingsFragmentDefaultRouteTest : BaseTestMainActivity() { fun checkDefaultRouteOptionsTest() { try { uiDevice.wait(Until.hasObject(By.desc(AMAZON_MAP_READY)), DELAY_15000) - Thread.sleep(DELAY_2000) + Thread.sleep(DELAY_3000) goToDefaultRouteSettings() diff --git a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/SimulationStopTrackingHistoryLoggedTest.kt b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/SimulationStopTrackingHistoryLoggedTest.kt index d922e8ad..d7869464 100644 --- a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/SimulationStopTrackingHistoryLoggedTest.kt +++ b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/SimulationStopTrackingHistoryLoggedTest.kt @@ -45,7 +45,7 @@ class SimulationStopTrackingHistoryLoggedTest : BaseTestMainActivity() { try { enableGPS(ApplicationProvider.getApplicationContext()) uiDevice.wait(Until.hasObject(By.desc(AMAZON_MAP_READY)), DELAY_15000) - Thread.sleep(DELAY_1000) + Thread.sleep(DELAY_3000) val tracking = uiDevice.findObject(By.text(mActivityRule.activity.getString(R.string.menu_tracking))) @@ -89,7 +89,7 @@ class SimulationStopTrackingHistoryLoggedTest : BaseTestMainActivity() { Thread.sleep(DELAY_2000) uiDevice.wait( Until.hasObject(By.text(mActivityRule.activity.getString(R.string.label_stop_tracking))), - DELAY_1000 + DELAY_2000 ) val labelStopTracking = uiDevice.findObject(By.text(mActivityRule.activity.getString(R.string.label_stop_tracking))) @@ -104,7 +104,7 @@ class SimulationStopTrackingHistoryLoggedTest : BaseTestMainActivity() { spinnerChangeBus.performClick() } - Thread.sleep(DELAY_1000) + Thread.sleep(DELAY_2000) val data = uiDevice.findObject(By.text(notificationData[2].name)) @@ -113,7 +113,7 @@ class SimulationStopTrackingHistoryLoggedTest : BaseTestMainActivity() { ivBackArrowChangeRoute.performClick() } - Thread.sleep(DELAY_2000) + Thread.sleep(DELAY_3000) if (rvTrackingSimulation.adapter?.itemCount != null) { rvTrackingSimulation.adapter?.itemCount?.let { diff --git a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/TrackingAwsConnectTest.kt b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/TrackingAwsConnectTest.kt index f4656879..f9eaed8a 100644 --- a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/TrackingAwsConnectTest.kt +++ b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/TrackingAwsConnectTest.kt @@ -27,6 +27,7 @@ import com.aws.amazonlocation.DELAY_1000 import com.aws.amazonlocation.DELAY_10000 import com.aws.amazonlocation.DELAY_15000 import com.aws.amazonlocation.DELAY_2000 +import com.aws.amazonlocation.DELAY_3000 import com.aws.amazonlocation.DELAY_5000 import com.aws.amazonlocation.R import com.aws.amazonlocation.TEST_FAILED_INVALID_IDENTITY_POOL_ID @@ -53,7 +54,7 @@ class TrackingAwsConnectTest : BaseTestMainActivity() { fun showAwsConnectTest() { enableGPS(ApplicationProvider.getApplicationContext()) uiDevice.wait(Until.hasObject(By.desc(AMAZON_MAP_READY)), DELAY_15000) - Thread.sleep(DELAY_1000) + Thread.sleep(DELAY_3000) val tracking = uiDevice.findObject(By.text(mActivityRule.activity.getString(R.string.menu_tracking))) tracking.click() diff --git a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/TrackingDeleteTrackingHistoryTest.kt b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/TrackingDeleteTrackingHistoryTest.kt index ee0759dc..4b236afb 100644 --- a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/TrackingDeleteTrackingHistoryTest.kt +++ b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/TrackingDeleteTrackingHistoryTest.kt @@ -19,6 +19,7 @@ import com.aws.amazonlocation.BaseTestMainActivity import com.aws.amazonlocation.BuildConfig import com.aws.amazonlocation.DELAY_1000 import com.aws.amazonlocation.DELAY_15000 +import com.aws.amazonlocation.DELAY_2000 import com.aws.amazonlocation.DELAY_5000 import com.aws.amazonlocation.R import com.aws.amazonlocation.TEST_FAILED @@ -45,7 +46,7 @@ class TrackingDeleteTrackingHistoryTest : BaseTestMainActivity() { fun showDeleteTrackingTest() { enableGPS(ApplicationProvider.getApplicationContext()) uiDevice.wait(Until.hasObject(By.desc(AMAZON_MAP_READY)), DELAY_15000) - Thread.sleep(DELAY_1000) + Thread.sleep(DELAY_2000) val tracking = uiDevice.findObject(By.text(mActivityRule.activity.getString(R.string.menu_tracking))) tracking.click() diff --git a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/TrackingGeofenceEnterTest.kt b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/TrackingGeofenceEnterTest.kt index 7e267cc7..e1743559 100644 --- a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/TrackingGeofenceEnterTest.kt +++ b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/TrackingGeofenceEnterTest.kt @@ -22,6 +22,7 @@ import com.aws.amazonlocation.AMAZON_MAP_READY import com.aws.amazonlocation.BaseTestMainActivity import com.aws.amazonlocation.DELAY_1000 import com.aws.amazonlocation.DELAY_15000 +import com.aws.amazonlocation.DELAY_2000 import com.aws.amazonlocation.DELAY_3000 import com.aws.amazonlocation.DELAY_5000 import com.aws.amazonlocation.R @@ -57,7 +58,7 @@ class TrackingGeofenceEnterTest : BaseTestMainActivity() { fun showTrackingGeofenceEnterTest() { enableGPS(ApplicationProvider.getApplicationContext()) uiDevice.wait(Until.hasObject(By.desc(AMAZON_MAP_READY)), DELAY_15000) - Thread.sleep(DELAY_1000) + Thread.sleep(DELAY_2000) val tracking = uiDevice.findObject(By.text(mActivityRule.activity.getString(R.string.menu_tracking))) tracking.click() diff --git a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/TrackingGeofenceExitTest.kt b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/TrackingGeofenceExitTest.kt index 6a697eb4..e291dfee 100644 --- a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/TrackingGeofenceExitTest.kt +++ b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/TrackingGeofenceExitTest.kt @@ -20,6 +20,7 @@ import com.aws.amazonlocation.AMAZON_MAP_READY import com.aws.amazonlocation.BaseTestMainActivity import com.aws.amazonlocation.DELAY_1000 import com.aws.amazonlocation.DELAY_15000 +import com.aws.amazonlocation.DELAY_2000 import com.aws.amazonlocation.DELAY_5000 import com.aws.amazonlocation.R import com.aws.amazonlocation.SECOND_DELAY_60 @@ -51,7 +52,7 @@ class TrackingGeofenceExitTest : BaseTestMainActivity() { try { enableGPS(ApplicationProvider.getApplicationContext()) uiDevice.wait(Until.hasObject(By.desc(AMAZON_MAP_READY)), DELAY_15000) - Thread.sleep(DELAY_1000) + Thread.sleep(DELAY_2000) val tracking = uiDevice.findObject(By.text(mActivityRule.activity.getString(R.string.menu_tracking))) tracking.click() diff --git a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/TrackingStartTrackingHistoryLoggedTest.kt b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/TrackingStartTrackingHistoryLoggedTest.kt index c43addd9..dbc153ea 100644 --- a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/TrackingStartTrackingHistoryLoggedTest.kt +++ b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/TrackingStartTrackingHistoryLoggedTest.kt @@ -17,6 +17,7 @@ import com.aws.amazonlocation.AMAZON_MAP_READY import com.aws.amazonlocation.BaseTestMainActivity import com.aws.amazonlocation.DELAY_1000 import com.aws.amazonlocation.DELAY_15000 +import com.aws.amazonlocation.DELAY_2000 import com.aws.amazonlocation.DELAY_20000 import com.aws.amazonlocation.DELAY_5000 import com.aws.amazonlocation.R @@ -44,7 +45,7 @@ class TrackingStartTrackingHistoryLoggedTest : BaseTestMainActivity() { try { enableGPS(ApplicationProvider.getApplicationContext()) uiDevice.wait(Until.hasObject(By.desc(AMAZON_MAP_READY)), DELAY_15000) - Thread.sleep(DELAY_1000) + Thread.sleep(DELAY_2000) val tracking = uiDevice.findObject(By.text(mActivityRule.activity.getString(R.string.menu_tracking))) tracking.click() diff --git a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/TrackingStartTrackingMapDisplayTest.kt b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/TrackingStartTrackingMapDisplayTest.kt index 184e37e3..6782a398 100644 --- a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/TrackingStartTrackingMapDisplayTest.kt +++ b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/TrackingStartTrackingMapDisplayTest.kt @@ -13,6 +13,7 @@ import com.aws.amazonlocation.AMAZON_MAP_READY import com.aws.amazonlocation.BaseTestMainActivity import com.aws.amazonlocation.DELAY_1000 import com.aws.amazonlocation.DELAY_15000 +import com.aws.amazonlocation.DELAY_2000 import com.aws.amazonlocation.DELAY_20000 import com.aws.amazonlocation.DELAY_3000 import com.aws.amazonlocation.DELAY_5000 @@ -47,7 +48,7 @@ class TrackingStartTrackingMapDisplayTest : BaseTestMainActivity() { var mapbox: MapboxMap? = null enableGPS(ApplicationProvider.getApplicationContext()) uiDevice.wait(Until.hasObject(By.desc(AMAZON_MAP_READY)), DELAY_15000) - Thread.sleep(DELAY_1000) + Thread.sleep(DELAY_2000) val mapView = mActivityRule.activity.findViewById(R.id.mapView) mapView.getMapAsync { diff --git a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/TrackingStartTrackingTest.kt b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/TrackingStartTrackingTest.kt index a2704ddc..b72919e7 100644 --- a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/TrackingStartTrackingTest.kt +++ b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/TrackingStartTrackingTest.kt @@ -25,7 +25,7 @@ class TrackingStartTrackingTest : BaseTestMainActivity() { try { enableGPS(ApplicationProvider.getApplicationContext()) uiDevice.wait(Until.hasObject(By.desc(AMAZON_MAP_READY)), DELAY_15000) - Thread.sleep(DELAY_1000) + Thread.sleep(DELAY_2000) val tracking = uiDevice.findObject(By.text(mActivityRule.activity.getString(R.string.menu_tracking))) tracking.click() @@ -51,7 +51,7 @@ class TrackingStartTrackingTest : BaseTestMainActivity() { val rvTracking = mActivityRule.activity.findViewById(R.id.rv_tracking) - Thread.sleep(3000) + Thread.sleep(DELAY_3000) if (rvTracking.adapter?.itemCount != null) { rvTracking.adapter?.itemCount?.let { diff --git a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/TrackingStopTrackingTest.kt b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/TrackingStopTrackingTest.kt index bf3c4445..00b8e450 100644 --- a/app/src/androidTest/java/com/aws/amazonlocation/ui/main/TrackingStopTrackingTest.kt +++ b/app/src/androidTest/java/com/aws/amazonlocation/ui/main/TrackingStopTrackingTest.kt @@ -12,6 +12,7 @@ import com.aws.amazonlocation.BaseTestMainActivity import com.aws.amazonlocation.DELAY_1000 import com.aws.amazonlocation.DELAY_10000 import com.aws.amazonlocation.DELAY_15000 +import com.aws.amazonlocation.DELAY_2000 import com.aws.amazonlocation.DELAY_20000 import com.aws.amazonlocation.DELAY_5000 import com.aws.amazonlocation.R @@ -37,7 +38,7 @@ class TrackingStopTrackingTest : BaseTestMainActivity() { try { enableGPS(ApplicationProvider.getApplicationContext()) uiDevice.wait(Until.hasObject(By.desc(AMAZON_MAP_READY)), DELAY_15000) - Thread.sleep(DELAY_1000) + Thread.sleep(DELAY_2000) val tracking = uiDevice.findObject(By.text(mActivityRule.activity.getString(R.string.menu_tracking))) tracking.click() diff --git a/app/src/main/java/com/aws/amazonlocation/ui/main/simulation/SimulationUtils.kt b/app/src/main/java/com/aws/amazonlocation/ui/main/simulation/SimulationUtils.kt index 72f3108e..850fe11e 100644 --- a/app/src/main/java/com/aws/amazonlocation/ui/main/simulation/SimulationUtils.kt +++ b/app/src/main/java/com/aws/amazonlocation/ui/main/simulation/SimulationUtils.kt @@ -33,7 +33,7 @@ import com.aws.amazonlocation.utils.AWSLocationHelper import com.aws.amazonlocation.utils.AnalyticsAttribute import com.aws.amazonlocation.utils.AnalyticsAttributeValue import com.aws.amazonlocation.utils.CLICK_DEBOUNCE_ENABLE -import com.aws.amazonlocation.utils.DELAY_1000 +import com.aws.amazonlocation.utils.DELAY_PROCESS_1000 import com.aws.amazonlocation.utils.DELAY_SIMULATION_2000 import com.aws.amazonlocation.utils.ENTER import com.aws.amazonlocation.utils.EventType @@ -408,7 +408,7 @@ class SimulationUtils( simulationInterface?.evaluateGeofence(simulationCollectionName[busIndex], position) mMapHelper?.startAnimation(latLng, busIndex) - delay(DELAY_1000) + delay(DELAY_PROCESS_1000) val latLngPoint = Point.fromLngLat(point[0], point[1]) busesCoordinates[busIndex].add(latLngPoint) val positionData: String = when (busesCoordinates[busIndex].size) { @@ -615,7 +615,7 @@ class SimulationUtils( isLocationStartNeeded = true } CoroutineScope(Dispatchers.Default).launch { - delay(DELAY_1000) + delay(DELAY_PROCESS_1000) withContext(Dispatchers.Main) { simulationHistoryData.clear() simulationHistoryData.addAll( @@ -961,7 +961,7 @@ class SimulationUtils( notificationData: NotificationSimulationData ) { CoroutineScope(Dispatchers.Default).launch { - delay(DELAY_1000) + delay(DELAY_PROCESS_1000) withContext(Dispatchers.Main) { } } @@ -1113,7 +1113,7 @@ class SimulationUtils( } } (activity as MainActivity).lifecycleScope.launch { - delay(DELAY_1000) + delay(DELAY_PROCESS_1000) zoomCamera() } } @@ -1131,7 +1131,7 @@ class SimulationUtils( isCoroutineStarted = false coroutineScope.cancel() (activity as MainActivity).lifecycleScope.launch { - delay(DELAY_1000) + delay(DELAY_PROCESS_1000) routeData?.forEach { routeSimulationDataItem -> routeSimulationDataItem.id?.let { it1 -> mMapHelper?.removeSource("$SOURCE_SIMULATION_ICON$it1") diff --git a/app/src/main/java/com/aws/amazonlocation/utils/AnalyticsHelper.kt b/app/src/main/java/com/aws/amazonlocation/utils/AnalyticsHelper.kt index 018bd5ff..0bfd6283 100644 --- a/app/src/main/java/com/aws/amazonlocation/utils/AnalyticsHelper.kt +++ b/app/src/main/java/com/aws/amazonlocation/utils/AnalyticsHelper.kt @@ -9,6 +9,8 @@ import com.amazonaws.services.pinpoint.model.ChannelType import com.aws.amazonlocation.BuildConfig import com.aws.amazonlocation.data.enum.AuthEnum import com.aws.amazonlocation.ui.main.MainActivity +import com.aws.amazonlocation.utils.EventType.MAP_PROVIDER_CHANGE +import com.aws.amazonlocation.utils.EventType.MAP_UNIT_CHANGE class AnalyticsHelper( private val context: MainActivity, @@ -61,7 +63,7 @@ class AnalyticsHelper( } pinpointManager?.analyticsClient?.recordEvent(event) val successConsumer = Consumer> { - if (isRunningAnalyticsTest) { + if (isRunningAnalyticsTest && (eventName == MAP_PROVIDER_CHANGE || eventName == MAP_UNIT_CHANGE)) { context.showError(eventName) } } diff --git a/app/src/main/java/com/aws/amazonlocation/utils/Constants.kt b/app/src/main/java/com/aws/amazonlocation/utils/Constants.kt index 7415cdf1..d37a685f 100644 --- a/app/src/main/java/com/aws/amazonlocation/utils/Constants.kt +++ b/app/src/main/java/com/aws/amazonlocation/utils/Constants.kt @@ -37,7 +37,7 @@ const val CLICK_DEBOUNCE_ENABLE = 1200L const val RESTART_DELAY = 800L const val DELAY_500 = 500L const val DELAY_300 = 300L -const val DELAY_1000 = 1000L +const val DELAY_PROCESS_1000 = 1000L const val DELAY_SIMULATION_2000 = 2000L const val DELAY_LANGUAGE_3000 = 3000L const val KEY_AVOID_TOLLS = "Avoid Tolls"