Updated on 2026-08-14

This commit is contained in:
Tangem 2026-06-26 19:12:13 +03:00
parent 9898764f4d
commit 848b232384
7 changed files with 35 additions and 7 deletions

View file

@ -57,6 +57,17 @@ fun BaseTestCase.selectStablecoinAsFeeToken(coinName: String, tokenName: String)
step("Select '$tokenName' as the fee-paying token") {
onSendFeeSelectorBottomSheet { feeTokenItem(tokenName).performClick() }
}
step("Wait until the '$tokenName' fee is loaded and 'Apply' is enabled") {
composeTestRule.waitUntil(timeoutMillis = WAIT_UNTIL_TIMEOUT_LONG) {
runCatching {
onSendFeeSelectorBottomSheet {
networkFeeTitle.assertIsDisplayed()
feeTokenItem(tokenName).assertIsDisplayed()
applyButton.assertIsEnabled()
}
}.isSuccess
}
}
}
/**

View file

@ -14,6 +14,10 @@ class AppSettingsPageObject(semanticsProvider: SemanticsNodeInteractionsProvider
hasTestTag(AppSettingsScreenTestTags.CURRENCY_BUTTON)
useUnmergedTree = true
}
val backButton: KNode = child {
hasTestTag(AppSettingsScreenTestTags.BACK_BUTTON)
}
}
internal fun BaseTestCase.onAppSettingsScreen(function: AppSettingsPageObject.() -> Unit) =

View file

@ -14,6 +14,10 @@ import androidx.compose.ui.test.hasText as withText
class DetailsPageObject(semanticsProvider: SemanticsNodeInteractionsProvider) :
ComposeScreen<DetailsPageObject>(semanticsProvider = semanticsProvider) {
val screenContainer: KNode = child {
hasTestTag(DetailsScreenTestTags.SCREEN_CONTAINER)
}
val topAppBarBackButton: KNode = child {
hasTestTag(TopAppBarTestTags.CLOSE_BUTTON)
}

View file

@ -59,15 +59,15 @@ class AppCurrencyTest : BaseTestCase() {
onAppSettingsScreen { currencyButton.assertIsDisplayed() }
}
}
step("Return to 'Details' screen") {
waitForIdle()
device.uiDevice.pressBack()
step("Return to 'Details' screen via 'Back' button") {
flakySafely(WAIT_UNTIL_TIMEOUT_LONG) {
onAppSettingsScreen { backButton.clickWithAssertion() }
onDetailsScreen { screenContainer.assertIsDisplayed() }
}
}
step("Return to 'Main' screen via 'Back' button") {
onDetailsScreen { topAppBarBackButton.clickWithAssertion() }
}
step("Assert 'Main' screen is opened") {
flakySafely(WAIT_UNTIL_TIMEOUT_LONG) {
onDetailsScreen { topAppBarBackButton.clickWithAssertion() }
onMainScreen { screenContainer.assertIsDisplayed() }
}
}

View file

@ -31,6 +31,7 @@ internal fun AppSettingsScreen(state: AppSettingsScreenState, onBackClick: () ->
modifier = modifier,
titleRes = R.string.app_settings_title,
addBottomInsets = false,
backButtonTestTag = AppSettingsScreenTestTags.BACK_BUTTON,
content = {
when (state) {
is AppSettingsScreenState.Content -> AppSettings(state = state)

View file

@ -8,6 +8,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import com.tangem.core.ui.components.PrimaryButtonIconEnd
@ -23,6 +24,7 @@ internal fun SettingsScreensScaffold(
@StringRes titleRes: Int? = null,
addBottomInsets: Boolean = true,
snackbarHostState: SnackbarHostState = remember { SnackbarHostState() },
backButtonTestTag: String? = null,
content: @Composable () -> Unit,
fab: @Composable () -> Unit = {},
) {
@ -35,6 +37,7 @@ internal fun SettingsScreensScaffold(
modifier = Modifier.statusBarsPadding(),
onBackClick = onBackClick,
backgroundColor = backgroundColor,
backButtonTestTag = backButtonTestTag,
)
},
modifier = modifier,
@ -91,13 +94,17 @@ internal fun EmptyTopBarWithNavigation(
onBackClick: () -> Unit,
modifier: Modifier = Modifier,
backgroundColor: Color = TangemTheme.colors.background.primary,
backButtonTestTag: String? = null,
) {
TopAppBar(
modifier = modifier,
title = { },
navigationIcon =
{
IconButton(onClick = onBackClick) {
IconButton(
onClick = onBackClick,
modifier = if (backButtonTestTag != null) Modifier.testTag(backButtonTestTag) else Modifier,
) {
Icon(
painter = painterResource(id = R.drawable.ic_back_24),
contentDescription = null,

View file

@ -2,4 +2,5 @@ package com.tangem.core.ui.test
object AppSettingsScreenTestTags {
const val CURRENCY_BUTTON = "APP_SETTINGS_SCREEN_CURRENCY_BUTTON"
const val BACK_BUTTON = "APP_SETTINGS_SCREEN_BACK_BUTTON"
}