@@ -8,6 +8,7 @@ import android.os.Bundle
88import android.view.LayoutInflater
99import android.view.MotionEvent.ACTION_UP
1010import androidx.activity.viewModels
11+ import androidx.annotation.StringRes
1112import androidx.compose.foundation.Image
1213import androidx.compose.foundation.clickable
1314import androidx.compose.foundation.layout.Arrangement
@@ -93,6 +94,7 @@ import org.thoughtcrime.securesms.ui.TitledText
9394import org.thoughtcrime.securesms.ui.UserProfileModal
9495import org.thoughtcrime.securesms.ui.components.Avatar
9596import org.thoughtcrime.securesms.ui.components.annotatedStringResource
97+ import org.thoughtcrime.securesms.ui.qaTag
9698import org.thoughtcrime.securesms.ui.setComposeContent
9799import org.thoughtcrime.securesms.ui.theme.LocalColors
98100import org.thoughtcrime.securesms.ui.theme.LocalDimensions
@@ -401,6 +403,7 @@ fun MessageProFeatures(
401403
402404 features.forEach { feature ->
403405 ProCTAFeature (
406+ modifier = Modifier .qaTag(feature.qaTagRes),
404407 textStyle = LocalType .current.large,
405408 padding = PaddingValues (),
406409 data = CTAFeature .Icon (
@@ -417,6 +420,21 @@ fun MessageProFeatures(
417420 }
418421}
419422
423+ /* *
424+ * QA tag for a feature row, so a test can assert WHICH features a message was sent with rather than
425+ * how many of them there are.
426+ *
427+ * The values are a cross-platform contract: iOS defines the same strings in
428+ * `SessionProUI.AccessibilityIdentifier` and Desktop derives them from its own feature vocabulary, so
429+ * one feature is named the same on every client and on every screen it appears on.
430+ */
431+ private val ProFeature .qaTagRes: Int
432+ @StringRes get() = when (this ) {
433+ ProProfileFeature .PRO_BADGE -> R .string.qa_pro_message_feature_badges
434+ ProMessageFeature .HIGHER_CHARACTER_LIMIT -> R .string.qa_pro_message_feature_longer_messages
435+ ProProfileFeature .ANIMATED_AVATAR -> R .string.qa_pro_message_feature_animated_display_picture
436+ }
437+
420438@Preview
421439@Composable
422440fun PreviewMessageProFeatures (){
0 commit comments