diff --git a/app/src/main/java/com/android/periodpals/ui/alert/AlertLists.kt b/app/src/main/java/com/android/periodpals/ui/alert/AlertLists.kt index 2303a4ee..b82e07ce 100644 --- a/app/src/main/java/com/android/periodpals/ui/alert/AlertLists.kt +++ b/app/src/main/java/com/android/periodpals/ui/alert/AlertLists.kt @@ -1,5 +1,6 @@ package com.android.periodpals.ui.alert +import android.content.Context import android.os.Handler import android.os.Looper import android.util.Log @@ -48,6 +49,7 @@ import androidx.compose.ui.platform.testTag import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign +import com.android.periodpals.R import com.android.periodpals.model.alert.Alert import com.android.periodpals.model.alert.AlertViewModel import com.android.periodpals.model.alert.Product @@ -80,19 +82,13 @@ import java.time.format.DateTimeFormatter import java.time.format.DateTimeParseException private val SELECTED_TAB_DEFAULT = AlertListsTab.MY_ALERTS -private const val SCREEN_TITLE = "Alert Lists" -private const val MY_ALERTS_TAB_TITLE = "My Alerts" -private const val PALS_ALERTS_TAB_TITLE = "Pals Alerts" -private const val NO_MY_ALERTS_DIALOG = "You haven't asked for help yet !" -private const val NO_PAL_ALERTS_DIALOG = "No pal needs help yet !" -private const val MY_ALERT_EDIT_TEXT = "Edit" -private const val PAL_ALERT_ACCEPT_TEXT = "Accept" -private const val PAL_ALERT_DECLINE_TEXT = "Decline" + private val INPUT_DATE_FORMATTER = DateTimeFormatter.ISO_OFFSET_DATE_TIME private val OUTPUT_TIME_FORMATTER = DateTimeFormatter.ofPattern("HH:mm") + private const val TAG = "AlertListsScreen" + private const val DEFAULT_RADIUS = 100.0 -private const val URGENCY_FILTER_DEFAULT_VALUE = "No Preference" /** Enum class representing the tabs in the AlertLists screen. */ private enum class AlertListsTab { @@ -154,7 +150,7 @@ fun AlertListsScreen( topBar = { Column(modifier = Modifier.fillMaxWidth().wrapContentHeight()) { TopAppBar( - title = SCREEN_TITLE, + title = context.getString(R.string.alert_lists_screen_title), chatButton = true, onChatButtonClick = { navigationActions.navigateTo(Screen.CHAT) }) TabRow( @@ -169,7 +165,7 @@ fun AlertListsScreen( text = { Text( modifier = Modifier.wrapContentSize(), - text = MY_ALERTS_TAB_TITLE, + text = context.getString(R.string.alert_lists_tab_my_alerts_title), color = MaterialTheme.colorScheme.onSurface, style = MaterialTheme.typography.headlineSmall, ) @@ -182,7 +178,7 @@ fun AlertListsScreen( text = { Text( modifier = Modifier.wrapContentSize(), - text = PALS_ALERTS_TAB_TITLE, + text = context.getString(R.string.alert_lists_tab_pals_alerts_title), color = MaterialTheme.colorScheme.onSurface, style = MaterialTheme.typography.headlineSmall, ) @@ -215,7 +211,7 @@ fun AlertListsScreen( location = selectedLocation, product = productToPeriodPalsIcon(productFilter!!).textId, urgency = - if (urgencyFilter == null) URGENCY_FILTER_DEFAULT_VALUE + if (urgencyFilter == null) context.getString(R.string.alert_lists_filter_default) else urgencyToPeriodPalsIcon(urgencyFilter!!).textId, onDismiss = { showFilterDialog = false }, onLocationSelected = { selectedLocation = it }, @@ -269,13 +265,15 @@ fun AlertListsScreen( when (selectedTab) { AlertListsTab.MY_ALERTS -> if (myAlertsList.isEmpty()) { - item { NoAlertDialog(NO_MY_ALERTS_DIALOG) } + item { NoAlertDialog(context.getString(R.string.alert_lists_no_my_alerts_dialog)) } } else { - items(myAlertsList) { alert -> MyAlertItem(alert, alertViewModel, navigationActions) } + items(myAlertsList) { alert -> + MyAlertItem(alert, alertViewModel, navigationActions, context) + } } AlertListsTab.PALS_ALERTS -> if (palsAlertsList.value.isEmpty()) { - item { NoAlertDialog(NO_PAL_ALERTS_DIALOG) } + item { NoAlertDialog(context.getString(R.string.alert_lists_no_pals_alerts_dialog)) } } else { items(palsAlertsList.value) { alert -> PalsAlertItem(alert = alert) } } @@ -291,12 +289,14 @@ fun AlertListsScreen( * @param alert The alert to be displayed. * @param alertViewModel The view model for managing alert data. * @param navigationActions The navigation actions for handling navigation events. + * @param context The context of the current activity. */ @Composable private fun MyAlertItem( alert: Alert, alertViewModel: AlertViewModel, - navigationActions: NavigationActions + navigationActions: NavigationActions, + context: Context, ) { val idTestTag = alert.id Card( @@ -356,7 +356,7 @@ private fun MyAlertItem( ) // Edit alert text Text( - text = MY_ALERT_EDIT_TEXT, + text = context.getString(R.string.alert_lists_my_alert_edit_text), style = MaterialTheme.typography.labelMedium, modifier = Modifier.wrapContentSize(), ) @@ -563,7 +563,7 @@ private fun AlertAcceptButtons(idTestTag: String) { ) { // Accept alert button AlertActionButton( - text = PAL_ALERT_ACCEPT_TEXT, + text = context.getString(R.string.alert_lists_pal_alert_accept_text), icon = Icons.Outlined.Check, onClick = { // TODO: Implement accept alert action @@ -580,7 +580,7 @@ private fun AlertAcceptButtons(idTestTag: String) { // Decline alert button AlertActionButton( - text = PAL_ALERT_DECLINE_TEXT, + text = context.getString(R.string.alert_lists_pal_alert_decline_text), icon = Icons.Outlined.Close, onClick = { // TODO: Implement decline alert action diff --git a/app/src/main/java/com/android/periodpals/ui/alert/CreateAlert.kt b/app/src/main/java/com/android/periodpals/ui/alert/CreateAlert.kt index d570d71c..861413c2 100644 --- a/app/src/main/java/com/android/periodpals/ui/alert/CreateAlert.kt +++ b/app/src/main/java/com/android/periodpals/ui/alert/CreateAlert.kt @@ -24,6 +24,7 @@ import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.testTag import androidx.compose.ui.text.style.TextAlign import androidx.lifecycle.viewmodel.compose.viewModel +import com.android.periodpals.R import com.android.periodpals.model.alert.Alert import com.android.periodpals.model.alert.AlertViewModel import com.android.periodpals.model.alert.AlertViewModel.Companion.LOCATION_STATE_NAME @@ -54,16 +55,6 @@ import com.android.periodpals.ui.navigation.TopAppBar import com.android.periodpals.ui.theme.dimens import com.dsc.form_builder.TextFieldState -private const val SCREEN_TITLE = "Create Alert" -private const val INSTRUCTION_TEXT = - "Push a notification to users near you! If they are available and have the products you need, they'll be able to help you!" - -const val PRODUCT_DROPDOWN_DEFAULT_VALUE = "Please choose a product" -const val URGENCY_DROPDOWN_DEFAULT_VALUE = "Please choose an urgency level" - -private const val SUCCESSFUL_SUBMISSION_TOAST_MESSAGE = "Alert sent" -private const val SUBMISSION_BUTTON_TEXT = "Ask for Help" - private const val TAG = "CreateAlertScreen" /** @@ -94,9 +85,9 @@ fun CreateAlertScreen( formState.reset() val productState = formState.getState(PRODUCT_STATE_NAME) - productState.change(PRODUCT_DROPDOWN_DEFAULT_VALUE) + productState.change(context.getString(R.string.create_alert_product_dropdown_default_value)) val urgencyState = formState.getState(URGENCY_STATE_NAME) - urgencyState.change(URGENCY_DROPDOWN_DEFAULT_VALUE) + urgencyState.change(context.getString(R.string.create_alert_urgency_dropdown_default_value)) val locationState = formState.getState(LOCATION_STATE_NAME) val messageState = formState.getState(MESSAGE_STATE_NAME) @@ -127,7 +118,7 @@ fun CreateAlertScreen( // Screen Scaffold( modifier = Modifier.fillMaxSize().testTag(C.Tag.CreateAlertScreen.SCREEN), - topBar = { TopAppBar(title = SCREEN_TITLE) }, + topBar = { TopAppBar(title = context.getString(R.string.create_alert_screen_title)) }, bottomBar = { BottomNavigationMenu( onTabSelect = { route -> navigationActions.navigateTo(route) }, @@ -153,7 +144,7 @@ fun CreateAlertScreen( ) { // Instruction text Text( - text = INSTRUCTION_TEXT, + text = context.getString(R.string.create_alert_instruction_text), modifier = Modifier.testTag(AlertInputs.INSTRUCTION_TEXT), textAlign = TextAlign.Center, style = MaterialTheme.typography.bodyMedium, @@ -179,7 +170,7 @@ fun CreateAlertScreen( // "Ask for Help" button ActionButton( - buttonText = SUBMISSION_BUTTON_TEXT, + buttonText = context.getString(R.string.create_alert_submission_button_text), onClick = { val errorMessage = when { @@ -209,7 +200,11 @@ fun CreateAlertScreen( onSuccess = { Log.d(TAG, "Alert created") }, onFailure = { e -> Log.e(TAG, "createAlert: fail to create alert: ${e.message}") }, ) - Toast.makeText(context, SUCCESSFUL_SUBMISSION_TOAST_MESSAGE, Toast.LENGTH_SHORT).show() + Toast.makeText( + context, + context.getString(R.string.create_alert_toast_successful_submission_message), + Toast.LENGTH_SHORT) + .show() navigationActions.navigateTo(Screen.ALERT_LIST) }, colors = getFilledPrimaryContainerButtonColors(), diff --git a/app/src/main/java/com/android/periodpals/ui/alert/EditAlert.kt b/app/src/main/java/com/android/periodpals/ui/alert/EditAlert.kt index 0c6f11b8..cb7d6f7b 100644 --- a/app/src/main/java/com/android/periodpals/ui/alert/EditAlert.kt +++ b/app/src/main/java/com/android/periodpals/ui/alert/EditAlert.kt @@ -20,6 +20,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.testTag import androidx.compose.ui.text.style.TextAlign +import com.android.periodpals.R import com.android.periodpals.model.alert.Alert import com.android.periodpals.model.alert.AlertViewModel import com.android.periodpals.model.alert.AlertViewModel.Companion.LOCATION_STATE_NAME @@ -49,18 +50,6 @@ import com.android.periodpals.ui.navigation.TopAppBar import com.android.periodpals.ui.theme.dimens import com.dsc.form_builder.TextFieldState -private const val SCREEN_TITLE = "Edit Your Alert" -private const val INSTRUCTION_TEXT = - "Edit, delete or resolve your push notification alert for nearby pals." + - " You can leave a review for the sender when you resolve." - -private const val DELETE_BUTTON_TEXT = "Delete" -private const val SAVE_BUTTON_TEXT = "Save" -private const val RESOLVE_BUTTON_TEXT = "Resolve" - -private const val SUCCESSFUL_UPDATE_TOAST_MESSAGE = "Alert updated" -private const val NOT_IMPLEMENTED_YET_TOAST_MESSAGE = "This feature is not implemented yet" - private const val TAG = "EditAlertScreen" /** @@ -102,7 +91,7 @@ fun EditAlertScreen( modifier = Modifier.fillMaxSize().testTag(EditAlertScreen.SCREEN), topBar = { TopAppBar( - title = SCREEN_TITLE, + title = context.getString(R.string.edit_alert_screen_title), backButton = true, onBackButtonClick = { navigationActions.navigateTo(Screen.ALERT_LIST) }, ) @@ -124,7 +113,7 @@ fun EditAlertScreen( // Instruction text Text( - text = INSTRUCTION_TEXT, + text = context.getString(R.string.edit_alert_instruction_text), modifier = Modifier.testTag(AlertInputs.INSTRUCTION_TEXT), textAlign = TextAlign.Center, style = MaterialTheme.typography.bodyMedium, @@ -154,7 +143,7 @@ fun EditAlertScreen( verticalAlignment = Alignment.CenterVertically, ) { ActionButton( - buttonText = DELETE_BUTTON_TEXT, + buttonText = context.getString(R.string.edit_alert_delete_button_text), onClick = { alertViewModel.deleteAlert( alert.id, @@ -177,7 +166,7 @@ fun EditAlertScreen( ) ActionButton( - buttonText = SAVE_BUTTON_TEXT, + buttonText = context.getString(R.string.edit_alert_save_button_text), onClick = { val errorMessage = when { @@ -192,7 +181,11 @@ fun EditAlertScreen( return@ActionButton } - Toast.makeText(context, SUCCESSFUL_UPDATE_TOAST_MESSAGE, Toast.LENGTH_SHORT).show() + Toast.makeText( + context, + context.getString(R.string.edit_alert_toast_successful_update), + Toast.LENGTH_SHORT) + .show() val newAlert = Alert( id = alert.id, @@ -219,10 +212,14 @@ fun EditAlertScreen( ) ActionButton( - buttonText = RESOLVE_BUTTON_TEXT, + buttonText = context.getString(R.string.edit_alert_resolve_button_text), onClick = { // TODO: resolve alert - Toast.makeText(context, NOT_IMPLEMENTED_YET_TOAST_MESSAGE, Toast.LENGTH_SHORT).show() + Toast.makeText( + context, + context.getString(R.string.edit_alert_toast_not_implemented_yet), + Toast.LENGTH_SHORT) + .show() navigationActions.navigateTo(Screen.ALERT_LIST) }, colors = getFilledPrimaryContainerButtonColors(), diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 58d53114..90da9325 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -45,6 +45,46 @@ Failed to delete account Failed loading user authentication data + + Create Alert + + Push a notification to users near you! If they are available and have the products you need, + they\'ll be able to help you! + + + Please choose a product + Please choose an urgency level + Ask for Help + + Alert sent + + + Edit Your Alert + + Edit, delete or resolve your push notification alert for nearby pals. + + + Delete + Save + Resolve + + Alert updated + This feature is not implemented yet + + + Alert Lists + My Alerts + Pals Alerts + + You haven\'t asked for help yet ! + No pal needs help yet ! + + Edit + Accept + Decline + + No Preference + Tampon Timer Start your tampon timer.\nYou’ll be reminded to change it! diff --git a/app/src/test/java/com/android/periodpals/ui/alert/AlertListsScreenTest.kt b/app/src/test/java/com/android/periodpals/ui/alert/AlertListsScreenTest.kt index 493ca922..1f77d3fe 100644 --- a/app/src/test/java/com/android/periodpals/ui/alert/AlertListsScreenTest.kt +++ b/app/src/test/java/com/android/periodpals/ui/alert/AlertListsScreenTest.kt @@ -16,6 +16,7 @@ import androidx.compose.ui.test.performClick import androidx.compose.ui.test.performScrollTo import androidx.compose.ui.test.performSemanticsAction import androidx.compose.ui.test.performTextInput +import com.android.periodpals.R import com.android.periodpals.model.alert.Alert import com.android.periodpals.model.alert.AlertViewModel import com.android.periodpals.model.alert.LIST_OF_PRODUCTS @@ -37,6 +38,7 @@ import com.android.periodpals.services.GPSServiceImpl import com.android.periodpals.ui.navigation.NavigationActions import com.android.periodpals.ui.navigation.Route import com.android.periodpals.ui.navigation.Screen +import io.github.kakaocup.kakao.common.utilities.getResourceString import kotlinx.coroutines.flow.MutableStateFlow import org.junit.Before import org.junit.Rule @@ -69,8 +71,6 @@ class AlertListsScreenTest { private val authUserData = mutableStateOf(AuthenticationUserData(uid, email)) companion object { - private const val NO_MY_ALERTS_TEXT = "You haven't asked for help yet !" - private const val NO_PALS_ALERTS_TEXT = "No pal needs help yet !" private val MY_ALERTS_LIST: List = listOf( Alert( @@ -151,13 +151,19 @@ class AlertListsScreenTest { } composeTestRule.onNodeWithTag(AlertListsScreen.SCREEN).assertIsDisplayed() composeTestRule.onNodeWithTag(AlertListsScreen.TAB_ROW).assertIsDisplayed() - composeTestRule.onNodeWithTag(AlertListsScreen.MY_ALERTS_TAB).assertIsDisplayed() - composeTestRule.onNodeWithTag(AlertListsScreen.PALS_ALERTS_TAB).assertIsDisplayed() + composeTestRule + .onNodeWithTag(AlertListsScreen.MY_ALERTS_TAB) + .assertIsDisplayed() + .assertTextEquals(getResourceString(R.string.alert_lists_tab_my_alerts_title)) + composeTestRule + .onNodeWithTag(AlertListsScreen.PALS_ALERTS_TAB) + .assertIsDisplayed() + .assertTextEquals(getResourceString(R.string.alert_lists_tab_pals_alerts_title)) composeTestRule.onNodeWithTag(TopAppBar.TOP_BAR).assertIsDisplayed() composeTestRule .onNodeWithTag(TopAppBar.TITLE_TEXT) .assertIsDisplayed() - .assertTextEquals("Alert Lists") + .assertTextEquals(getResourceString(R.string.alert_lists_screen_title)) composeTestRule.onNodeWithTag(TopAppBar.GO_BACK_BUTTON).assertIsNotDisplayed() composeTestRule.onNodeWithTag(TopAppBar.SETTINGS_BUTTON).assertIsNotDisplayed() composeTestRule.onNodeWithTag(TopAppBar.CHAT_BUTTON).assertIsDisplayed() @@ -220,7 +226,7 @@ class AlertListsScreenTest { .onNodeWithTag(AlertListsScreen.NO_ALERTS_TEXT) .performScrollTo() .assertIsDisplayed() - .assertTextEquals(NO_MY_ALERTS_TEXT) + .assertTextEquals(getResourceString(R.string.alert_lists_no_my_alerts_dialog)) } @Test @@ -326,7 +332,7 @@ class AlertListsScreenTest { .onNodeWithTag(AlertListsScreen.NO_ALERTS_TEXT) .performScrollTo() .assertIsDisplayed() - .assertTextEquals(NO_PALS_ALERTS_TEXT) + .assertTextEquals(getResourceString(R.string.alert_lists_no_pals_alerts_dialog)) } @Test diff --git a/app/src/test/java/com/android/periodpals/ui/alert/CreateAlertScreenTest.kt b/app/src/test/java/com/android/periodpals/ui/alert/CreateAlertScreenTest.kt index fd85cb8b..2853e3ab 100644 --- a/app/src/test/java/com/android/periodpals/ui/alert/CreateAlertScreenTest.kt +++ b/app/src/test/java/com/android/periodpals/ui/alert/CreateAlertScreenTest.kt @@ -14,6 +14,7 @@ import androidx.compose.ui.test.onNodeWithText import androidx.compose.ui.test.performClick import androidx.compose.ui.test.performScrollTo import androidx.compose.ui.test.performTextInput +import com.android.periodpals.R import com.android.periodpals.model.alert.AlertViewModel import com.android.periodpals.model.alert.AlertViewModel.Companion.LOCATION_STATE_NAME import com.android.periodpals.model.alert.AlertViewModel.Companion.MESSAGE_STATE_NAME @@ -40,6 +41,7 @@ import com.android.periodpals.ui.navigation.TopLevelDestination import com.dsc.form_builder.FormState import com.dsc.form_builder.TextFieldState import com.dsc.form_builder.Validators +import io.github.kakaocup.kakao.common.utilities.getResourceString import kotlinx.coroutines.flow.MutableStateFlow import org.junit.Assert.assertEquals import org.junit.Before @@ -74,7 +76,6 @@ class CreateAlertScreenTest { private val LOCATION_SUGGESTION2 = Location(46.2017559, 6.1466014, "Geneva, Switzerland") private val LOCATION_SUGGESTION3 = Location(46.1683026, 5.9059776, "Farges, Gex, Ain") private const val MESSAGE = "I need help finding a tampon" - private const val SUBMIT_BUTTON_TEXT = "Ask for Help" private const val NUM_ITEMS_WHEN_SUGGESTION = 4 private const val NUM_ITEMS_WHEN_NO_SUGGESTION = 1 @@ -95,13 +96,19 @@ class CreateAlertScreenTest { listOf( Validators.Custom( message = ERROR_INVALID_PRODUCT, - function = { it.toString() != PRODUCT_DROPDOWN_DEFAULT_VALUE }, + function = { + it.toString() != + getResourceString(R.string.create_alert_product_dropdown_default_value) + }, )) private val urgencyValidators = listOf( Validators.Custom( message = ERROR_INVALID_URGENCY, - function = { it.toString() != URGENCY_DROPDOWN_DEFAULT_VALUE }, + function = { + it.toString() != + getResourceString(R.string.create_alert_urgency_dropdown_default_value) + }, )) private val locationValidators = listOf( @@ -187,7 +194,7 @@ class CreateAlertScreenTest { composeTestRule .onNodeWithTag(TopAppBar.TITLE_TEXT) .assertIsDisplayed() - .assertTextEquals("Create Alert") + .assertTextEquals(getResourceString(R.string.create_alert_screen_title)) composeTestRule.onNodeWithTag(TopAppBar.GO_BACK_BUTTON).assertIsNotDisplayed() composeTestRule.onNodeWithTag(TopAppBar.SETTINGS_BUTTON).assertIsNotDisplayed() composeTestRule.onNodeWithTag(TopAppBar.CHAT_BUTTON).assertIsNotDisplayed() @@ -198,6 +205,7 @@ class CreateAlertScreenTest { .onNodeWithTag(AlertInputs.INSTRUCTION_TEXT) .performScrollTo() .assertIsDisplayed() + .assertTextEquals(getResourceString(R.string.create_alert_instruction_text)) composeTestRule.onNodeWithTag(AlertInputs.PRODUCT_FIELD).performScrollTo().assertIsDisplayed() composeTestRule.onNodeWithTag(AlertInputs.URGENCY_FIELD).performScrollTo().assertIsDisplayed() composeTestRule.onNodeWithTag(AlertInputs.LOCATION_FIELD).performScrollTo().assertIsDisplayed() @@ -206,7 +214,7 @@ class CreateAlertScreenTest { .onNodeWithTag(C.Tag.CreateAlertScreen.SUBMIT_BUTTON) .performScrollTo() .assertIsDisplayed() - .assertTextEquals(SUBMIT_BUTTON_TEXT) + .assertTextEquals(getResourceString(R.string.create_alert_submission_button_text)) } @Test diff --git a/app/src/test/java/com/android/periodpals/ui/alert/EditAlertScreenTest.kt b/app/src/test/java/com/android/periodpals/ui/alert/EditAlertScreenTest.kt index 3247d282..70214452 100644 --- a/app/src/test/java/com/android/periodpals/ui/alert/EditAlertScreenTest.kt +++ b/app/src/test/java/com/android/periodpals/ui/alert/EditAlertScreenTest.kt @@ -11,6 +11,7 @@ import androidx.compose.ui.test.performClick import androidx.compose.ui.test.performScrollTo import androidx.compose.ui.test.performTextClearance import androidx.compose.ui.test.performTextInput +import com.android.periodpals.R import com.android.periodpals.model.alert.Alert import com.android.periodpals.model.alert.AlertViewModel import com.android.periodpals.model.alert.AlertViewModel.Companion.LOCATION_STATE_NAME @@ -40,6 +41,7 @@ import com.android.periodpals.ui.navigation.TopLevelDestination import com.dsc.form_builder.FormState import com.dsc.form_builder.TextFieldState import com.dsc.form_builder.Validators +import io.github.kakaocup.kakao.common.utilities.getResourceString import kotlinx.coroutines.flow.MutableStateFlow import org.junit.Before import org.junit.Rule @@ -73,9 +75,6 @@ class EditAlertScreenTest { private val LOCATION_SUGGESTION2 = Location(46.2017559, 6.1466014, "Geneva, Switzerland") private val LOCATION_SUGGESTION3 = Location(46.1683026, 5.9059776, "Farges, Gex, Ain") private const val MESSAGE = "I need help finding a tampon" - private const val DELETE_BUTTON_TEXT = "Delete" - private const val SAVE_BUTTON_TEXT = "Save" - private const val RESOLVE_BUTTON_TEXT = "Resolve" private const val MAX_LOCATION_LENGTH = 512 private const val MAX_MESSAGE_LENGTH = 512 @@ -93,13 +92,19 @@ class EditAlertScreenTest { listOf( Validators.Custom( message = ERROR_INVALID_PRODUCT, - function = { it.toString() != PRODUCT_DROPDOWN_DEFAULT_VALUE }, + function = { + it.toString() != + getResourceString(R.string.create_alert_product_dropdown_default_value) + }, )) private val urgencyValidators = listOf( Validators.Custom( message = ERROR_INVALID_URGENCY, - function = { it.toString() != URGENCY_DROPDOWN_DEFAULT_VALUE }, + function = { + it.toString() != + getResourceString(R.string.create_alert_urgency_dropdown_default_value) + }, )) private val locationValidators = listOf( @@ -192,7 +197,7 @@ class EditAlertScreenTest { composeTestRule .onNodeWithTag(TopAppBar.TITLE_TEXT) .assertIsDisplayed() - .assertTextEquals("Edit Your Alert") + .assertTextEquals(getResourceString(R.string.edit_alert_screen_title)) composeTestRule.onNodeWithTag(TopAppBar.GO_BACK_BUTTON).assertIsDisplayed() composeTestRule.onNodeWithTag(TopAppBar.SETTINGS_BUTTON).assertIsNotDisplayed() composeTestRule.onNodeWithTag(TopAppBar.CHAT_BUTTON).assertIsNotDisplayed() @@ -205,6 +210,7 @@ class EditAlertScreenTest { .onNodeWithTag(AlertInputs.INSTRUCTION_TEXT) .performScrollTo() .assertIsDisplayed() + .assertTextEquals(getResourceString(R.string.edit_alert_instruction_text)) composeTestRule.onNodeWithTag(AlertInputs.PRODUCT_FIELD).performScrollTo().assertIsDisplayed() composeTestRule.onNodeWithTag(AlertInputs.URGENCY_FIELD).performScrollTo().assertIsDisplayed() composeTestRule.onNodeWithTag(AlertInputs.LOCATION_FIELD).performScrollTo().assertIsDisplayed() @@ -213,17 +219,17 @@ class EditAlertScreenTest { .onNodeWithTag(EditAlertScreen.DELETE_BUTTON) .performScrollTo() .assertIsDisplayed() - .assertTextEquals(DELETE_BUTTON_TEXT) + .assertTextEquals(getResourceString(R.string.edit_alert_delete_button_text)) composeTestRule .onNodeWithTag(EditAlertScreen.SAVE_BUTTON) .performScrollTo() .assertIsDisplayed() - .assertTextEquals(SAVE_BUTTON_TEXT) + .assertTextEquals(getResourceString(R.string.edit_alert_save_button_text)) composeTestRule .onNodeWithTag(EditAlertScreen.RESOLVE_BUTTON) .performScrollTo() .assertIsDisplayed() - .assertTextEquals(RESOLVE_BUTTON_TEXT) + .assertTextEquals(getResourceString(R.string.edit_alert_resolve_button_text)) } @Test