Updated on 2026-08-14
This commit is contained in:
commit
1583ff1144
10 changed files with 326 additions and 7 deletions
|
|
@ -34,6 +34,19 @@ fun BaseTestCase.openTangemPayCardPage() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Opens the card page and taps 'Change' on the daily limit block to reach the limit setup screen. */
|
||||||
|
fun BaseTestCase.openTangemPayDailyLimitSetup() {
|
||||||
|
openTangemPayCardPage()
|
||||||
|
step("Click on 'Change' daily limit button") {
|
||||||
|
awaitSuccess { onTangemPayCardPageScreen { dailyLimitChangeButton.assertIsDisplayed() } }
|
||||||
|
onTangemPayCardPageScreen { dailyLimitChangeButton.performClick() }
|
||||||
|
}
|
||||||
|
step("Assert daily limit setup screen is displayed") {
|
||||||
|
awaitSuccess { onTangemPayDailyLimitScreen { amountField.assertIsDisplayed() } }
|
||||||
|
onTangemPayDailyLimitScreen { setLimitsButton.assertIsDisplayed() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** From the card page, opens the 'Replace card' reissue bottom sheet via the 'More' menu. */
|
/** From the card page, opens the 'Replace card' reissue bottom sheet via the 'More' menu. */
|
||||||
fun BaseTestCase.openReissueSheet() {
|
fun BaseTestCase.openReissueSheet() {
|
||||||
step("Click on 'More' button") {
|
step("Click on 'More' button") {
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,16 @@ class TangemPayCardPagePageObject(semanticsProvider: SemanticsNodeInteractionsPr
|
||||||
hasTestTag(TangemPayTestTags.CARD_DETAILS_COPY_CVC)
|
hasTestTag(TangemPayTestTags.CARD_DETAILS_COPY_CVC)
|
||||||
useUnmergedTree = true
|
useUnmergedTree = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val dailyLimitChangeButton: KNode = child {
|
||||||
|
hasTestTag(TangemPayTestTags.DAILY_LIMIT_CHANGE_BUTTON)
|
||||||
|
useUnmergedTree = true
|
||||||
|
}
|
||||||
|
|
||||||
|
val dailyLimitValue: KNode = child {
|
||||||
|
hasTestTag(TangemPayTestTags.DAILY_LIMIT_CURRENT_VALUE)
|
||||||
|
useUnmergedTree = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun BaseTestCase.onTangemPayCardPageScreen(function: TangemPayCardPagePageObject.() -> Unit) =
|
internal fun BaseTestCase.onTangemPayCardPageScreen(function: TangemPayCardPagePageObject.() -> Unit) =
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
package com.tangem.screens.tangempay
|
||||||
|
|
||||||
|
import androidx.compose.ui.test.SemanticsNodeInteractionsProvider
|
||||||
|
import com.tangem.common.BaseTestCase
|
||||||
|
import com.tangem.core.ui.test.SendScreenTestTags
|
||||||
|
import com.tangem.core.ui.test.TangemPayTestTags
|
||||||
|
import io.github.kakaocup.compose.node.element.ComposeScreen
|
||||||
|
import io.github.kakaocup.compose.node.element.ComposeScreen.Companion.onComposeScreen
|
||||||
|
import io.github.kakaocup.compose.node.element.KNode
|
||||||
|
|
||||||
|
class TangemPayDailyLimitPageObject(semanticsProvider: SemanticsNodeInteractionsProvider) :
|
||||||
|
ComposeScreen<TangemPayDailyLimitPageObject>(semanticsProvider = semanticsProvider) {
|
||||||
|
|
||||||
|
// AmountTextField tags its editable field with SendScreenTestTags.INPUT_TEXT_FIELD; it's the only one here.
|
||||||
|
val amountField: KNode = child {
|
||||||
|
hasTestTag(SendScreenTestTags.INPUT_TEXT_FIELD)
|
||||||
|
useUnmergedTree = true
|
||||||
|
}
|
||||||
|
|
||||||
|
val hint: KNode = child {
|
||||||
|
hasTestTag(TangemPayTestTags.DAILY_LIMIT_HINT)
|
||||||
|
useUnmergedTree = true
|
||||||
|
}
|
||||||
|
|
||||||
|
val setLimitsButton: KNode = child {
|
||||||
|
hasTestTag(TangemPayTestTags.DAILY_LIMIT_SET_BUTTON)
|
||||||
|
useUnmergedTree = true
|
||||||
|
}
|
||||||
|
|
||||||
|
val successTitle: KNode = child {
|
||||||
|
hasTestTag(TangemPayTestTags.DAILY_LIMIT_SUCCESS_TITLE)
|
||||||
|
useUnmergedTree = true
|
||||||
|
}
|
||||||
|
|
||||||
|
val doneButton: KNode = child {
|
||||||
|
hasTestTag(TangemPayTestTags.DAILY_LIMIT_DONE_BUTTON)
|
||||||
|
useUnmergedTree = true
|
||||||
|
}
|
||||||
|
|
||||||
|
fun presetChip(rawValue: String): KNode = child {
|
||||||
|
hasTestTag(TangemPayTestTags.dailyLimitPresetChip(rawValue))
|
||||||
|
useUnmergedTree = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal fun BaseTestCase.onTangemPayDailyLimitScreen(function: TangemPayDailyLimitPageObject.() -> Unit) =
|
||||||
|
onComposeScreen(composeTestRule, function)
|
||||||
|
|
@ -0,0 +1,204 @@
|
||||||
|
package com.tangem.tests.tangempay
|
||||||
|
|
||||||
|
import com.tangem.common.BaseTestCase
|
||||||
|
import com.tangem.common.constants.TestConstants.TANGEM_PAY_ELIGIBILITY_SCENARIO
|
||||||
|
import com.tangem.common.constants.TestConstants.WAIT_UNTIL_TIMEOUT_LONG
|
||||||
|
import com.tangem.common.extensions.assertTextContainsSafe
|
||||||
|
import com.tangem.common.extensions.clickWithAssertion
|
||||||
|
import com.tangem.common.utils.resetWireMockScenarioState
|
||||||
|
import com.tangem.common.utils.resetWireMockScenarios
|
||||||
|
import com.tangem.common.utils.setWireMockScenarioState
|
||||||
|
import com.tangem.core.res.R as CoreResR
|
||||||
|
import com.tangem.scenarios.openTangemPayDailyLimitSetup
|
||||||
|
import com.tangem.screens.onDialog
|
||||||
|
import com.tangem.screens.tangempay.onTangemPayCardPageScreen
|
||||||
|
import com.tangem.screens.tangempay.onTangemPayDailyLimitScreen
|
||||||
|
import dagger.hilt.android.testing.HiltAndroidTest
|
||||||
|
import io.github.kakaocup.kakao.common.utilities.getResourceString
|
||||||
|
import io.qameta.allure.kotlin.AllureId
|
||||||
|
import io.qameta.allure.kotlin.junit4.DisplayName
|
||||||
|
import org.junit.Test
|
||||||
|
|
||||||
|
@HiltAndroidTest
|
||||||
|
class TangemPayDailyLimitTest : BaseTestCase() {
|
||||||
|
|
||||||
|
private val dailyLimitScenario = "tangem_pay_daily_limit"
|
||||||
|
private val highLimitState = "HighLimit"
|
||||||
|
private val setErrorState = "SetError"
|
||||||
|
private val eligibilityState = "PaeraCustomer"
|
||||||
|
|
||||||
|
@AllureId("9726")
|
||||||
|
@DisplayName("Tangem Pay: daily limit screen is displayed correctly")
|
||||||
|
@Test
|
||||||
|
fun dailyLimitScreenIsDisplayedCorrectlyTest() {
|
||||||
|
setupHooks(
|
||||||
|
additionalBeforeSection = {
|
||||||
|
resetWireMockScenarios()
|
||||||
|
setWireMockScenarioState(TANGEM_PAY_ELIGIBILITY_SCENARIO, eligibilityState)
|
||||||
|
setWireMockScenarioState(dailyLimitScenario, highLimitState)
|
||||||
|
},
|
||||||
|
additionalAfterSection = {
|
||||||
|
resetWireMockScenarioState(TANGEM_PAY_ELIGIBILITY_SCENARIO)
|
||||||
|
resetWireMockScenarioState(dailyLimitScenario)
|
||||||
|
},
|
||||||
|
).run {
|
||||||
|
step("Open daily limit setup screen") { openTangemPayDailyLimitSetup() }
|
||||||
|
step("Assert amount field is displayed") {
|
||||||
|
onTangemPayDailyLimitScreen { amountField.assertIsDisplayed() }
|
||||||
|
}
|
||||||
|
step("Assert hint is displayed") {
|
||||||
|
onTangemPayDailyLimitScreen { hint.assertIsDisplayed() }
|
||||||
|
}
|
||||||
|
step("Assert 'Set limits' button is displayed") {
|
||||||
|
onTangemPayDailyLimitScreen { setLimitsButton.assertIsDisplayed() }
|
||||||
|
}
|
||||||
|
step("Assert quick value preset '1' is displayed") {
|
||||||
|
onTangemPayDailyLimitScreen { presetChip("1").assertIsDisplayed() }
|
||||||
|
}
|
||||||
|
step("Assert quick value preset '5000' is displayed") {
|
||||||
|
onTangemPayDailyLimitScreen { presetChip("5000").assertIsDisplayed() }
|
||||||
|
}
|
||||||
|
step("Assert quick value preset '10000' is displayed") {
|
||||||
|
onTangemPayDailyLimitScreen { presetChip("10000").assertIsDisplayed() }
|
||||||
|
}
|
||||||
|
step("Assert quick value preset '25000' is displayed") {
|
||||||
|
onTangemPayDailyLimitScreen { presetChip("25000").assertIsDisplayed() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@AllureId("9724")
|
||||||
|
@DisplayName("Tangem Pay: selected quick value is applied to the amount field")
|
||||||
|
@Test
|
||||||
|
fun selectedQuickValueIsAppliedToAmountFieldTest() {
|
||||||
|
val presetValue = "5000"
|
||||||
|
|
||||||
|
setupHooks(
|
||||||
|
additionalBeforeSection = {
|
||||||
|
resetWireMockScenarios()
|
||||||
|
setWireMockScenarioState(TANGEM_PAY_ELIGIBILITY_SCENARIO, eligibilityState)
|
||||||
|
setWireMockScenarioState(dailyLimitScenario, highLimitState)
|
||||||
|
},
|
||||||
|
additionalAfterSection = {
|
||||||
|
resetWireMockScenarioState(TANGEM_PAY_ELIGIBILITY_SCENARIO)
|
||||||
|
resetWireMockScenarioState(dailyLimitScenario)
|
||||||
|
},
|
||||||
|
).run {
|
||||||
|
step("Open daily limit setup screen") { openTangemPayDailyLimitSetup() }
|
||||||
|
step("Click on '$presetValue' quick value preset") {
|
||||||
|
onTangemPayDailyLimitScreen { presetChip(presetValue).clickWithAssertion() }
|
||||||
|
}
|
||||||
|
step("Assert amount field contains '$presetValue'") {
|
||||||
|
onTangemPayDailyLimitScreen { amountField.assertTextContainsSafe(presetValue) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@AllureId("9725")
|
||||||
|
@DisplayName("Tangem Pay: 'Set limits' is disabled when the amount is above the limit")
|
||||||
|
@Test
|
||||||
|
fun setLimitsIsDisabledWhenAmountAboveLimitTest() {
|
||||||
|
val amountAboveLimit = "300000"
|
||||||
|
|
||||||
|
setupHooks(
|
||||||
|
additionalBeforeSection = {
|
||||||
|
resetWireMockScenarios()
|
||||||
|
setWireMockScenarioState(TANGEM_PAY_ELIGIBILITY_SCENARIO, eligibilityState)
|
||||||
|
setWireMockScenarioState(dailyLimitScenario, highLimitState)
|
||||||
|
},
|
||||||
|
additionalAfterSection = {
|
||||||
|
resetWireMockScenarioState(TANGEM_PAY_ELIGIBILITY_SCENARIO)
|
||||||
|
resetWireMockScenarioState(dailyLimitScenario)
|
||||||
|
},
|
||||||
|
).run {
|
||||||
|
step("Open daily limit setup screen") { openTangemPayDailyLimitSetup() }
|
||||||
|
step("Enter amount '$amountAboveLimit' above the limit") {
|
||||||
|
onTangemPayDailyLimitScreen { amountField.performTextReplacement(amountAboveLimit) }
|
||||||
|
}
|
||||||
|
step("Assert 'Set limits' button is not enabled") {
|
||||||
|
onTangemPayDailyLimitScreen { setLimitsButton.assertIsNotEnabled() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@AllureId("9739")
|
||||||
|
@DisplayName("Tangem Pay: successful daily limit setup")
|
||||||
|
@Test
|
||||||
|
fun successfulDailyLimitSetupTest() {
|
||||||
|
val newLimit = "5000"
|
||||||
|
val displayedLimit = "5,000"
|
||||||
|
|
||||||
|
setupHooks(
|
||||||
|
additionalBeforeSection = {
|
||||||
|
resetWireMockScenarios()
|
||||||
|
setWireMockScenarioState(TANGEM_PAY_ELIGIBILITY_SCENARIO, eligibilityState)
|
||||||
|
setWireMockScenarioState(dailyLimitScenario, highLimitState)
|
||||||
|
},
|
||||||
|
additionalAfterSection = {
|
||||||
|
resetWireMockScenarioState(TANGEM_PAY_ELIGIBILITY_SCENARIO)
|
||||||
|
resetWireMockScenarioState(dailyLimitScenario)
|
||||||
|
},
|
||||||
|
).run {
|
||||||
|
step("Open daily limit setup screen") { openTangemPayDailyLimitSetup() }
|
||||||
|
step("Enter amount '$newLimit'") {
|
||||||
|
onTangemPayDailyLimitScreen { amountField.performTextReplacement(newLimit) }
|
||||||
|
}
|
||||||
|
step("Click on 'Set limits' button") {
|
||||||
|
onTangemPayDailyLimitScreen { setLimitsButton.clickWithAssertion() }
|
||||||
|
}
|
||||||
|
step("Assert daily limit success screen is displayed") {
|
||||||
|
flakySafely(WAIT_UNTIL_TIMEOUT_LONG) {
|
||||||
|
onTangemPayDailyLimitScreen { successTitle.assertIsDisplayed() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
step("Click on 'Done' button") {
|
||||||
|
onTangemPayDailyLimitScreen { doneButton.clickWithAssertion() }
|
||||||
|
}
|
||||||
|
step("Assert daily limit value contains '$displayedLimit'") {
|
||||||
|
flakySafely(WAIT_UNTIL_TIMEOUT_LONG) {
|
||||||
|
onTangemPayCardPageScreen {
|
||||||
|
dailyLimitValue.assertTextContainsSafe(displayedLimit, substring = true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@AllureId("9727")
|
||||||
|
@DisplayName("Tangem Pay: error is shown when the limit change fails")
|
||||||
|
@Test
|
||||||
|
fun errorIsShownWhenLimitChangeFailsTest() {
|
||||||
|
val newLimit = "5000"
|
||||||
|
val errorTitle = getResourceString(CoreResR.string.common_something_went_wrong)
|
||||||
|
|
||||||
|
setupHooks(
|
||||||
|
additionalBeforeSection = {
|
||||||
|
resetWireMockScenarios()
|
||||||
|
setWireMockScenarioState(TANGEM_PAY_ELIGIBILITY_SCENARIO, eligibilityState)
|
||||||
|
setWireMockScenarioState(dailyLimitScenario, setErrorState)
|
||||||
|
},
|
||||||
|
additionalAfterSection = {
|
||||||
|
resetWireMockScenarioState(TANGEM_PAY_ELIGIBILITY_SCENARIO)
|
||||||
|
resetWireMockScenarioState(dailyLimitScenario)
|
||||||
|
},
|
||||||
|
).run {
|
||||||
|
step("Open daily limit setup screen") { openTangemPayDailyLimitSetup() }
|
||||||
|
step("Enter amount '$newLimit'") {
|
||||||
|
onTangemPayDailyLimitScreen { amountField.performTextReplacement(newLimit) }
|
||||||
|
}
|
||||||
|
step("Click on 'Set limits' button") {
|
||||||
|
onTangemPayDailyLimitScreen { setLimitsButton.clickWithAssertion() }
|
||||||
|
}
|
||||||
|
step("Assert limit change error dialog is displayed") {
|
||||||
|
flakySafely(WAIT_UNTIL_TIMEOUT_LONG) {
|
||||||
|
onDialog {
|
||||||
|
title.assertTextContainsSafe(errorTitle)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
step("Click on 'OK' button") {
|
||||||
|
onDialog { okButton.clickWithAssertion() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -51,4 +51,18 @@ object TangemPayTestTags {
|
||||||
const val PIN_SUCCESS_TITLE = "TANGEM_PAY_PIN_SUCCESS_TITLE"
|
const val PIN_SUCCESS_TITLE = "TANGEM_PAY_PIN_SUCCESS_TITLE"
|
||||||
const val PIN_SUCCESS_DESCRIPTION = "TANGEM_PAY_PIN_SUCCESS_DESCRIPTION"
|
const val PIN_SUCCESS_DESCRIPTION = "TANGEM_PAY_PIN_SUCCESS_DESCRIPTION"
|
||||||
const val PIN_DONE_BUTTON = "TANGEM_PAY_PIN_DONE_BUTTON"
|
const val PIN_DONE_BUTTON = "TANGEM_PAY_PIN_DONE_BUTTON"
|
||||||
|
|
||||||
|
// Daily limit block (card page)
|
||||||
|
const val DAILY_LIMIT_CHANGE_BUTTON = "TANGEM_PAY_DAILY_LIMIT_CHANGE_BUTTON"
|
||||||
|
const val DAILY_LIMIT_CURRENT_VALUE = "TANGEM_PAY_DAILY_LIMIT_CURRENT_VALUE"
|
||||||
|
|
||||||
|
// Daily limit setup screen (amount field reuses SendScreenTestTags.INPUT_TEXT_FIELD from AmountTextField)
|
||||||
|
const val DAILY_LIMIT_HINT = "TANGEM_PAY_DAILY_LIMIT_HINT"
|
||||||
|
const val DAILY_LIMIT_SET_BUTTON = "TANGEM_PAY_DAILY_LIMIT_SET_BUTTON"
|
||||||
|
|
||||||
|
// Daily limit success screen
|
||||||
|
const val DAILY_LIMIT_SUCCESS_TITLE = "TANGEM_PAY_DAILY_LIMIT_SUCCESS_TITLE"
|
||||||
|
const val DAILY_LIMIT_DONE_BUTTON = "TANGEM_PAY_DAILY_LIMIT_DONE_BUTTON"
|
||||||
|
|
||||||
|
fun dailyLimitPresetChip(rawValue: String): String = "TANGEM_PAY_DAILY_LIMIT_PRESET_$rawValue"
|
||||||
}
|
}
|
||||||
|
|
@ -14,6 +14,7 @@ import com.tangem.core.ui.format.bigdecimal.format
|
||||||
import com.tangem.core.ui.format.bigdecimal.getJavaCurrencyByCode
|
import com.tangem.core.ui.format.bigdecimal.getJavaCurrencyByCode
|
||||||
import com.tangem.core.ui.format.bigdecimal.optionalDecimals
|
import com.tangem.core.ui.format.bigdecimal.optionalDecimals
|
||||||
import com.tangem.core.ui.message.DialogMessage
|
import com.tangem.core.ui.message.DialogMessage
|
||||||
|
import com.tangem.core.ui.test.TangemPayTestTags
|
||||||
import com.tangem.domain.models.StatusSource
|
import com.tangem.domain.models.StatusSource
|
||||||
import com.tangem.domain.models.account.PaymentAccountStatusValue
|
import com.tangem.domain.models.account.PaymentAccountStatusValue
|
||||||
import com.tangem.domain.models.account.findCardWithId
|
import com.tangem.domain.models.account.findCardWithId
|
||||||
|
|
@ -201,6 +202,7 @@ internal class TangemPayCardLimitSetupModel @Inject constructor(
|
||||||
val label = preset.format { fiat(currency.currencyCode, currency.symbol).optionalDecimals() }
|
val label = preset.format { fiat(currency.currencyCode, currency.symbol).optionalDecimals() }
|
||||||
TangemPayCardLimitSetupUM.LimitPresetUM(
|
TangemPayCardLimitSetupUM.LimitPresetUM(
|
||||||
label = label,
|
label = label,
|
||||||
|
testTag = TangemPayTestTags.dailyLimitPresetChip(preset.stripTrailingZeros().toPlainString()),
|
||||||
onClick = { onPresetClick(preset) },
|
onClick = { onPresetClick(preset) },
|
||||||
)
|
)
|
||||||
}.toPersistentList()
|
}.toPersistentList()
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
|
import androidx.compose.ui.platform.testTag
|
||||||
import androidx.compose.ui.text.input.KeyboardType
|
import androidx.compose.ui.text.input.KeyboardType
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
|
|
@ -30,6 +31,7 @@ import com.tangem.core.ui.extensions.resolveReference
|
||||||
import com.tangem.core.ui.extensions.resourceReference
|
import com.tangem.core.ui.extensions.resourceReference
|
||||||
import com.tangem.core.ui.res.TangemTheme
|
import com.tangem.core.ui.res.TangemTheme
|
||||||
import com.tangem.core.ui.res.TangemThemePreviewRedesign
|
import com.tangem.core.ui.res.TangemThemePreviewRedesign
|
||||||
|
import com.tangem.core.ui.test.TangemPayTestTags
|
||||||
import com.tangem.core.ui.utils.rememberDecimalFormat
|
import com.tangem.core.ui.utils.rememberDecimalFormat
|
||||||
import com.tangem.features.tangempay.details.impl.R
|
import com.tangem.features.tangempay.details.impl.R
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
import kotlinx.collections.immutable.ImmutableList
|
||||||
|
|
@ -79,7 +81,8 @@ private fun Content(state: TangemPayCardLimitSetupUM, modifier: Modifier = Modif
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(horizontal = TangemTheme.dimens2.x4)
|
.padding(horizontal = TangemTheme.dimens2.x4)
|
||||||
.padding(top = TangemTheme.dimens2.x3),
|
.padding(top = TangemTheme.dimens2.x3)
|
||||||
|
.testTag(TangemPayTestTags.DAILY_LIMIT_SET_BUTTON),
|
||||||
size = TangemButton.Size.X12,
|
size = TangemButton.Size.X12,
|
||||||
text = resourceReference(R.string.tangempay_daily_limit_set_button),
|
text = resourceReference(R.string.tangempay_daily_limit_set_button),
|
||||||
onClick = state.onSubmitClick,
|
onClick = state.onSubmitClick,
|
||||||
|
|
@ -99,6 +102,7 @@ private fun AmountBlock(state: TangemPayCardLimitSetupUM, modifier: Modifier = M
|
||||||
verticalArrangement = Arrangement.spacedBy(TangemTheme.dimens2.x3),
|
verticalArrangement = Arrangement.spacedBy(TangemTheme.dimens2.x3),
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
|
modifier = Modifier.testTag(TangemPayTestTags.DAILY_LIMIT_HINT),
|
||||||
text = state.subtitle.resolveReference(),
|
text = state.subtitle.resolveReference(),
|
||||||
style = TangemTheme.typography3.subheading.medium,
|
style = TangemTheme.typography3.subheading.medium,
|
||||||
color = TangemTheme.colors3.text.tertiary,
|
color = TangemTheme.colors3.text.tertiary,
|
||||||
|
|
@ -158,6 +162,7 @@ private fun PresetChip(preset: TangemPayCardLimitSetupUM.LimitPresetUM, modifier
|
||||||
.clip(RoundedCornerShape(14.dp))
|
.clip(RoundedCornerShape(14.dp))
|
||||||
.background(TangemTheme.colors3.bg.tertiary)
|
.background(TangemTheme.colors3.bg.tertiary)
|
||||||
.clickable(onClick = preset.onClick)
|
.clickable(onClick = preset.onClick)
|
||||||
|
.testTag(preset.testTag)
|
||||||
.padding(horizontal = TangemTheme.dimens2.x5, vertical = TangemTheme.dimens2.x1)
|
.padding(horizontal = TangemTheme.dimens2.x5, vertical = TangemTheme.dimens2.x1)
|
||||||
.wrapContentHeight(),
|
.wrapContentHeight(),
|
||||||
horizontalArrangement = Arrangement.Center,
|
horizontalArrangement = Arrangement.Center,
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import com.tangem.core.ui.extensions.resourceReference
|
import com.tangem.core.ui.extensions.resourceReference
|
||||||
import com.tangem.core.ui.res.TangemThemePreviewRedesign
|
import com.tangem.core.ui.res.TangemThemePreviewRedesign
|
||||||
|
import com.tangem.core.ui.test.TangemPayTestTags
|
||||||
import com.tangem.features.tangempay.details.impl.R
|
import com.tangem.features.tangempay.details.impl.R
|
||||||
import com.tangem.features.tangempay.ui.components.TangemPaySuccessScreenWrapper
|
import com.tangem.features.tangempay.ui.components.TangemPaySuccessScreenWrapper
|
||||||
|
|
||||||
|
|
@ -16,6 +17,8 @@ internal fun TangemPayCardLimitSetupSuccessScreenV2(onDoneClick: () -> Unit, mod
|
||||||
subtitle = resourceReference(R.string.tangempay_card_page_daily_limit_success_description),
|
subtitle = resourceReference(R.string.tangempay_card_page_daily_limit_success_description),
|
||||||
buttonText = resourceReference(R.string.common_done),
|
buttonText = resourceReference(R.string.common_done),
|
||||||
onButtonClick = onDoneClick,
|
onButtonClick = onDoneClick,
|
||||||
|
titleTestTag = TangemPayTestTags.DAILY_LIMIT_SUCCESS_TITLE,
|
||||||
|
buttonTestTag = TangemPayTestTags.DAILY_LIMIT_DONE_BUTTON,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.tangem.features.tangempay.limit.setup
|
||||||
|
|
||||||
import androidx.compose.runtime.Immutable
|
import androidx.compose.runtime.Immutable
|
||||||
import com.tangem.core.ui.extensions.TextReference
|
import com.tangem.core.ui.extensions.TextReference
|
||||||
|
import com.tangem.core.ui.test.TangemPayTestTags
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
import kotlinx.collections.immutable.ImmutableList
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
import kotlinx.collections.immutable.persistentListOf
|
||||||
|
|
||||||
|
|
@ -28,6 +29,7 @@ internal data class TangemPayCardLimitSetupUM(
|
||||||
@Immutable
|
@Immutable
|
||||||
internal data class LimitPresetUM(
|
internal data class LimitPresetUM(
|
||||||
val label: String,
|
val label: String,
|
||||||
|
val testTag: String,
|
||||||
val onClick: () -> Unit,
|
val onClick: () -> Unit,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -42,10 +44,26 @@ internal data class TangemPayCardLimitSetupUM(
|
||||||
subtitle: TextReference = TextReference.Str("Set a limit from $0 to $50,000"),
|
subtitle: TextReference = TextReference.Str("Set a limit from $0 to $50,000"),
|
||||||
currencyCode: String = "$",
|
currencyCode: String = "$",
|
||||||
presets: ImmutableList<LimitPresetUM> = persistentListOf(
|
presets: ImmutableList<LimitPresetUM> = persistentListOf(
|
||||||
LimitPresetUM(label = "$0", onClick = {}),
|
LimitPresetUM(
|
||||||
LimitPresetUM(label = "$5,000", onClick = {}),
|
label = "$0",
|
||||||
LimitPresetUM(label = "$10,000", onClick = {}),
|
testTag = TangemPayTestTags.dailyLimitPresetChip("0"),
|
||||||
LimitPresetUM(label = "$25,000", onClick = {}),
|
onClick = {},
|
||||||
|
),
|
||||||
|
LimitPresetUM(
|
||||||
|
label = "$5,000",
|
||||||
|
testTag = TangemPayTestTags.dailyLimitPresetChip("5000"),
|
||||||
|
onClick = {},
|
||||||
|
),
|
||||||
|
LimitPresetUM(
|
||||||
|
label = "$10,000",
|
||||||
|
testTag = TangemPayTestTags.dailyLimitPresetChip("10000"),
|
||||||
|
onClick = {},
|
||||||
|
),
|
||||||
|
LimitPresetUM(
|
||||||
|
label = "$25,000",
|
||||||
|
testTag = TangemPayTestTags.dailyLimitPresetChip("25000"),
|
||||||
|
onClick = {},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
submitButtonEnabled: Boolean = true,
|
submitButtonEnabled: Boolean = true,
|
||||||
submitButtonLoading: Boolean = false,
|
submitButtonLoading: Boolean = false,
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.graphics.vector.ImageVector
|
import androidx.compose.ui.graphics.vector.ImageVector
|
||||||
import androidx.compose.ui.layout.layoutId
|
import androidx.compose.ui.layout.layoutId
|
||||||
|
import androidx.compose.ui.platform.testTag
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.res.vectorResource
|
import androidx.compose.ui.res.vectorResource
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
|
|
@ -34,6 +35,7 @@ import com.tangem.core.ui.extensions.stringResourceSafe
|
||||||
import com.tangem.core.ui.res.*
|
import com.tangem.core.ui.res.*
|
||||||
import com.tangem.core.ui.res.generated.icons.Icons
|
import com.tangem.core.ui.res.generated.icons.Icons
|
||||||
import com.tangem.core.ui.res.generated.icons.ic_arrow_refresh_32
|
import com.tangem.core.ui.res.generated.icons.ic_arrow_refresh_32
|
||||||
|
import com.tangem.core.ui.test.TangemPayTestTags
|
||||||
import com.tangem.features.tangempay.details.impl.R
|
import com.tangem.features.tangempay.details.impl.R
|
||||||
import com.tangem.features.tangempay.entity.TangemPayDailyLimitBlockState
|
import com.tangem.features.tangempay.entity.TangemPayDailyLimitBlockState
|
||||||
|
|
||||||
|
|
@ -159,7 +161,8 @@ private fun CurrentLimitBlockV2(state: TangemPayDailyLimitBlockState, modifier:
|
||||||
TangemButton(
|
TangemButton(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(start = TangemTheme.dimens2.x3)
|
.padding(start = TangemTheme.dimens2.x3)
|
||||||
.layoutId(TangemRowLayoutId.TAIL),
|
.layoutId(TangemRowLayoutId.TAIL)
|
||||||
|
.testTag(TangemPayTestTags.DAILY_LIMIT_CHANGE_BUTTON),
|
||||||
variant = TangemButton.Variant.Secondary,
|
variant = TangemButton.Variant.Secondary,
|
||||||
text = resourceReference(R.string.tangempay_card_page_daily_limit_change),
|
text = resourceReference(R.string.tangempay_card_page_daily_limit_change),
|
||||||
onClick = state.onChangeClick,
|
onClick = state.onChangeClick,
|
||||||
|
|
@ -264,7 +267,7 @@ private fun SubtitleLimit(state: TangemPayDailyLimitBlockState, modifier: Modifi
|
||||||
}
|
}
|
||||||
is TangemPayDailyLimitBlockState.Content -> {
|
is TangemPayDailyLimitBlockState.Content -> {
|
||||||
Text(
|
Text(
|
||||||
modifier = modifier,
|
modifier = modifier.testTag(TangemPayTestTags.DAILY_LIMIT_CURRENT_VALUE),
|
||||||
text = state.limit,
|
text = state.limit,
|
||||||
style = TangemTheme.typography3.body.medium,
|
style = TangemTheme.typography3.body.medium,
|
||||||
color = TangemTheme.colors3.text.primary,
|
color = TangemTheme.colors3.text.primary,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue