Skip to content

Commit

Permalink
ALS-1690 E2E test cases fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
shah272728 committed Sep 29, 2023
1 parent 334ad43 commit 712544a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<ConstraintLayout>(R.id.bottom_sheet_search)
val mBottomSheetSearchPlaces: BottomSheetBehavior<ConstraintLayout> =
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(
Expand All @@ -96,16 +80,14 @@ 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)
// Start - Map provider change event test
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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class SettingsFragmentChangeDataProviderTest : BaseTestMainActivity() {
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) {
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -61,7 +63,7 @@ class AnalyticsHelper(
}
pinpointManager?.analyticsClient?.recordEvent(event)
val successConsumer = Consumer<List<AnalyticsEvent>> {
if (isRunningAnalyticsTest) {
if (isRunningAnalyticsTest && (eventName == MAP_PROVIDER_CHANGE || eventName == MAP_UNIT_CHANGE)) {
context.showError(eventName)
}
}
Expand Down

0 comments on commit 712544a

Please sign in to comment.