Updated on 2026-08-14

This commit is contained in:
Tangem 2026-06-01 12:36:46 +02:00
parent 46ba35643c
commit 34a5bc859f
4 changed files with 22 additions and 24 deletions

View file

@ -84,5 +84,5 @@ curl http://localhost:8081/__admin/scenarios | jq '.scenarios[] | {name, state}'
tasks for verifying a broad change (but it's for *unit* tests, not instrumentation).
- Detekt config lives in the `tangem-android-tools` git submodule — look there before assuming a local
`.detekt.yml`.
- Path discipline: stay in `/Users/maxibello/dev/tangem-app-android`; `cd` into the mocks repo only when
needed and prefer absolute paths (the shell session resets cwd).
- Path discipline: stay at the repo root; `cd` into the mocks repo only when needed and prefer absolute
paths (the shell session resets cwd).

View file

@ -3,7 +3,6 @@ package com.tangem.tests
import com.tangem.common.BaseTestCase
import com.tangem.common.constants.TestConstants.WAIT_UNTIL_TIMEOUT_LONG
import com.tangem.common.extensions.clickWithAssertion
import com.tangem.common.extensions.isDisplayedSafely
import com.tangem.common.utils.resetWireMockScenarioState
import com.tangem.common.utils.setWireMockScenarioState
import com.tangem.scenarios.openMainScreen
@ -55,34 +54,26 @@ class AppCurrencyTest : BaseTestCase() {
step("Click on currency '$targetCurrency'") {
onAppCurrencySelectorScreen { currencyItem(targetCurrency).performClick() }
}
step("Return to 'Main' screen") {
var displayed = false
var attempts = 0
while (!displayed && attempts < 4) {
onMainScreen { displayed = screenContainer.isDisplayedSafely() }
if (!displayed) {
device.uiDevice.pressBack()
waitForIdle()
attempts++
}
}
step("Press 'Back' button") {
waitForIdle()
device.uiDevice.pressBack()
}
step("Press 'Back' button") {
waitForIdle()
device.uiDevice.pressBack()
}
step("Assert total balance contains '$targetSymbol' on 'Main' screen") {
// Balance re-loads in the new currency async after the switch — wait for the € equivalent.
composeTestRule.waitUntil(WAIT_UNTIL_TIMEOUT_LONG) {
runCatching {
onMainScreen { totalBalanceText.assertTextContains(targetSymbol, substring = true) }
}.isSuccess
flakySafely(WAIT_UNTIL_TIMEOUT_LONG) {
onMainScreen { totalBalanceText.assertTextContains(targetSymbol, substring = true) }
}
}
step("Click on token '$token'") {
onMainScreen { tokenWithTitleAndAddress(token).clickWithAssertion() }
}
step("Assert token fiat balance contains '$targetSymbol'") {
composeTestRule.waitUntil(WAIT_UNTIL_TIMEOUT_LONG) {
runCatching {
onTokenDetailsScreen { fiatBalance.assertTextContains(targetSymbol, substring = true) }
}.isSuccess
flakySafely(WAIT_UNTIL_TIMEOUT_LONG) {
onTokenDetailsScreen { fiatBalance.assertTextContains(targetSymbol, substring = true) }
}
}
}

View file

@ -16,6 +16,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.tooling.preview.datasource.CollectionPreviewParameterProvider
import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemThemePreview
import com.tangem.core.ui.test.AppSettingsScreenTestTags
import com.tangem.domain.apptheme.model.AppThemeMode
import com.tangem.tap.features.details.ui.appsettings.AppSettingsScreenState.Item
import com.tangem.tap.features.details.ui.appsettings.components.*
@ -58,7 +59,13 @@ private fun AppSettings(state: AppSettingsScreenState.Content) {
is Item.Button -> SettingsButtonItem(
modifier = Modifier
.padding(vertical = TangemTheme.dimens.spacing8)
.testTag(item.id),
.then(
if (item.id == AppSettingsItemsFactory.ID_SELECT_APP_CURRENCY_BUTTON) {
Modifier.testTag(AppSettingsScreenTestTags.CURRENCY_BUTTON)
} else {
Modifier
},
),
item = item,
)
is Item.Switch -> SettingsSwitchItem(

View file

@ -1,5 +1,5 @@
package com.tangem.core.ui.test
object AppSettingsScreenTestTags {
const val CURRENCY_BUTTON = "select_app_currency_button"
const val CURRENCY_BUTTON = "APP_SETTINGS_SCREEN_CURRENCY_BUTTON"
}