From 34a5bc859fdfe6679493f56f784d7c812530f068 Mon Sep 17 00:00:00 2001 From: Tangem Date: Mon, 1 Jun 2026 12:36:46 +0200 Subject: [PATCH] Updated on 2026-08-14 --- .../reference/running-and-debugging.md | 4 +-- .../com/tangem/tests/AppCurrencyTest.kt | 31 +++++++------------ .../ui/appsettings/AppSettingsScreen.kt | 9 +++++- .../core/ui/test/AppSettingsScreenTestTags.kt | 2 +- 4 files changed, 22 insertions(+), 24 deletions(-) diff --git a/.claude/skills/write-ui-test/reference/running-and-debugging.md b/.claude/skills/write-ui-test/reference/running-and-debugging.md index c7e934192c..8cf1f04834 100644 --- a/.claude/skills/write-ui-test/reference/running-and-debugging.md +++ b/.claude/skills/write-ui-test/reference/running-and-debugging.md @@ -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). \ No newline at end of file +- Path discipline: stay at the repo root; `cd` into the mocks repo only when needed and prefer absolute + paths (the shell session resets cwd). \ No newline at end of file diff --git a/app/src/androidTest/kotlin/com/tangem/tests/AppCurrencyTest.kt b/app/src/androidTest/kotlin/com/tangem/tests/AppCurrencyTest.kt index 0cce0ace48..78ffdaf70d 100644 --- a/app/src/androidTest/kotlin/com/tangem/tests/AppCurrencyTest.kt +++ b/app/src/androidTest/kotlin/com/tangem/tests/AppCurrencyTest.kt @@ -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) } } } } diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/appsettings/AppSettingsScreen.kt b/app/src/main/java/com/tangem/tap/features/details/ui/appsettings/AppSettingsScreen.kt index 83d745be03..a7d5a8890a 100644 --- a/app/src/main/java/com/tangem/tap/features/details/ui/appsettings/AppSettingsScreen.kt +++ b/app/src/main/java/com/tangem/tap/features/details/ui/appsettings/AppSettingsScreen.kt @@ -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( diff --git a/core/ui/src/main/java/com/tangem/core/ui/test/AppSettingsScreenTestTags.kt b/core/ui/src/main/java/com/tangem/core/ui/test/AppSettingsScreenTestTags.kt index 8dfc28d4b2..c8ed037e0b 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/test/AppSettingsScreenTestTags.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/test/AppSettingsScreenTestTags.kt @@ -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" } \ No newline at end of file