Skip to content

Commit

Permalink
Update error message test tag
Browse files Browse the repository at this point in the history
  • Loading branch information
hueachilles committed Mar 18, 2024
1 parent dc2fffb commit 0ef458d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ plugins {

android {
defaultConfig {
val buildVersion = 191
val buildVersion = 192
applicationId = "com.crisiscleanup"
versionCode = buildVersion
versionName = "0.9.${buildVersion - 168}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@ import com.crisiscleanup.core.designsystem.theme.primaryBlueColor
import com.crisiscleanup.feature.authentication.R

@Composable
internal fun ConditionalErrorMessage(errorMessage: String) {
internal fun ConditionalErrorMessage(
errorMessage: String,
testTagPrefix: String,
) {
if (errorMessage.isNotEmpty()) {
Text(
modifier = fillWidthPadded,
modifier = fillWidthPadded.testTag("${testTagPrefix}Error"),
text = errorMessage,
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.error,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ private fun LoginWithEmailScreen(
)

val authErrorMessage by viewModel.errorMessage
ConditionalErrorMessage(authErrorMessage)
ConditionalErrorMessage(authErrorMessage, "emailLogin")

val isNotBusy by viewModel.isNotAuthenticating.collectAsStateWithLifecycle()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ private fun LoginWithPhoneScreen(
style = LocalFontStyles.current.header1,
)

ConditionalErrorMessage(viewModel.errorMessage)
ConditionalErrorMessage(viewModel.errorMessage, "phoneLogin")

val isRequestingCode by viewModel.isRequestingCode.collectAsStateWithLifecycle()
val isNotBusy = !isRequestingCode
Expand Down Expand Up @@ -226,7 +226,7 @@ private fun ColumnScope.VerifyPhoneCodeScreen(
onAction = onBack,
)

ConditionalErrorMessage(viewModel.errorMessage)
ConditionalErrorMessage(viewModel.errorMessage, "verifyPhoneCode")

val singleCodes = viewModel.singleCodes.toList()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ private fun AuthenticatedScreen(
)

val authErrorMessage by viewModel.errorMessage
ConditionalErrorMessage(authErrorMessage)
ConditionalErrorMessage(authErrorMessage, "authenticated")

val isNotBusy by viewModel.isNotAuthenticating.collectAsStateWithLifecycle()

Expand Down

0 comments on commit 0ef458d

Please sign in to comment.