Updated on 2026-08-14

This commit is contained in:
Tangem 2026-06-24 17:38:32 +02:00
parent bf34edf3f7
commit b1e46496b7
9 changed files with 781 additions and 2 deletions

View file

@ -11,6 +11,7 @@ import com.tangem.common.constants.TestConstants.HOLD_DURATION_MS
import com.tangem.common.constants.TestConstants.WAIT_UNTIL_TIMEOUT_LONG
import com.tangem.common.constants.TestConstants.WAIT_UNTIL_TIMEOUT_VERY_LONG
import com.tangem.common.extensions.assertVisibility
import com.tangem.common.extensions.clickAndWaitFor
import com.tangem.common.extensions.clickWhenEnabled
import com.tangem.common.extensions.clickWithAssertion
import com.tangem.common.extensions.extractText
@ -18,6 +19,7 @@ import com.tangem.core.ui.R as CoreUiR
import com.tangem.core.ui.test.BaseButtonTestTags
import com.tangem.core.ui.test.HotWalletAccessCodeTestTags
import com.tangem.screens.*
import com.tangem.tap.domain.sdk.mocks.MockContent
import io.github.kakaocup.kakao.common.utilities.getResourceString
import io.qameta.allure.kotlin.Allure.step
import com.tangem.common.ui.R as CommonUiR
@ -260,6 +262,56 @@ fun BaseTestCase.checkSwapWarning(
}
}
/** Opens Swap for [tokenName] in [fromAccountName] and picks it again in [toAccountName] to enter Transfer mode; needs a two-accounts-same-token mock. */
fun BaseTestCase.openSwapInTransferMode(
tokenName: String,
fromAccountName: String = "Account 1",
toAccountName: String = "Account 2",
mockContent: MockContent? = null,
) {
step("Open 'Main' screen") {
openMainScreen(mockContent = mockContent)
}
step("Synchronize addresses") {
synchronizeAddresses()
}
step("Scroll '$fromAccountName' into view (semantics, not touch — avoids the Markets sheet)") {
onMainScreen { scrollToAccount(fromAccountName) }
}
step("Expand account '$fromAccountName' and reveal token '$tokenName'") {
onMainScreen {
findAccountSectionByName(fromAccountName).clickAndWaitFor(
rule = composeTestRule,
expectedCondition = {
onMainScreen { findTokenInAnyAccountByName(tokenName).assertIsDisplayed() }
},
)
}
}
step("Click on token with name: '$tokenName'") {
onMainScreen { findTokenInAnyAccountByName(tokenName).clickWithAssertion() }
}
step("Open 'Swap' screen") {
openSwapScreen(from = SwapEntryPoint.TokenDetails, storiesExist = false)
}
step("Choose identical receive token '$tokenName' from '$toAccountName'") {
chooseIdenticalReceiveToken(tokenName = tokenName, receiveAccountName = toAccountName)
}
}
/** Picks the identical [tokenName] in [receiveAccountName]; the receive list collapses the other account, so its header is expanded first. */
fun BaseTestCase.chooseIdenticalReceiveToken(tokenName: String, receiveAccountName: String) {
step("Click on 'Choose token' button") {
onSwapTokenScreen { chooseTokenButton.performClick() }
}
step("Expand account '$receiveAccountName' in receive selector") {
onSwapSelectTokenScreen { tokenWithName(receiveAccountName).performClick() }
}
step("Click on token with name '$tokenName'") {
onSwapSelectTokenScreen { tokenWithName(tokenName).performClick() }
}
}
fun BaseTestCase.chooseReceiveToken(tokenName: String) {
step("Click on 'Choose token' button") {
onSwapTokenScreen { chooseTokenButton.performClick() }

View file

@ -102,6 +102,15 @@ class MainScreenPageObject(private val semanticsProvider: SemanticsNodeInteracti
}
}
/** Scrolls to [accountName] via ScrollToIndex semantics, not a touch swipe — a bottom-edge drag is stolen by the Markets sheet's nested scroll. */
@OptIn(ExperimentalTestApi::class)
fun scrollToAccount(accountName: String) {
semanticsProvider.onNode(withTestTag(MainScreenTestTags.SCREEN_CONTAINER))
.performScrollToNode(
withTestTag(MainScreenTestTags.ACCOUNT_LIST_ITEM) and hasAnyDescendant(withText(accountName)),
)
}
val restoringProgressText: KNode = child {
hasTestTag(MainScreenTestTags.SYNC_PROGRESS_TEXT)
useUnmergedTree = true

View file

@ -130,6 +130,12 @@ class SwapTokenPageObject(semanticsProvider: SemanticsNodeInteractionsProvider)
useUnmergedTree = true
}
fun insufficientFeeForTransferNotificationTitle(feeCoinName: String): KNode = child {
hasTestTag(NotificationTestTags.TITLE)
hasText(getResourceString(R.string.warning_send_blocked_funds_for_fee_title, feeCoinName))
useUnmergedTree = true
}
fun warningTitle(title: String): KNode = child {
hasTestTag(NotificationTestTags.TITLE)
hasText(title)
@ -158,6 +164,23 @@ class SwapTokenPageObject(semanticsProvider: SemanticsNodeInteractionsProvider)
hasText(getResourceString(R.string.common_swap))
}
val transferButton: KNode = child {
hasTestTag(BaseButtonTestTags.BUTTON)
hasText(getResourceString(R.string.swapping_transfer_action))
}
val transferTitle: KNode = child {
hasTestTag(TopAppBarTestTags.TITLE)
hasText(getResourceString(R.string.common_transfer))
useUnmergedTree = true
}
// PercentPill testTag is the PredefinedPercentAmount enum name; MAX == "MAX".
val maxAmountButton: KNode = child {
hasTestTag("MAX")
useUnmergedTree = true
}
val youSwapBlock: KNode = child {
hasTestTag(SwapTokenScreenTestTags.SWAP_BLOCK_HEADER)
hasAnyDescendant(withText(getResourceString(R.string.swapping_from_title_v2)))

View file

@ -0,0 +1,495 @@
package com.tangem.tests.transfer
import com.tangem.common.BaseTestCase
import com.tangem.common.extensions.clickWithAssertion
import com.tangem.common.extensions.extractText
import com.tangem.common.constants.TestConstants.QUOTES_API_SCENARIO
import com.tangem.common.constants.TestConstants.USER_TOKENS_API_SCENARIO
import com.tangem.common.constants.TestConstants.WAIT_UNTIL_TIMEOUT_LONG
import com.tangem.common.utils.resetWireMockScenarioState
import com.tangem.common.utils.setWireMockScenarioState
import com.tangem.scenarios.*
import com.tangem.screens.*
import com.tangem.tap.domain.sdk.mocks.content.Wallet2WithDerivationsMockContent
import dagger.hilt.android.testing.HiltAndroidTest
import io.qameta.allure.kotlin.Allure.step
import io.qameta.allure.kotlin.AllureId
import io.qameta.allure.kotlin.junit4.DisplayName
import org.junit.Test
@HiltAndroidTest
class AppTransfersTest : BaseTestCase() {
private val ethCallScenario = "eth_call_api"
private val ethBalanceScenario = "eth_network_balance"
private val started = "Started"
// Disable the first-time-swap stories (500 → not shown); their auto-advancing animation keeps Compose non-idle and flakes the close.
private val storiesScenario = "stories_first_time_swap_v2"
private val storiesErrorState = "Error"
private fun BaseTestCase.assertTransferReady() {
step("Assert action button label is 'Transfer'") {
composeTestRule.waitUntil(timeoutMillis = WAIT_UNTIL_TIMEOUT_LONG) {
runCatching { onSwapTokenScreen { transferButton.assertIsDisplayed() } }.isSuccess
}
}
step("Assert provider block is not displayed") {
onSwapTokenScreen { providersBlock.assertIsNotDisplayed() }
}
}
private fun BaseTestCase.inputAmount(amount: String) {
step("Input amount '$amount'") {
waitForIdle()
onSwapTokenScreen {
textInput.clickWithAssertion()
textInput.performTextReplacement(amount)
}
}
}
private fun BaseTestCase.waitForFeeDisplayed() {
step("Assert fee amount is displayed") {
composeTestRule.waitUntil(timeoutMillis = WAIT_UNTIL_TIMEOUT_LONG) {
runCatching { onSwapTokenScreen { feeAmount.assertIsDisplayed() } }.isSuccess
}
}
}
@AllureId("9838")
@DisplayName("App transfers: identical pair switches to Transfer mode")
@Test
fun identicalPairSwitchesToTransferModeTest() {
val token = "Ethereum"
val amount = "0.001"
val userTokensState = "TwoAccountsSameToken"
setupHooks(
additionalBeforeAppLaunchSection = { setWireMockScenarioState(storiesScenario, storiesErrorState) },
additionalAfterSection = {
resetWireMockScenarioState(storiesScenario)
resetWireMockScenarioState(USER_TOKENS_API_SCENARIO)
resetWireMockScenarioState(ethCallScenario)
resetWireMockScenarioState(ethBalanceScenario)
}
).run {
step("Set WireMock scenario: '$USER_TOKENS_API_SCENARIO' to state: '$userTokensState'") {
setWireMockScenarioState(scenarioName = USER_TOKENS_API_SCENARIO, state = userTokensState)
}
step("Set WireMock scenario: '$ethCallScenario' to state: '$started'") {
setWireMockScenarioState(scenarioName = ethCallScenario, state = started)
}
step("Set WireMock scenario: '$ethBalanceScenario' to state: '$started'") {
setWireMockScenarioState(scenarioName = ethBalanceScenario, state = started)
}
step("Open Swap in Transfer mode for '$token'") { openSwapInTransferMode(token) }
inputAmount(amount)
assertTransferReady()
waitForFeeDisplayed()
}
}
@AllureId("9843")
@DisplayName("App transfers: zero amount keeps Transfer button disabled")
@Test
fun zeroAmountKeepsTransferButtonDisabledTest() {
val token = "Ethereum"
val userTokensState = "TwoAccountsSameToken"
setupHooks(
additionalBeforeAppLaunchSection = { setWireMockScenarioState(storiesScenario, storiesErrorState) },
additionalAfterSection = {
resetWireMockScenarioState(storiesScenario)
resetWireMockScenarioState(USER_TOKENS_API_SCENARIO)
resetWireMockScenarioState(ethCallScenario)
resetWireMockScenarioState(ethBalanceScenario)
}
).run {
step("Set WireMock scenario: '$USER_TOKENS_API_SCENARIO' to state: '$userTokensState'") {
setWireMockScenarioState(scenarioName = USER_TOKENS_API_SCENARIO, state = userTokensState)
}
step("Set WireMock scenario: '$ethCallScenario' to state: '$started'") {
setWireMockScenarioState(scenarioName = ethCallScenario, state = started)
}
step("Set WireMock scenario: '$ethBalanceScenario' to state: '$started'") {
setWireMockScenarioState(scenarioName = ethBalanceScenario, state = started)
}
step("Open Swap in Transfer mode for '$token'") { openSwapInTransferMode(token) }
step("Assert provider block is not displayed") {
onSwapTokenScreen { providersBlock.assertIsNotDisplayed() }
}
step("Assert 'Transfer' button is disabled") {
onSwapTokenScreen { transferButton.assertIsNotEnabled() }
}
}
}
@AllureId("9992")
@DisplayName("App transfers: reversing tokens keeps Transfer mode")
@Test
fun reversingTokensKeepsTransferModeTest() {
val token = "Ethereum"
val amount = "0.001"
val userTokensState = "TwoAccountsSameToken"
setupHooks(
additionalBeforeAppLaunchSection = { setWireMockScenarioState(storiesScenario, storiesErrorState) },
additionalAfterSection = {
resetWireMockScenarioState(storiesScenario)
resetWireMockScenarioState(USER_TOKENS_API_SCENARIO)
resetWireMockScenarioState(ethCallScenario)
resetWireMockScenarioState(ethBalanceScenario)
}
).run {
step("Set WireMock scenario: '$USER_TOKENS_API_SCENARIO' to state: '$userTokensState'") {
setWireMockScenarioState(scenarioName = USER_TOKENS_API_SCENARIO, state = userTokensState)
}
step("Set WireMock scenario: '$ethCallScenario' to state: '$started'") {
setWireMockScenarioState(scenarioName = ethCallScenario, state = started)
}
step("Set WireMock scenario: '$ethBalanceScenario' to state: '$started'") {
setWireMockScenarioState(scenarioName = ethBalanceScenario, state = started)
}
step("Open Swap in Transfer mode for '$token'") { openSwapInTransferMode(token) }
inputAmount(amount)
waitForFeeDisplayed()
step("Click on 'Swap tokens' (reverse) button") {
onSwapTokenScreen { replaceTokensButton.performClick() }
}
assertTransferReady()
}
}
@AllureId("9847")
@DisplayName("App transfers: Max amount keeps Transfer enabled and subtracts fee")
@Test
fun maxAmountFractionSubtractsFeeTest() {
val token = "Ethereum"
val userTokensState = "TwoAccountsSameToken"
setupHooks(
additionalBeforeAppLaunchSection = { setWireMockScenarioState(storiesScenario, storiesErrorState) },
additionalAfterSection = {
resetWireMockScenarioState(storiesScenario)
resetWireMockScenarioState(USER_TOKENS_API_SCENARIO)
resetWireMockScenarioState(ethCallScenario)
resetWireMockScenarioState(ethBalanceScenario)
}
).run {
step("Set WireMock scenario: '$USER_TOKENS_API_SCENARIO' to state: '$userTokensState'") {
setWireMockScenarioState(scenarioName = USER_TOKENS_API_SCENARIO, state = userTokensState)
}
step("Set WireMock scenario: '$ethCallScenario' to state: '$started'") {
setWireMockScenarioState(scenarioName = ethCallScenario, state = started)
}
step("Set WireMock scenario: '$ethBalanceScenario' to state: '$started'") {
setWireMockScenarioState(scenarioName = ethBalanceScenario, state = started)
}
step("Open Swap in Transfer mode for '$token'") { openSwapInTransferMode(token) }
step("Focus amount field to reveal predefined amount buttons") {
waitForIdle()
onSwapTokenScreen { textInput.clickWithAssertion() }
}
step("Click on 'Max' amount button") {
onSwapTokenScreen { maxAmountButton.performClick() }
}
waitForFeeDisplayed()
assertTransferReady()
step("Assert 'Transfer' button is enabled") {
composeTestRule.waitUntil(timeoutMillis = WAIT_UNTIL_TIMEOUT_LONG) {
runCatching { onSwapTokenScreen { transferButton.assertIsEnabled() } }.isSuccess
}
}
}
}
@AllureId("9844")
@DisplayName("App transfers: amount above balance disables Transfer")
@Test
fun amountAboveBalanceDisablesTransferTest() {
val token = "Ethereum"
val aboveBalanceAmount = "100"
val userTokensState = "TwoAccountsSameToken"
setupHooks(
additionalBeforeAppLaunchSection = { setWireMockScenarioState(storiesScenario, storiesErrorState) },
additionalAfterSection = {
resetWireMockScenarioState(storiesScenario)
resetWireMockScenarioState(USER_TOKENS_API_SCENARIO)
resetWireMockScenarioState(ethCallScenario)
resetWireMockScenarioState(ethBalanceScenario)
}
).run {
step("Set WireMock scenario: '$USER_TOKENS_API_SCENARIO' to state: '$userTokensState'") {
setWireMockScenarioState(scenarioName = USER_TOKENS_API_SCENARIO, state = userTokensState)
}
step("Set WireMock scenario: '$ethCallScenario' to state: '$started'") {
setWireMockScenarioState(scenarioName = ethCallScenario, state = started)
}
step("Set WireMock scenario: '$ethBalanceScenario' to state: '$started'") {
setWireMockScenarioState(scenarioName = ethBalanceScenario, state = started)
}
step("Open Swap in Transfer mode for '$token'") { openSwapInTransferMode(token) }
inputAmount(aboveBalanceAmount)
// Above-balance recalculates the fee forever (Compose never idles), so assert the "Insufficient funds" title, not button state.
step("Assert 'Insufficient funds' is displayed") {
composeTestRule.waitUntil(timeoutMillis = WAIT_UNTIL_TIMEOUT_LONG) {
runCatching { onSwapTokenScreen { insufficientFundsErrorTitle.assertIsDisplayed() } }.isSuccess
}
}
}
}
@AllureId("10003")
@DisplayName("App transfers: EVM network fee speed options")
@Test
fun evmNetworkFeeSpeedOptionsTest() {
val token = "Ethereum"
val amount = "0.001"
val userTokensState = "TwoAccountsSameToken"
setupHooks(
additionalBeforeAppLaunchSection = { setWireMockScenarioState(storiesScenario, storiesErrorState) },
additionalAfterSection = {
resetWireMockScenarioState(storiesScenario)
resetWireMockScenarioState(USER_TOKENS_API_SCENARIO)
resetWireMockScenarioState(ethCallScenario)
resetWireMockScenarioState(ethBalanceScenario)
}
).run {
step("Set WireMock scenario: '$USER_TOKENS_API_SCENARIO' to state: '$userTokensState'") {
setWireMockScenarioState(scenarioName = USER_TOKENS_API_SCENARIO, state = userTokensState)
}
step("Set WireMock scenario: '$ethCallScenario' to state: '$started'") {
setWireMockScenarioState(scenarioName = ethCallScenario, state = started)
}
step("Set WireMock scenario: '$ethBalanceScenario' to state: '$started'") {
setWireMockScenarioState(scenarioName = ethBalanceScenario, state = started)
}
step("Open Swap in Transfer mode for '$token'") { openSwapInTransferMode(token) }
inputAmount(amount)
waitForFeeDisplayed()
assertTransferReady()
var marketFee = ""
step("Read displayed 'Market' fee amount") {
onSwapTokenScreen { marketFee = feeAmount.extractText() }
}
step("Open 'Network fee' selector via 'Select fee' icon") {
composeTestRule.waitUntil(timeoutMillis = WAIT_UNTIL_TIMEOUT_LONG) {
runCatching { onSwapTokenScreen { selectFeeIcon.performClick() } }
runCatching { onSwapSelectNetworkFeeBottomSheet { fastSelectorItem.assertIsDisplayed() } }.isSuccess
}
}
step("Click on 'Fast' fee option") {
onSwapSelectNetworkFeeBottomSheet { fastSelectorItem.clickWithAssertion() }
}
step("Assert fee amount changed from Market fee") {
composeTestRule.waitUntil(timeoutMillis = WAIT_UNTIL_TIMEOUT_LONG) {
runCatching {
onSwapTokenScreen { feeAmount.assertIsDisplayed() }
}.isSuccess && onSwapTokenScreenFeeDiffers(marketFee)
}
}
}
}
@AllureId("10002")
@DisplayName("App transfers: UTXO network fee")
@Test
fun utxoNetworkFeeTest() {
val token = "Bitcoin"
val amount = "0.001"
val userTokensState = "TwoAccountsSameBitcoin"
val bitcoinUtxoScenario = "bitcoin_utxo"
val bitcoinUtxoState = "BalanceAnyAddress"
val assetsScenario = "express_api_assets"
val assetsBitcoinState = "BitcoinExchangeEnabled"
setupHooks(
additionalBeforeAppLaunchSection = { setWireMockScenarioState(storiesScenario, storiesErrorState) },
additionalAfterSection = {
resetWireMockScenarioState(storiesScenario)
resetWireMockScenarioState(USER_TOKENS_API_SCENARIO)
resetWireMockScenarioState(bitcoinUtxoScenario)
resetWireMockScenarioState(assetsScenario)
}
).run {
step("Set WireMock scenario: '$USER_TOKENS_API_SCENARIO' to state: '$userTokensState'") {
setWireMockScenarioState(scenarioName = USER_TOKENS_API_SCENARIO, state = userTokensState)
}
step("Set WireMock scenario: '$bitcoinUtxoScenario' to state: '$bitcoinUtxoState'") {
setWireMockScenarioState(scenarioName = bitcoinUtxoScenario, state = bitcoinUtxoState)
}
// Bitcoin swap must be exchange-enabled or the token-details Swap button stays disabled.
step("Set WireMock scenario: '$assetsScenario' to state: '$assetsBitcoinState'") {
setWireMockScenarioState(scenarioName = assetsScenario, state = assetsBitcoinState)
}
// V3 card: Bitcoin's default path is m/84' (matches the stub) so the coin isn't custom — else the Swap button stays disabled.
step("Open Swap in Transfer mode for '$token'") {
openSwapInTransferMode(token, mockContent = Wallet2WithDerivationsMockContent)
}
inputAmount(amount)
assertTransferReady()
waitForFeeDisplayed()
}
}
@AllureId("10004")
@DisplayName("App transfers: Solana network fee")
@Test
fun solanaNetworkFeeTest() {
val token = "Solana"
val amount = "0.001"
val userTokensState = "TwoAccountsSameSolana"
val solanaBalanceScenario = "solana_balance"
val quotesSolanaState = "Solana"
setupHooks(
additionalBeforeAppLaunchSection = { setWireMockScenarioState(storiesScenario, storiesErrorState) },
additionalAfterSection = {
resetWireMockScenarioState(storiesScenario)
resetWireMockScenarioState(USER_TOKENS_API_SCENARIO)
resetWireMockScenarioState(solanaBalanceScenario)
resetWireMockScenarioState(QUOTES_API_SCENARIO)
}
).run {
step("Set WireMock scenario: '$USER_TOKENS_API_SCENARIO' to state: '$userTokensState'") {
setWireMockScenarioState(scenarioName = USER_TOKENS_API_SCENARIO, state = userTokensState)
}
step("Set WireMock scenario: '$solanaBalanceScenario' to state: '$started'") {
setWireMockScenarioState(scenarioName = solanaBalanceScenario, state = started)
}
// Non-zero SOL price keeps total fiat > 0 so the empty-wallet banner doesn't push the account list under the Markets sheet.
step("Set WireMock scenario: '$QUOTES_API_SCENARIO' to state: '$quotesSolanaState'") {
setWireMockScenarioState(scenarioName = QUOTES_API_SCENARIO, state = quotesSolanaState)
}
step("Open Swap in Transfer mode for '$token'") { openSwapInTransferMode(token) }
inputAmount(amount)
assertTransferReady()
waitForFeeDisplayed()
}
}
@AllureId("9845")
@DisplayName("App transfers: insufficient native coin for fee disables Transfer")
@Test
fun insufficientNativeCoinForFeeDisablesTransferTest() {
val token = "Tether"
val feeCoinName = "Ethereum"
val amount = "0.001"
val userTokensState = "TwoAccountsSameUsdt"
// Zero native ETH (coin present in the mock so the fee still estimates) → fee exceeds balance.
val ethBalanceState = "EmptyAnyId"
val quotesUsdtState = "USDTHotWalletSvS"
val feeHistoryScenario = "eth_fee_history"
val estimateGasScenario = "eth_estimate_gas"
setupHooks(
additionalBeforeAppLaunchSection = { setWireMockScenarioState(storiesScenario, storiesErrorState) },
additionalAfterSection = {
resetWireMockScenarioState(storiesScenario)
resetWireMockScenarioState(USER_TOKENS_API_SCENARIO)
resetWireMockScenarioState(ethCallScenario)
resetWireMockScenarioState(ethBalanceScenario)
resetWireMockScenarioState(QUOTES_API_SCENARIO)
resetWireMockScenarioState(feeHistoryScenario)
resetWireMockScenarioState(estimateGasScenario)
}
).run {
step("Set WireMock scenario: '$USER_TOKENS_API_SCENARIO' to state: '$userTokensState'") {
setWireMockScenarioState(scenarioName = USER_TOKENS_API_SCENARIO, state = userTokensState)
}
step("Set WireMock scenario: '$ethCallScenario' to state: '$started'") {
setWireMockScenarioState(scenarioName = ethCallScenario, state = started)
}
step("Set WireMock scenario: '$ethBalanceScenario' to state: '$ethBalanceState'") {
setWireMockScenarioState(scenarioName = ethBalanceScenario, state = ethBalanceState)
}
step("Set WireMock scenario: '$QUOTES_API_SCENARIO' to state: '$quotesUsdtState'") {
setWireMockScenarioState(scenarioName = QUOTES_API_SCENARIO, state = quotesUsdtState)
}
step("Set WireMock scenario: '$feeHistoryScenario' to state: '$started'") {
setWireMockScenarioState(scenarioName = feeHistoryScenario, state = started)
}
step("Set WireMock scenario: '$estimateGasScenario' to state: '$started'") {
setWireMockScenarioState(scenarioName = estimateGasScenario, state = started)
}
step("Open Swap in Transfer mode for '$token'") { openSwapInTransferMode(token) }
inputAmount(amount)
step("Assert 'Insufficient $feeCoinName to cover network fee' notification is displayed") {
composeTestRule.waitUntil(timeoutMillis = WAIT_UNTIL_TIMEOUT_LONG) {
runCatching {
onSwapTokenScreen {
insufficientFeeForTransferNotificationTitle(feeCoinName).assertIsDisplayed()
}
}.isSuccess
}
}
}
}
@AllureId("9990")
@DisplayName("App transfers: search filters receive token list")
@Test
fun searchFiltersReceiveTokenListTest() {
val sourceToken = "Polygon"
val ethereumToken = "Ethereum"
val polygonReceiveName = "POL (ex-MATIC)"
val noMatchQuery = "f"
val polygonQuery = "pol"
setupHooks(
additionalBeforeAppLaunchSection = { setWireMockScenarioState(storiesScenario, storiesErrorState) },
additionalAfterSection = { resetWireMockScenarioState(storiesScenario) },
).run {
step("Open 'Main' screen") { openMainScreen() }
step("Synchronize addresses") { synchronizeAddresses() }
step("Click on token with name: '$sourceToken'") {
onMainScreen { tokenWithTitleAndAddress(sourceToken).clickWithAssertion() }
}
step("Open 'Swap' screen") { openSwapScreen(from = SwapEntryPoint.TokenDetails, storiesExist = false) }
step("Open receive token selector") {
onSwapTokenScreen { chooseTokenButton.performClick() }
}
step("Type '$noMatchQuery' in search field") {
onSwapSelectTokenScreen {
searchBarBlock.performClick()
searchBarBlock.performTextInput(noMatchQuery)
}
}
step("Assert '$ethereumToken' is not displayed") {
onSwapSelectTokenScreen { tokenWithName(ethereumToken).assertIsNotDisplayed() }
}
step("Assert '$polygonReceiveName' is not displayed") {
onSwapSelectTokenScreen { tokenWithName(polygonReceiveName).assertIsNotDisplayed() }
}
step("Replace search text with '$polygonQuery'") {
onSwapSelectTokenScreen { searchBarBlock.performTextReplacement(polygonQuery) }
}
step("Assert '$polygonReceiveName' is displayed") {
composeTestRule.waitUntil(timeoutMillis = WAIT_UNTIL_TIMEOUT_LONG) {
runCatching { onSwapSelectTokenScreen { tokenWithName(polygonReceiveName).assertIsDisplayed() } }.isSuccess
}
}
step("Assert '$ethereumToken' is not displayed") {
onSwapSelectTokenScreen { tokenWithName(ethereumToken).assertIsNotDisplayed() }
}
}
}
private fun BaseTestCase.onSwapTokenScreenFeeDiffers(previousFee: String): Boolean {
var current = ""
onSwapTokenScreen { current = feeAmount.extractText() }
return current.isNotEmpty() && current != previousFee
}
}

View file

@ -172,7 +172,16 @@ object WalletMockContent : MockContent {
remainingSignatures = null,
index = 1,
hasBackup = false,
derivedKeys = emptyMap(),
derivedKeys = mapOf(
DerivationPath("m/44'/501'/0'") to ExtendedPublicKey( // Solana (account 1)
publicKey = byteArrayOf(-65, -53, -62, -12, -57, -32, -38, -9, -128, -52, -83, -61, 73, 39, 41, 15, -74, -97, 38, 52, -101, 63, 74, -56, -20, 15, 57, -127, 114, -93, -17, -109),
chainCode = byteArrayOf(-81, 15, 125, 28, -115, -22, 87, 81, 87, -123, -25, -74, 86, 2, 1, 110, -115, 65, -110, 63, -64, 83, -93, -97, -104, 123, 12, -26, 94, 27, 84, -6),
),
DerivationPath("m/44'/501'/1'") to ExtendedPublicKey( // Solana (account 2)
publicKey = byteArrayOf(-65, -53, -62, -12, -57, -32, -38, -9, -128, -52, -83, -61, 73, 39, 41, 15, -74, -97, 38, 52, -101, 63, 74, -56, -20, 15, 57, -127, 114, -93, -17, -109),
chainCode = byteArrayOf(-81, 15, 125, 28, -115, -22, 87, 81, 87, -123, -25, -74, 86, 2, 1, 110, -115, 65, -110, 63, -64, 83, -93, -97, -104, 123, 12, -26, 94, 27, 84, -6),
),
),
extendedPublicKey = ExtendedPublicKey(
publicKey = byteArrayOf(-65, -53, -62, -12, -57, -32, -38, -9, -128, -52, -83, -61, 73, 39, 41, 15, -74, -97, 38, 52, -101, 63, 74, -56, -20, 15, 57, -127, 114, -93, -17, -109),
chainCode = byteArrayOf(-81, 15, 125, 28, -115, -22, 87, 81, 87, -123, -25, -74, 86, 2, 1, 110, -115, 65, -110, 63, -64, 83, -93, -97, -104, 123, 12, -26, 94, 27, 84, -6),
@ -218,6 +227,13 @@ object WalletMockContent : MockContent {
parentFingerprint = byteArrayOf(0, 0, 0, 0),
childNumber = 0,
),
DerivationPath("m/84'/0'/1'/0/0") to ExtendedPublicKey( // btc (account 2)
publicKey = byteArrayOf(3, 45, 58, -110, -52, -51, -83, -4, -45, -118, 119, 37, 123, -17, 66, -83, 61, -106, 115, 47, 121, 66, 84, -122, -57, -45, 7, -79, 70, -13, 28, -125, -52),
chainCode = byteArrayOf(93, 51, 52, -66, -39, -38, 34, -84, 50, 1, -127, -20, 80, -20, -30, -72, 2, 1, -78, -81, -17, 51, -52, -25, 12, 108, 50, 89, -66, 18, 65, 70),
depth = 0,
parentFingerprint = byteArrayOf(0, 0, 0, 0),
childNumber = 0,
),
DerivationPath("m/44'/60'/0'/0/0") to ExtendedPublicKey( // eth
publicKey = byteArrayOf(2, 34, 6, 119, -106, 5, -119, 111, -22, 8, 23, -108, -72, -56, 6, 77, -17, -61, -101, -85, 16, 28, 18, 3, -3, -89, -81, -108, 48, -7, -86, -82, -67),
chainCode = byteArrayOf(-75, 55, 107, -106, -37, -81, -15, 72, -102, 94, 55, -39, 9, -112, 1, 90, -50, 103, 53, 120, -92, -36, -85, -39, -65, 1, 88, 46, 92, 104, -13, -109),