Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ALS-1889 Map language support added and political view updated #97

Open
wants to merge 29 commits into
base: ALS-1889_map_language_and_political_view_update
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ff114c4
fix: app crash on update endpoint fix
shah272728 Nov 12, 2024
65b1540
feat: Places popup updated with new information
shah272728 Nov 13, 2024
a0bcca9
feat: code optimize
shah272728 Nov 13, 2024
3e2e99a
feat: language support added to map
shah272728 Nov 14, 2024
de00ba5
feat: remove VNM from political view listing
shah272728 Nov 14, 2024
20f306f
feat: update design on political view
shah272728 Nov 15, 2024
d209973
fix: Search result showing wrong distance bug fix
shah272728 Nov 20, 2024
4f6c7c3
feat: Add political views for Georgia, Cyprus, Palestine, Greece to t…
shah272728 Nov 20, 2024
279af7d
feat: Add political views for Georgia, Cyprus, Palestine, Greece to t…
shah272728 Nov 20, 2024
c51ec2e
fix: stringS updated and translated
shah272728 Dec 11, 2024
e98220e
fix: minimum zoom level update
shah272728 Nov 18, 2024
44e47f4
fix: scooter, truck and walk data load after back press from navigati…
shah272728 Nov 19, 2024
c823fd6
fix: Portuguese and Chinese map language change not working bug fix
shah272728 Nov 22, 2024
7ed0d2b
fix: zoom level fix, chinese language name changes and removed unused…
shah272728 Nov 26, 2024
e31be8c
fix: worked on unit test cases update
shah272728 Nov 27, 2024
064e7cc
fix: code optimize
shah272728 Nov 27, 2024
28a38e7
fix: code optimize and removed unused strings
shah272728 Nov 27, 2024
d178c17
feat: Map language selection added in map style bottom sheet
shah272728 Nov 29, 2024
4df872f
fix: map language zh added as second language when zh-Hant selected
shah272728 Dec 2, 2024
0efe726
fix: Set english language as first in list
shah272728 Dec 4, 2024
1562b5c
fix: bug fixes for simulation and car data not showing
shah272728 Dec 11, 2024
48009b1
fix: bug fixes for amazon location info icon not visible in dark mode…
shah272728 Dec 11, 2024
ccc6bb4
fix: bug fixes for amazon location info icon click not working in sim…
shah272728 Dec 11, 2024
a1b062a
fix: code optimize
shah272728 Dec 11, 2024
dee45d7
fix: code optimize
shah272728 Dec 11, 2024
125a852
fix: map zoom bug fix
shah272728 Dec 12, 2024
1affd03
fix: UI for un-auth simulation scrolling bug fix
shah272728 Dec 13, 2024
08a8e2d
fix: duplicate code removed from view-model's
shah272728 Dec 18, 2024
278908b
fix: cursor color bug fix
shah272728 Dec 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ const val TEST_WORD_GUOCO_MIDTOWN_SQUARE = "Guoco Midtown Square"
const val TEST_WORD_KLUANG = "Kluang "
const val TEST_WORD_ARG = "ARG"
const val TEST_WORD_RUS = "RUS"
const val TEST_WORD_LANGUAGE_AR = "العربية"
const val TEST_WORD_LANGUAGE_BO = "Bosanski"
const val ACCESS_FINE_LOCATION = "android.permission.ACCESS_FINE_LOCATION"
const val ACCESS_COARSE_LOCATION = "android.permission.ACCESS_COARSE_LOCATION"
const val TEST_FAILED = "Test failed"
Expand All @@ -54,6 +56,7 @@ const val TEST_FAILED_SEARCH_DIRECTION = "Test failed due to search direction no
const val TEST_FAILED_ZOOM_LEVEL = "Test failed due to zoom level not available"
const val TEST_FAILED_LIST = "Test failed due to list not visible"
const val TEST_FAILED_COUNTRY= "Test failed due to selected country doesn't match"
const val TEST_FAILED_LANGUAGE= "Test failed due to selected language doesn't match"

const val TEST_FAILED_SETTINGS_ALL_OPTIONS_NOT_VISIBLE = "Test failed due to settings all options not visible"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ package com.aws.amazonlocation.ui

import com.aws.amazonlocation.ui.main.CheckRouteMapAdjustedTest
import com.aws.amazonlocation.ui.main.ExploreFragmentChangeStyleTest
import com.aws.amazonlocation.ui.main.ExploreFragmentMapLanguageTest
import com.aws.amazonlocation.ui.main.ExploreFragmentPoliticalViewTest
import com.aws.amazonlocation.ui.main.ExploreFragmentSearchLocationByAddressTest
import com.aws.amazonlocation.ui.main.SearchResultComparisonTest
import com.aws.amazonlocation.ui.main.SettingRouteOptionAvailableTest
import com.aws.amazonlocation.ui.main.SettingsFragmentContentTest
import com.aws.amazonlocation.ui.main.SettingsFragmentDefaultRouteTest
import com.aws.amazonlocation.ui.main.SettingsMapLanguageTest
import com.aws.amazonlocation.ui.main.SettingsMapPoliticalViewTest
import org.junit.runner.RunWith
import org.junit.runners.Suite
Expand All @@ -23,5 +25,7 @@ import org.junit.runners.Suite
ExploreFragmentChangeStyleTest::class,
ExploreFragmentPoliticalViewTest::class,
SettingsMapPoliticalViewTest::class,
ExploreFragmentMapLanguageTest::class,
SettingsMapLanguageTest::class,
)
class MapStylesSettingAndExplorerFlowSuite
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
package com.aws.amazonlocation.ui.main

import androidx.test.core.app.ApplicationProvider
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.*
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.*
import com.aws.amazonlocation.di.AppModule
import com.aws.amazonlocation.utils.*
import dagger.hilt.android.testing.HiltAndroidTest
import dagger.hilt.android.testing.UninstallModules
import org.hamcrest.CoreMatchers.allOf
import org.junit.Assert
import org.junit.Test

@UninstallModules(AppModule::class)
@HiltAndroidTest
class ExploreFragmentMapLanguageTest : BaseTestMainActivity() {

private val uiDevice = UiDevice.getInstance(getInstrumentation())

private lateinit var preferenceManager: PreferenceManager

@Throws(java.lang.Exception::class)
override fun before() {
preferenceManager = PreferenceManager(ApplicationProvider.getApplicationContext())
preferenceManager.setValue(IS_APP_FIRST_TIME_OPENED, true)
preferenceManager.removeValue(KEY_MAP_NAME)
preferenceManager.removeValue(KEY_MAP_STYLE_NAME)
super.before()
}

@Test
fun testMapLanguageChangeTest() {
try {
Thread.sleep(DELAY_2000)
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())
Thread.sleep(DELAY_2000)
uiDevice.wait(Until.hasObject(By.desc(AMAZON_MAP_READY)), DELAY_15000)

Thread.sleep(DELAY_2000)

goToMapStyles()

val clMapLanguage =
onView(withId(R.id.cl_map_language)).check(matches(isDisplayed()))
clMapLanguage.perform(click())

Thread.sleep(DELAY_2000)

val language =
waitForView(allOf(withText(TEST_WORD_LANGUAGE_AR), isDisplayed()))
language?.perform(click())

Thread.sleep(DELAY_2000)
Comment on lines +46 to +71
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these 2 second sleeps the only way we can verify it is safe to move to the next step, or is there event-based mechanism?


val description = uiDevice.findObject(UiSelector().resourceId("${BuildConfig.APPLICATION_ID}:id/tv_map_language_description"))
Assert.assertTrue(TEST_FAILED_LANGUAGE, description.text.contains(TEST_WORD_LANGUAGE_AR))
} catch (e: Exception) {
failTest(147, e)
Assert.fail(TEST_FAILED)
}
}

private fun goToMapStyles() {
val cardMap = waitForView(allOf(withId(R.id.card_map), isDisplayed()))
cardMap?.perform(click())

Thread.sleep(DELAY_2000)
swipeUp()
Thread.sleep(DELAY_2000)
}

private fun swipeUp(): UiDevice? {
// Get the screen dimensions
val screenHeight = getInstrumentation().targetContext.resources.displayMetrics.heightPixels

// Set the starting point for the swipe (bottom-center of the screen)
val startX = getInstrumentation().targetContext.resources.displayMetrics.widthPixels / 2f
val startY = screenHeight - 100 // Offset from the bottom of the screen

// Set the ending point for the swipe (top-center of the screen)
val endY = 100 // Offset from the top of the screen

// Perform the swipe action
val uiDevice = UiDevice.getInstance(getInstrumentation())
uiDevice.swipe(startX.toInt(), startY, startX.toInt(), endY, 10)
return uiDevice
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ class ExploreFragmentPoliticalViewTest : BaseTestMainActivity() {

Thread.sleep(DELAY_2000)

val btnApplyFilter = uiDevice.findObject(UiSelector().resourceId("${BuildConfig.APPLICATION_ID}:id/btn_apply_filter"))
btnApplyFilter.click()

Thread.sleep(DELAY_2000)

val tvPoliticalDescription = uiDevice.findObject(UiSelector().resourceId("${BuildConfig.APPLICATION_ID}:id/tv_political_description"))
Assert.assertTrue(TEST_FAILED_COUNTRY, tvPoliticalDescription.text.contains(TEST_WORD_ARG))
} catch (e: Exception) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
package com.aws.amazonlocation.ui.main

import androidx.test.core.app.ApplicationProvider
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.*
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.*
import com.aws.amazonlocation.di.AppModule
import com.aws.amazonlocation.utils.*
import dagger.hilt.android.testing.HiltAndroidTest
import dagger.hilt.android.testing.UninstallModules
import org.hamcrest.CoreMatchers.allOf
import org.hamcrest.core.AllOf
import org.junit.Assert
import org.junit.Test

@UninstallModules(AppModule::class)
@HiltAndroidTest
class SettingsMapLanguageTest : BaseTestMainActivity() {

private val uiDevice = UiDevice.getInstance(getInstrumentation())

private lateinit var preferenceManager: PreferenceManager

@Throws(java.lang.Exception::class)
override fun before() {
preferenceManager = PreferenceManager(ApplicationProvider.getApplicationContext())
preferenceManager.setValue(IS_APP_FIRST_TIME_OPENED, true)
super.before()
}

@Test
fun testSettingsMapPoliticalViewTest() {
Thread.sleep(DELAY_2000)

uiDevice.wait(Until.hasObject(By.desc(AMAZON_MAP_READY)), DELAY_15000)
Thread.sleep(DELAY_2000)

goToMapStyles()

val clPoliticalView =
onView(withId(R.id.cl_map_language)).check(matches(isDisplayed()))
clPoliticalView.perform(click())

Thread.sleep(DELAY_2000)

val language =
waitForView(allOf(withText(TEST_WORD_LANGUAGE_BO), isDisplayed()))
language?.perform(click())

Thread.sleep(DELAY_2000)

val description = uiDevice.findObject(UiSelector().resourceId("${BuildConfig.APPLICATION_ID}:id/tv_map_language_description"))
Assert.assertTrue(TEST_FAILED_LANGUAGE, description.text.contains(TEST_WORD_LANGUAGE_BO))
}

private fun goToMapStyles() {
waitForView(
AllOf.allOf(
withText(mActivityRule.activity.getString(R.string.menu_setting)),
isDescendantOfA(withId(R.id.bottom_navigation_main)),
isDisplayed()
)
)
?.perform(click())

Thread.sleep(DELAY_3000)

waitForView(
AllOf.allOf(
withId(R.id.cl_map_style),
isDisplayed()
)
)
?.perform(click())

Thread.sleep(DELAY_3000)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ class SettingsMapPoliticalViewTest : BaseTestMainActivity() {

Thread.sleep(DELAY_2000)

val btnApplyFilter = uiDevice.findObject(UiSelector().resourceId("${BuildConfig.APPLICATION_ID}:id/btn_apply_filter"))
btnApplyFilter.click()

Thread.sleep(DELAY_2000)

val tvPoliticalDescription = uiDevice.findObject(UiSelector().resourceId("${BuildConfig.APPLICATION_ID}:id/tv_political_description"))
Assert.assertTrue(TEST_FAILED_COUNTRY, tvPoliticalDescription.text.contains(TEST_WORD_RUS))
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.aws.amazonlocation.data.response

data class LanguageData(
val value: String,
val label: String,
var isSelected: Boolean = false
)
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,11 @@ class MainActivity :
}
moveToExploreScreen()
} else if (mBottomSheetHelper.isAttributeExpandedOrHalfExpand()) {
mBottomSheetHelper.hideAttributeSheet()
if (fragment is ExploreFragment) {
fragment.hideAttribution()
} else {
mBottomSheetHelper.hideAttributeSheet()
}
} else if (mBottomSheetHelper.isSearchBottomSheetExpandedOrHalfExpand()) {
mBottomSheetHelper.collapseSearchBottomSheet()
} else if (fragment is ExploreFragment && fragment.isMapStyleExpandedOrHalfExpand()) {
Expand Down
Loading