Updated on 2026-08-14

This commit is contained in:
Tangem 2026-03-20 16:29:44 +03:00
parent 4d856572d8
commit 5855b3012f
8 changed files with 54 additions and 21 deletions

View file

@ -1,5 +1,6 @@
package com.tangem.common.extensions
import android.os.SystemClock
import androidx.compose.ui.test.ComposeTimeoutException
import androidx.compose.ui.test.hasText
import androidx.compose.ui.test.junit4.ComposeTestRule
@ -61,9 +62,14 @@ fun KNode.clickAndWaitFor(
fun KNode.performTextInputInChunks(
text: String,
chunkSize: Int = 2
chunkSize: Int = 2,
delayBetweenChunksMs: Long = 100
) {
text.chunked(chunkSize).forEach { chunk ->
val chunks = text.chunked(chunkSize)
chunks.forEachIndexed { index, chunk ->
performTextInput(chunk)
if (index < chunks.lastIndex) {
SystemClock.sleep(delayBetweenChunksMs)
}
}
}

View file

@ -6,6 +6,7 @@ import com.tangem.common.annotations.ApiEnv
import com.tangem.common.annotations.ApiEnvConfig
import com.tangem.common.constants.TestConstants.BITCOIN_ADDRESS
import com.tangem.common.constants.TestConstants.WAIT_UNTIL_TIMEOUT
import com.tangem.common.constants.TestConstants.WAIT_UNTIL_TIMEOUT_LONG
import com.tangem.common.extensions.*
import com.tangem.common.utils.assertClipboardTextEquals
import com.tangem.common.utils.clearClipboard
@ -599,22 +600,22 @@ class MainScreenActionButtonsTest : BaseTestCase() {
step("Reset Wiremock scenario: '$scenarioName'") {
resetWireMockScenarioState(scenarioName)
}
step("Perform pull to refresh") {
pullToRefresh(steps = 10)
waitForIdle()
}
step("Assert action buttons is enabled") {
assertActionButtonsForMultiCurrencyWallet(isEnabled = true)
step("Pull to refresh and wait for buttons to become enabled") {
flakySafely(WAIT_UNTIL_TIMEOUT_LONG, intervalMs = 2_000) {
pullToRefresh(10)
waitForIdle()
assertActionButtonsForMultiCurrencyWallet(isEnabled = true)
}
}
step("Set WireMock scenario: '$scenarioName' to state: '$scenarioState'") {
setWireMockScenarioState(scenarioName = scenarioName, state = scenarioState)
}
step("Perform pull to refresh") {
pullToRefresh(steps = 10)
waitForIdle()
}
step("Assert action buttons is not enabled") {
assertActionButtonsForMultiCurrencyWallet(isEnabled = false)
step("Pull to refresh and wait for buttons to become disabled") {
flakySafely(WAIT_UNTIL_TIMEOUT_LONG, intervalMs = 2_000) {
pullToRefresh(10)
waitForIdle()
assertActionButtonsForMultiCurrencyWallet(isEnabled = false)
}
}
}
}

View file

@ -104,6 +104,7 @@ class RecentBlockTest : BaseTestCase() {
@Test
fun recentBlockTransactionHistoryDoesNotSupportedTest() {
val tokenName = "Polkadot"
val fullTokenName = "Polkadot Asset Hub"
val sendAmount = "1"
setupHooks(
@ -113,7 +114,7 @@ class RecentBlockTest : BaseTestCase() {
}
).run {
step("Open 'Send Screen' with token: $tokenName") {
openSendScreen(tokenName)
openSendScreen(tokenName = fullTokenName, mockState = tokenName)
}
step("Type '$sendAmount' in input text field") {
onSendScreen {

View file

@ -27,6 +27,7 @@ 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.Ignore
import org.junit.Test
@HiltAndroidTest
@ -98,6 +99,7 @@ class SendAddressScreenTest : BaseTestCase() {
}
}
@Ignore("TODO: [REDACTED_JIRA]")
@AllureId("4543")
@DisplayName("Send (address screen): check address field")
@Test

View file

@ -17,6 +17,7 @@ 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.Ignore
import org.junit.Test
@HiltAndroidTest
@ -152,7 +153,11 @@ class SendConfirmScreenTest : BaseTestCase() {
step("Type recipient address") {
onSendAddressScreen { addressTextField.performTextReplacement(recipientAddress) }
}
step("Assert 'Addresses shimmer' is not displayed") {
onSendAddressScreen { addressesShimmer.assertIsNotDisplayed() }
}
step("Click on 'Next' button") {
waitForIdle()
onSendAddressScreen { nextButton.clickWithAssertion() }
}
step("Assert primary amount = '$tokenAmount'") {
@ -237,11 +242,13 @@ class SendConfirmScreenTest : BaseTestCase() {
}
}
@Ignore("TODO: [REDACTED_JIRA]")
@AllureId("554")
@DisplayName("Send (Confirm screen): check fee warning")
@Test
fun checkFeeWarningTest() {
val tokenName = "Polkadot"
val fullTokenName = "Polkadot Asset Hub"
val tokenAmount = "0.1"
val warningTitle = getResourceString(R.string.send_fee_unreachable_error_title)
val warningMessageResId = R.string.send_fee_unreachable_error_text
@ -256,7 +263,7 @@ class SendConfirmScreenTest : BaseTestCase() {
}
).run {
step("Open 'Send Screen' with token: $tokenName") {
openSendScreen(tokenName)
openSendScreen(tokenName = fullTokenName, mockState = tokenName)
}
step("Type '$tokenAmount' in input text field") {
onSendScreen {
@ -274,7 +281,11 @@ class SendConfirmScreenTest : BaseTestCase() {
step("Type address in input text field") {
onSendAddressScreen { addressTextField.performTextReplacement(POLKADOT_RECIPIENT_ADDRESS) }
}
step("Assert 'Addresses shimmer' is not displayed") {
onSendAddressScreen { addressesShimmer.assertIsNotDisplayed() }
}
step("Click on 'Next' button") {
waitForIdle()
onSendAddressScreen { nextButton.clickWithAssertion() }
}
step("Assert 'Network fee info unreachable' warning title is displayed") {

View file

@ -7,6 +7,7 @@ import com.tangem.common.constants.TestConstants.POLKADOT_RECIPIENT_ADDRESS
import com.tangem.common.constants.TestConstants.QUOTES_API_SCENARIO
import com.tangem.common.constants.TestConstants.TERRA_RECIPIENT_ADDRESS
import com.tangem.common.constants.TestConstants.USER_TOKENS_API_SCENARIO
import com.tangem.common.constants.TestConstants.WAIT_UNTIL_TIMEOUT_LONG
import com.tangem.common.extensions.SwipeDirection
import com.tangem.common.extensions.clickWithAssertion
import com.tangem.common.extensions.swipeVertical
@ -68,6 +69,7 @@ class SendFeeScreenTest : BaseTestCase() {
@Test
fun checkFeeBlockForFixedFeeTest() {
val tokenName = "Polkadot"
val fullTokenName = "Polkadot Asset Hub"
val tokenAmount = "1"
val feeAmount = "$0.05"
@ -78,7 +80,7 @@ class SendFeeScreenTest : BaseTestCase() {
}
).run {
step("Open 'Send' screen") {
openSendScreen(tokenName)
openSendScreen(tokenName = fullTokenName, mockState = tokenName)
}
step("Type '$tokenAmount' in input text field") {
onSendScreen {
@ -93,10 +95,13 @@ class SendFeeScreenTest : BaseTestCase() {
onSendAddressScreen { addressTextField.performTextReplacement(POLKADOT_RECIPIENT_ADDRESS) }
}
step("Click on 'Next' button") {
onSendScreen { nextButton.clickWithAssertion() }
waitForIdle()
onSendAddressScreen { nextButton.clickWithAssertion() }
}
step("Assert fee block is displayed without fee selector") {
checkNetworkFeeBlock(currentFeeAmount = feeAmount, withFeeSelector = false)
flakySafely(WAIT_UNTIL_TIMEOUT_LONG) {
checkNetworkFeeBlock(currentFeeAmount = feeAmount, withFeeSelector = false)
}
}
step("Click on 'Fee selector' block") {
onSendConfirmScreen { feeSelectorBlock.performClick() }
@ -161,7 +166,7 @@ class SendFeeScreenTest : BaseTestCase() {
onSendAddressScreen { addressTextField.performTextReplacement(ETHEREUM_RECIPIENT_ADDRESS) }
}
step("Click on 'Next' button") {
onSendScreen { nextButton.clickWithAssertion() }
onSendAddressScreen { nextButton.clickWithAssertion() }
}
step("Assert fee block is displayed with fee selector") {
checkNetworkFeeBlock(currentFeeAmount = feeAmount, withFeeSelector = true)

View file

@ -21,6 +21,7 @@ import org.junit.Test
@HiltAndroidTest
class PolkadotWarningsTest : BaseTestCase() {
private val tokenName = "Polkadot"
private val fullTokenName = "Polkadot Asset Hub"
private val amountToLeaveLessThanDeposit = "1.299"
private val amountToLeaveGreaterThanDeposit = "0.2"
private val depositAmount = "DOT 0.01"
@ -41,7 +42,7 @@ class PolkadotWarningsTest : BaseTestCase() {
}
).run {
step("Open 'Send Screen' with token: $tokenName") {
openSendScreen(tokenName)
openSendScreen(tokenName = fullTokenName, mockState = tokenName)
}
step("Type '$amountToLeaveLessThanDeposit' in input text field") {
onSendScreen {

View file

@ -16,11 +16,13 @@ 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.Ignore
import org.junit.Test
@HiltAndroidTest
class SearchAndSwapTest : BaseTestCase() {
@Ignore("ToDo: [REDACTED_JIRA]")
@AllureId("8520")
@DisplayName("Search and Swap: add token without derivation")
@Test
@ -68,6 +70,7 @@ class SearchAndSwapTest : BaseTestCase() {
}
}
@Ignore("ToDo: [REDACTED_JIRA]")
@AllureId("8519")
@DisplayName("Search and Swap: add token with derivation")
@Test
@ -115,6 +118,7 @@ class SearchAndSwapTest : BaseTestCase() {
}
}
@Ignore("ToDo: [REDACTED_JIRA]")
@AllureId("8523")
@DisplayName("Search and Swap: Markets error")
@Test
@ -155,6 +159,7 @@ class SearchAndSwapTest : BaseTestCase() {
}
}
@Ignore("ToDo: [REDACTED_JIRA]")
@AllureId("8522")
@DisplayName("Search and Swap: check 'Unsupported token pair' warning")
@Test
@ -205,6 +210,7 @@ class SearchAndSwapTest : BaseTestCase() {
}
}
@Ignore("ToDo: [REDACTED_JIRA]")
@AllureId("8521")
@DisplayName("Swap: search token on Swap token screen")
@Test