mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-23 10:05:15 +00:00
Creating a custom qaTag modifier
This commit is contained in:
parent
dc0b782f99
commit
79665ad475
@ -3,7 +3,12 @@ package org.thoughtcrime.securesms.ui
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.ExperimentalComposeUiApi
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.ComposeView
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.testTagsAsResourceId
|
||||
import androidx.fragment.app.Fragment
|
||||
import org.thoughtcrime.securesms.ui.theme.SessionMaterialTheme
|
||||
|
||||
@ -23,3 +28,15 @@ fun ComposeView.setThemedContent(content: @Composable () -> Unit) = setContent {
|
||||
content()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is used to set the test tag that the QA team can use to retrieve an element in appium
|
||||
* In order to do so we need to set the testTagsAsResourceId to true, which ideally should be done only once
|
||||
* in the root composable, but our app is currently made up of multiple isolated composables
|
||||
* set up in the old activity/fragment view system
|
||||
* As such we need to repeat it for every component that wants to use testTag, until such
|
||||
* a time as we have one root composable
|
||||
*/
|
||||
@OptIn(ExperimentalComposeUiApi::class)
|
||||
@Composable
|
||||
fun Modifier.qaTag(tag: String) = semantics { testTagsAsResourceId = true }.testTag(tag)
|
@ -35,6 +35,7 @@ import network.loki.messenger.libsession_util.util.ExpiryMode
|
||||
import org.thoughtcrime.securesms.conversation.disappearingmessages.ExpiryType
|
||||
import org.thoughtcrime.securesms.ui.GetString
|
||||
import org.thoughtcrime.securesms.ui.RadioOption
|
||||
import org.thoughtcrime.securesms.ui.qaTag
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalDimensions
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalType
|
||||
@ -122,7 +123,7 @@ fun <T> TitledRadioButton(
|
||||
RadioButton(
|
||||
modifier = modifier
|
||||
.heightIn(min = 60.dp)
|
||||
.testTag(option.contentDescription.string()),
|
||||
.qaTag(option.contentDescription.string()),
|
||||
onClick = onClick,
|
||||
selected = option.selected,
|
||||
enabled = option.enabled,
|
||||
|
Loading…
Reference in New Issue
Block a user