-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ALS-1885 Update place popup to show new information (#96)
* fix: reverse geocode and direction button should not work if only data is pulled bug fixes fix: Two bottom sheet opening fixes with code optimization refactor: Auth SDK version update with related code changes ALS-1882 * fix: App should work without no data inside custom.properties file ALS-1884 * feat: Places popup updated with new information ALS-1885 * feat: code optimize ALS-1885 --------- Co-authored-by: shah <[email protected]>
- Loading branch information
1 parent
d7b035c
commit a0abe8b
Showing
54 changed files
with
1,863 additions
and
416 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
117 changes: 117 additions & 0 deletions
117
app/src/androidTest/java/com/aws/amazonlocation/ui/main/SearchContactInfoPOICardTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
package com.aws.amazonlocation.ui.main | ||
|
||
import android.view.View | ||
import androidx.appcompat.widget.AppCompatTextView | ||
import androidx.recyclerview.widget.RecyclerView | ||
import androidx.recyclerview.widget.RecyclerView.ViewHolder | ||
import androidx.test.core.app.ApplicationProvider | ||
import androidx.test.espresso.Espresso.onView | ||
import androidx.test.espresso.action.ViewActions.click | ||
import androidx.test.espresso.action.ViewActions.replaceText | ||
import androidx.test.espresso.assertion.ViewAssertions.matches | ||
import androidx.test.espresso.contrib.RecyclerViewActions | ||
import androidx.test.espresso.matcher.ViewMatchers.hasDescendant | ||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed | ||
import androidx.test.espresso.matcher.ViewMatchers.withId | ||
import androidx.test.espresso.matcher.ViewMatchers.withText | ||
import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation | ||
import androidx.test.uiautomator.By | ||
import androidx.test.uiautomator.UiDevice | ||
import androidx.test.uiautomator.UiSelector | ||
import androidx.test.uiautomator.Until | ||
import com.aws.amazonlocation.ALLOW | ||
import com.aws.amazonlocation.AMAZON_MAP_READY | ||
import com.aws.amazonlocation.BaseTestMainActivity | ||
import com.aws.amazonlocation.BuildConfig | ||
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 | ||
import com.aws.amazonlocation.TEST_FAILED_NO_SEARCH_RESULT | ||
import com.aws.amazonlocation.TEST_FAILED_PLACE_LINK_NOT_VISIBLE | ||
import com.aws.amazonlocation.TEST_WORD_DOMINO_PIZZA | ||
import com.aws.amazonlocation.TEST_WORD_DOMINO_PIZZA_VEJALPUR | ||
import com.aws.amazonlocation.WHILE_USING_THE_APP | ||
import com.aws.amazonlocation.WHILE_USING_THE_APP_ALLOW | ||
import com.aws.amazonlocation.WHILE_USING_THE_APP_CAPS | ||
import com.aws.amazonlocation.di.AppModule | ||
import com.aws.amazonlocation.enableGPS | ||
import com.aws.amazonlocation.failTest | ||
import com.google.android.material.card.MaterialCardView | ||
import dagger.hilt.android.testing.HiltAndroidTest | ||
import dagger.hilt.android.testing.UninstallModules | ||
import org.junit.Assert | ||
import org.junit.Test | ||
|
||
@UninstallModules(AppModule::class) | ||
@HiltAndroidTest | ||
class SearchContactInfoPOICardTest : BaseTestMainActivity() { | ||
|
||
private val uiDevice = UiDevice.getInstance(getInstrumentation()) | ||
|
||
@Test | ||
fun searchContactInfoPOICardTest() { | ||
try { | ||
val btnContinueToApp = uiDevice.findObject(UiSelector().resourceId("${BuildConfig.APPLICATION_ID}:id/btn_continue_to_app")) | ||
if (btnContinueToApp.exists()) { | ||
btnContinueToApp.click() | ||
Thread.sleep(DELAY_2000) | ||
} | ||
uiDevice.findObject(By.text(WHILE_USING_THE_APP))?.click() | ||
uiDevice.findObject(By.text(WHILE_USING_THE_APP_CAPS))?.click() | ||
uiDevice.findObject(By.text(WHILE_USING_THE_APP_ALLOW))?.click() | ||
uiDevice.findObject(By.text(ALLOW))?.click() | ||
Thread.sleep(DELAY_2000) | ||
enableGPS(ApplicationProvider.getApplicationContext()) | ||
uiDevice.wait(Until.hasObject(By.desc(AMAZON_MAP_READY)), DELAY_15000) | ||
Thread.sleep(DELAY_2000) | ||
|
||
val edtSearch = | ||
onView(withId(R.id.edt_search_places)).check(matches(isDisplayed())) | ||
edtSearch.perform(click()) | ||
onView(withId(R.id.edt_search_places)).perform(replaceText(TEST_WORD_DOMINO_PIZZA_VEJALPUR)) | ||
uiDevice.wait( | ||
Until.hasObject(By.res("${BuildConfig.APPLICATION_ID}:id/rv_search_places_suggestion")), | ||
DELAY_20000 | ||
) | ||
getInstrumentation().waitForIdleSync() | ||
val rvSearchPlaceSuggestion = | ||
mActivityRule.activity.findViewById<RecyclerView>(R.id.rv_search_places_suggestion) | ||
if (rvSearchPlaceSuggestion.adapter?.itemCount != null) { | ||
rvSearchPlaceSuggestion.adapter?.itemCount?.let { | ||
if (it >= 0) { | ||
Thread.sleep(DELAY_2000) | ||
onView(withId(R.id.rv_search_places_suggestion)) | ||
.check(matches(hasDescendant(withText(TEST_WORD_DOMINO_PIZZA)))) | ||
Thread.sleep(DELAY_2000) | ||
onView(withId(R.id.rv_search_places_suggestion)) | ||
.perform(RecyclerViewActions.actionOnItem<ViewHolder>(hasDescendant(withText(TEST_WORD_DOMINO_PIZZA)), click())) | ||
Thread.sleep(DELAY_2000) | ||
val btnDirection = | ||
mActivityRule.activity.findViewById<MaterialCardView>(R.id.btn_direction) | ||
if (btnDirection.visibility == View.VISIBLE) { | ||
uiDevice.wait( | ||
Until.hasObject(By.res("${BuildConfig.APPLICATION_ID}:id/tv_direction_distance")), | ||
DELAY_20000, | ||
) | ||
val tvPlaceLink = | ||
mActivityRule.activity.findViewById<AppCompatTextView>(R.id.tv_place_link) | ||
Thread.sleep(DELAY_2000) | ||
Assert.assertTrue(TEST_FAILED_PLACE_LINK_NOT_VISIBLE, tvPlaceLink.visibility == View.VISIBLE) | ||
} else { | ||
Assert.fail() | ||
} | ||
} else { | ||
Assert.fail(TEST_FAILED_NO_SEARCH_RESULT) | ||
} | ||
} | ||
} else { | ||
Assert.fail(TEST_FAILED_NO_SEARCH_RESULT) | ||
} | ||
} catch (e: Exception) { | ||
failTest(107, e) | ||
Assert.fail(TEST_FAILED) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
app/src/main/java/com/aws/amazonlocation/domain/interface/PlaceInterface.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.aws.amazonlocation.domain.`interface` | ||
|
||
import aws.sdk.kotlin.services.geoplaces.model.GetPlaceResponse | ||
import com.aws.amazonlocation.data.common.DataSourceException | ||
|
||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
|
||
// SPDX-License-Identifier: MIT-0 | ||
interface PlaceInterface { | ||
|
||
fun placeSuccess(success: GetPlaceResponse) {} | ||
|
||
fun placeFailed(exception: DataSourceException) {} | ||
|
||
fun internetConnectionError(exception: String) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.