Updated on 2026-08-14
This commit is contained in:
parent
b32a1b4be0
commit
3eeacd520e
18 changed files with 585 additions and 45 deletions
|
|
@ -32,10 +32,12 @@ object TestConstants {
|
|||
const val DOGECOIN_RECIPIENT_ADDRESS = "DJQR3bdhBKcFGMHX2BkMCkrMFApNWNzr6V"
|
||||
const val DOGECOIN_ADDRESS = "DJ2TaZ5vvp3mBLugUpKjVM3pRBLi4uYaqz"
|
||||
const val TERRA_RECIPIENT_ADDRESS = "terra148dmp5ccazcwdmrcpvqz5rprnn886kemqen3tj"
|
||||
const val POLYGON_RECIPIENT_ADDRESS = "0x742d35cc6634c0532925a3b844bc9e7595f2bd18"
|
||||
|
||||
const val WAIT_UNTIL_TIMEOUT = 20_000L
|
||||
const val WAIT_UNTIL_TIMEOUT_LONG = 30_000L
|
||||
const val WAIT_UNTIL_TIMEOUT_VERY_LONG = 60_000L
|
||||
const val HOLD_DURATION_MS = 2_000L
|
||||
|
||||
const val MARKETS_MAIN_NETWORK_SUFFIX = "MAIN"
|
||||
|
||||
|
|
@ -55,4 +57,5 @@ object TestConstants {
|
|||
"cable meadow add game meat rigid pride"
|
||||
const val SEED_PHRASE_24 = "force visit fresh brown razor target ill scissors figure cave feel genre cargo category " +
|
||||
"bread much nature basic fun iron benefit egg error prosper"
|
||||
const val SVS_SEED_PHRASE_12 = "diagram thunder merit soup muscle amused refuse usual ring couch popular wash"
|
||||
}
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
package com.tangem.scenarios
|
||||
|
||||
import androidx.compose.ui.test.longClick
|
||||
import com.tangem.common.BaseTestCase
|
||||
import com.tangem.common.constants.TestConstants.HOLD_DURATION_MS
|
||||
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
|
||||
|
|
@ -184,4 +186,70 @@ fun BaseTestCase.openSendConfirmScreenViaNextButton() {
|
|||
step("Assert 'Send' button on 'Send confirm' screen is displayed") {
|
||||
onSendConfirmScreen { sendButton.assertIsDisplayed() }
|
||||
}
|
||||
}
|
||||
|
||||
fun BaseTestCase.openSendSuccessScreenViaLongClickOnSendButton() {
|
||||
step("Long click on 'Send' button") {
|
||||
onSendConfirmScreen {
|
||||
waitForIdle()
|
||||
sendButton.assertIsEnabled()
|
||||
sendButton.performTouchInput { longClick(durationMillis = HOLD_DURATION_MS) }
|
||||
}
|
||||
}
|
||||
step("Assert 'Transaction sent' screen is displayed") {
|
||||
onSendSuccessScreen { container.assertIsDisplayed() }
|
||||
}
|
||||
}
|
||||
|
||||
fun BaseTestCase.checkSendViaSwapSuccessScreen() {
|
||||
step("Assert 'Transaction sent' title is displayed") {
|
||||
onSendSuccessScreen { title.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Transaction date' is displayed") {
|
||||
onSendSuccessScreen { transactionDate.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Send from' block is displayed") {
|
||||
onSendSuccessScreen { sendFromBlock.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Amount to receive' block is displayed") {
|
||||
onSendSuccessScreen { sendToAmountBlock.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Provider' block is displayed") {
|
||||
onSendSuccessScreen { providerBlock.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Recipient address' block is displayed") {
|
||||
onSendSuccessScreen { recipientAddressBlock.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Network fee' block is displayed") {
|
||||
onSendSuccessScreen { feeBlock.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Explore' button is displayed") {
|
||||
onSendSuccessScreen { exploreButton.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Share' button is displayed") {
|
||||
onSendSuccessScreen { shareButton.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Close' button is displayed") {
|
||||
onSendSuccessScreen { closeButton.assertIsDisplayed() }
|
||||
}
|
||||
}
|
||||
|
||||
fun BaseTestCase.selectTokenToSendViaSwap(
|
||||
swapTokenName: String,
|
||||
networkName: String,
|
||||
networkType: String? = null,
|
||||
) {
|
||||
step("Click on 'Send' button") {
|
||||
onTokenDetailsScreen { sendButton().performClick() }
|
||||
}
|
||||
step("Click on 'Swap to another token' button") {
|
||||
onSendScreen { swapToAnotherTokenButton.performClick() }
|
||||
}
|
||||
step("Click on token: '$swapTokenName'") {
|
||||
onSendViaSwapScreen { tokenItem(swapTokenName).performClick() }
|
||||
}
|
||||
val networkLabel = if (networkType.isNullOrBlank()) networkName else "$networkName $networkType"
|
||||
step("Click on '$networkLabel' network") {
|
||||
onChooseNetworkBottomSheet { networkItem(networkName, networkType).performClick() }
|
||||
}
|
||||
}
|
||||
|
|
@ -20,10 +20,12 @@ class ChooseNetworkBottomSheetPageObject(semanticsProvider: SemanticsNodeInterac
|
|||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
fun networkItem(title: String, subtitle: String): KNode = child {
|
||||
fun networkItem(name: String, type: String? = null): KNode = child {
|
||||
hasTestTag(ChooseNetworkBottomSheetTestTags.NETWORK_ITEM)
|
||||
hasAnyDescendant(withText(title))
|
||||
hasAnyDescendant(withText(subtitle))
|
||||
hasAnyDescendant(withText(name))
|
||||
if (!type.isNullOrBlank()) {
|
||||
hasAnyDescendant(withText(type))
|
||||
}
|
||||
useUnmergedTree = true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,77 @@
|
|||
package com.tangem.screens
|
||||
|
||||
import androidx.compose.ui.test.SemanticsNodeInteractionsProvider
|
||||
import com.tangem.common.BaseTestCase
|
||||
import com.tangem.common.R
|
||||
import com.tangem.core.ui.test.BaseButtonTestTags
|
||||
import com.tangem.core.ui.test.TransactionSuccessScreenTestTags
|
||||
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
|
||||
import io.github.kakaocup.kakao.common.utilities.getResourceString
|
||||
import androidx.compose.ui.test.hasText as withText
|
||||
|
||||
class SendSuccessPageObject(semanticsProvider: SemanticsNodeInteractionsProvider) :
|
||||
ComposeScreen<SendSuccessPageObject>(semanticsProvider = semanticsProvider) {
|
||||
|
||||
val container: KNode = child {
|
||||
hasTestTag(TransactionSuccessScreenTestTags.CONTAINER)
|
||||
}
|
||||
|
||||
val title: KNode = child {
|
||||
hasTestTag(TransactionSuccessScreenTestTags.TITLE)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val transactionDate: KNode = child {
|
||||
hasTestTag(TransactionSuccessScreenTestTags.TRANSACTION_DATE)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val sendFromBlock: KNode = child {
|
||||
hasTestTag(TransactionSuccessScreenTestTags.AMOUNT_BLOCK)
|
||||
hasAnyDescendant(withText(getResourceString(R.string.send_from_title)))
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val sendToAmountBlock: KNode = child {
|
||||
hasTestTag(TransactionSuccessScreenTestTags.AMOUNT_BLOCK)
|
||||
hasAnyDescendant(
|
||||
withText(getResourceString(R.string.send_with_swap_recipient_amount_success_title))
|
||||
)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val providerBlock: KNode = child {
|
||||
hasTestTag(TransactionSuccessScreenTestTags.PROVIDER_BLOCK)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val recipientAddressBlock: KNode = child {
|
||||
hasTestTag(TransactionSuccessScreenTestTags.RECIPIENT_BLOCK)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val feeBlock: KNode = child {
|
||||
hasTestTag(TransactionSuccessScreenTestTags.FEE_BLOCK)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val exploreButton: KNode = child {
|
||||
hasTestTag(BaseButtonTestTags.BUTTON)
|
||||
hasText(getResourceString(R.string.common_explore))
|
||||
}
|
||||
|
||||
val closeButton: KNode = child {
|
||||
hasTestTag(BaseButtonTestTags.BUTTON)
|
||||
hasText(getResourceString(R.string.common_close))
|
||||
}
|
||||
|
||||
val shareButton: KNode = child {
|
||||
hasTestTag(BaseButtonTestTags.BUTTON)
|
||||
hasText(getResourceString(R.string.common_share))
|
||||
}
|
||||
}
|
||||
|
||||
internal fun BaseTestCase.onSendSuccessScreen(function: SendSuccessPageObject.() -> Unit) =
|
||||
onComposeScreen(composeTestRule, function)
|
||||
|
|
@ -16,6 +16,7 @@ import io.github.kakaocup.compose.node.element.ComposeScreen.Companion.onCompose
|
|||
import io.github.kakaocup.compose.node.element.KNode
|
||||
import io.github.kakaocup.compose.node.element.lazylist.KLazyListNode
|
||||
import io.github.kakaocup.kakao.common.utilities.getResourceString
|
||||
import androidx.compose.ui.test.hasTestTag as withTestTag
|
||||
import androidx.compose.ui.test.hasText as withText
|
||||
|
||||
class TokenDetailsPageObject(semanticsProvider: SemanticsNodeInteractionsProvider) :
|
||||
|
|
@ -192,6 +193,20 @@ class TokenDetailsPageObject(semanticsProvider: SemanticsNodeInteractionsProvide
|
|||
hasText(getResourceString(R.string.common_buy_currency, feeCurrencySymbol))
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
fun expressStatusItem(title: String): KNode = child {
|
||||
hasTestTag(TokenDetailsScreenTestTags.EXPRESS_STATUS_ITEM)
|
||||
hasAnyDescendant(
|
||||
withTestTag(TokenDetailsScreenTestTags.EXPRESS_STATUS_ITEM_TITLE) and withText(title)
|
||||
)
|
||||
hasAnyDescendant(withTestTag(TokenDetailsScreenTestTags.EXPRESS_STATUS_ITEM_FROM_ICON))
|
||||
hasAnyDescendant(withTestTag(TokenDetailsScreenTestTags.EXPRESS_STATUS_ITEM_FROM_AMOUNT))
|
||||
hasAnyDescendant(withTestTag(TokenDetailsScreenTestTags.EXPRESS_STATUS_ITEM_SWAP_ICON))
|
||||
hasAnyDescendant(withTestTag(TokenDetailsScreenTestTags.EXPRESS_STATUS_ITEM_TO_ICON))
|
||||
hasAnyDescendant(withTestTag(TokenDetailsScreenTestTags.EXPRESS_STATUS_ITEM_TO_AMOUNT))
|
||||
hasAnyDescendant(withTestTag(TokenDetailsScreenTestTags.EXPRESS_STATUS_ITEM_CHEVRON_ICON))
|
||||
useUnmergedTree = true
|
||||
}
|
||||
}
|
||||
|
||||
internal fun BaseTestCase.onTokenDetailsScreen(function: TokenDetailsPageObject.() -> Unit) =
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ import com.tangem.tap.domain.sdk.mocks.MockProvider
|
|||
import dagger.hilt.android.testing.HiltAndroidTest
|
||||
import io.qameta.allure.kotlin.AllureId
|
||||
import io.qameta.allure.kotlin.junit4.DisplayName
|
||||
import org.junit.Ignore
|
||||
import org.junit.Test
|
||||
import javax.inject.Inject
|
||||
|
||||
|
|
@ -73,7 +72,6 @@ class FeedbackTest : BaseTestCase() {
|
|||
}
|
||||
}
|
||||
|
||||
@Ignore("TODO: [REDACTED_JIRA]")
|
||||
@AllureId("893")
|
||||
@DisplayName("Send feedback: failed transaction")
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import com.tangem.tap.domain.sdk.mocks.content.TwinsMockContent
|
|||
import dagger.hilt.android.testing.HiltAndroidTest
|
||||
import io.qameta.allure.kotlin.AllureId
|
||||
import io.qameta.allure.kotlin.junit4.DisplayName
|
||||
import org.junit.Ignore
|
||||
import org.junit.Test
|
||||
|
||||
@HiltAndroidTest
|
||||
|
|
@ -462,7 +461,6 @@ class MainScreenActionButtonsTest : BaseTestCase() {
|
|||
}
|
||||
}
|
||||
|
||||
@Ignore("TODO: [REDACTED_JIRA]")
|
||||
@AllureId("4396")
|
||||
@DisplayName("Action buttons (main screen): click on buttons without data")
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -2,14 +2,18 @@ package com.tangem.tests.send.sendViaSwap
|
|||
|
||||
import com.tangem.common.BaseTestCase
|
||||
import com.tangem.common.R
|
||||
import com.tangem.common.extensions.extractText
|
||||
import com.tangem.common.constants.TestConstants.ETHEREUM_RECIPIENT_ADDRESS
|
||||
import com.tangem.common.constants.TestConstants.POLYGON_RECIPIENT_ADDRESS
|
||||
import com.tangem.common.constants.TestConstants.QUOTES_API_SCENARIO
|
||||
import com.tangem.common.constants.TestConstants.SOLANA_RECIPIENT_ADDRESS
|
||||
import com.tangem.common.constants.TestConstants.SVS_SEED_PHRASE_12
|
||||
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.clickWithAssertion
|
||||
import com.tangem.common.extensions.extractText
|
||||
import com.tangem.common.utils.resetWireMockScenarioState
|
||||
import com.tangem.common.utils.setWireMockScenarioState
|
||||
import com.tangem.scenarios.openSendConfirmScreenViaNextButton
|
||||
import com.tangem.scenarios.openSendScreen
|
||||
import com.tangem.scenarios.*
|
||||
import com.tangem.screens.*
|
||||
import dagger.hilt.android.testing.HiltAndroidTest
|
||||
import io.github.kakaocup.kakao.common.utilities.getResourceString
|
||||
|
|
@ -369,4 +373,278 @@ class SendViaSwapTest : BaseTestCase() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@AllureId("3967")
|
||||
@DisplayName("Send via Swap: full successful send via swap flow")
|
||||
@Test
|
||||
fun sendViaSwapSuccessfulFlowTest() {
|
||||
val tokenName = "Bitcoin"
|
||||
val swapTokenName = "Ethereum"
|
||||
val main = "MAIN"
|
||||
val inputAmount = "0.001"
|
||||
val providerName = "SimpleSwap"
|
||||
val expressStatusItemTitle = getResourceString(R.string.express_exchange_by, providerName)
|
||||
val bitcoinBalanceScenarioName = "bitcoin_utxo"
|
||||
val bitcoinBalanceScenarioState = "BalanceHotWalletSvS"
|
||||
val assetsScenarioName = "express_api_assets"
|
||||
val assetsScenarioState = "BitcoinExchangeEnabled"
|
||||
val hotWalletScenarioState = "HotWalletSvS"
|
||||
val providersScenarioName = "networks_providers"
|
||||
val providersScenarioState = "HotWalletSvS"
|
||||
|
||||
setupHooks(
|
||||
additionalAfterSection = {
|
||||
resetWireMockScenarioState(bitcoinBalanceScenarioName)
|
||||
resetWireMockScenarioState(assetsScenarioName)
|
||||
resetWireMockScenarioState(USER_TOKENS_API_SCENARIO)
|
||||
resetWireMockScenarioState(QUOTES_API_SCENARIO)
|
||||
resetWireMockScenarioState(providersScenarioName)
|
||||
}
|
||||
).run {
|
||||
|
||||
step("Set WireMock scenario: '$USER_TOKENS_API_SCENARIO' to state: '$hotWalletScenarioState'") {
|
||||
setWireMockScenarioState(scenarioName = USER_TOKENS_API_SCENARIO, state = hotWalletScenarioState)
|
||||
}
|
||||
step("Set WireMock scenario: '$QUOTES_API_SCENARIO' to state: '$tokenName'") {
|
||||
setWireMockScenarioState(scenarioName = QUOTES_API_SCENARIO, state = tokenName)
|
||||
}
|
||||
step("Set WireMock scenario: '$bitcoinBalanceScenarioName' to state: '$bitcoinBalanceScenarioState'") {
|
||||
setWireMockScenarioState(scenarioName = bitcoinBalanceScenarioName, state = bitcoinBalanceScenarioState)
|
||||
}
|
||||
step("Set WireMock scenario: '$assetsScenarioName' to state: '$assetsScenarioState'") {
|
||||
setWireMockScenarioState(scenarioName = assetsScenarioName, state = assetsScenarioState)
|
||||
}
|
||||
step("Set WireMock scenario: '$providersScenarioName' to state: '$providersScenarioState'") {
|
||||
setWireMockScenarioState(scenarioName = providersScenarioName, state = providersScenarioState)
|
||||
}
|
||||
|
||||
step("Open 'Main Screen' with existing hot wallet") {
|
||||
openMainScreenWithExistingHotWallet(SVS_SEED_PHRASE_12)
|
||||
}
|
||||
step("Click on token with name: '$tokenName'") {
|
||||
onMainScreen { tokenWithTitleAndAddress(tokenName).clickWithAssertion() }
|
||||
}
|
||||
step("Select token to Send via Swap") {
|
||||
selectTokenToSendViaSwap(swapTokenName = swapTokenName, networkName = swapTokenName, networkType = main)
|
||||
}
|
||||
step("Type '$inputAmount' in text field") {
|
||||
onSendScreen { amountInputTextField.performTextInput(inputAmount) }
|
||||
}
|
||||
step("Click on 'Next' button") {
|
||||
flakySafely(WAIT_UNTIL_TIMEOUT_LONG) {
|
||||
onSendScreen {
|
||||
nextButton.assertIsEnabled()
|
||||
nextButton.performClick()
|
||||
}
|
||||
}
|
||||
}
|
||||
step("Type recipient address") {
|
||||
onSendAddressScreen { addressTextField.performTextReplacement(ETHEREUM_RECIPIENT_ADDRESS) }
|
||||
}
|
||||
step("Open 'Send confirm' screen via 'Next' button") {
|
||||
flakySafely(WAIT_UNTIL_TIMEOUT_LONG) {
|
||||
openSendConfirmScreenViaNextButton()
|
||||
}
|
||||
}
|
||||
step("Assert 'Best rate' badge is displayed") {
|
||||
onSendConfirmScreen { bestRateBadge.assertIsDisplayed() }
|
||||
}
|
||||
step("Open 'Send via swap success' screen") {
|
||||
flakySafely(WAIT_UNTIL_TIMEOUT_LONG) {
|
||||
openSendSuccessScreenViaLongClickOnSendButton()
|
||||
}
|
||||
}
|
||||
step("Check 'Send via swap' screen") {
|
||||
checkSendViaSwapSuccessScreen()
|
||||
}
|
||||
step("Click on 'Explore' button") {
|
||||
onSendSuccessScreen { exploreButton.performClick() }
|
||||
}
|
||||
step("Assert Chrome Browser is opened") {
|
||||
ThirdPartyAppPageObject { assertChromeIsOpened() }
|
||||
}
|
||||
step("Press 'Back' button to close 'Chrome' browser") {
|
||||
device.uiDevice.pressBack()
|
||||
}
|
||||
step("Click on 'Close' button") {
|
||||
onSendSuccessScreen { closeButton.performClick() }
|
||||
}
|
||||
step("Assert 'Express status' item is displayed with title: '$expressStatusItemTitle'") {
|
||||
flakySafely(WAIT_UNTIL_TIMEOUT_LONG) {
|
||||
onTokenDetailsScreen { expressStatusItem(expressStatusItemTitle).assertIsDisplayed() }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@AllureId("4017")
|
||||
@DisplayName("Send via Swap: send same token in different network")
|
||||
@Test
|
||||
fun sendSameTokenInDifferentNetworkTest() {
|
||||
val tokenName = "Tether"
|
||||
val swapTokenName = "Tether"
|
||||
val networkName = "Polygon"
|
||||
val inputAmount = "0.001"
|
||||
val ethCallScenarioName = "eth_call_api"
|
||||
val ethCallScenarioState = "Started"
|
||||
val hotWalletScenarioState = "USDTHotWalletSvS"
|
||||
val ethNetworkBalanceScenarioName = "eth_network_balance"
|
||||
val ethNetworkBalanceScenarioState = "Started"
|
||||
val providerName = "Changelly"
|
||||
val expressStatusItemTitle = getResourceString(R.string.express_exchange_by, providerName)
|
||||
|
||||
setupHooks(
|
||||
additionalAfterSection = {
|
||||
resetWireMockScenarioState(ethCallScenarioName)
|
||||
resetWireMockScenarioState(USER_TOKENS_API_SCENARIO)
|
||||
resetWireMockScenarioState(QUOTES_API_SCENARIO)
|
||||
resetWireMockScenarioState(ethNetworkBalanceScenarioName)
|
||||
}
|
||||
).run {
|
||||
|
||||
step("Set WireMock scenario: '$USER_TOKENS_API_SCENARIO' to state: '$hotWalletScenarioState'") {
|
||||
setWireMockScenarioState(scenarioName = USER_TOKENS_API_SCENARIO, state = hotWalletScenarioState)
|
||||
}
|
||||
step("Set WireMock scenario: '$QUOTES_API_SCENARIO' to state: '$hotWalletScenarioState'") {
|
||||
setWireMockScenarioState(scenarioName = QUOTES_API_SCENARIO, state = hotWalletScenarioState)
|
||||
}
|
||||
step("Set WireMock scenario: '$ethCallScenarioName' to state: '$ethCallScenarioState'") {
|
||||
setWireMockScenarioState(scenarioName = ethCallScenarioName, state = ethCallScenarioState)
|
||||
}
|
||||
step("Set WireMock scenario: '$ethNetworkBalanceScenarioName' to state: '$ethNetworkBalanceScenarioState'") {
|
||||
setWireMockScenarioState(scenarioName = ethNetworkBalanceScenarioName, state = ethNetworkBalanceScenarioState)
|
||||
}
|
||||
|
||||
step("Open 'Main Screen' with existing hot wallet") {
|
||||
openMainScreenWithExistingHotWallet(SVS_SEED_PHRASE_12)
|
||||
}
|
||||
step("Click on token with name: '$tokenName'") {
|
||||
onMainScreen { tokenWithTitleAndAddress(tokenName).clickWithAssertion() }
|
||||
}
|
||||
step("Select token to Send via Swap") {
|
||||
selectTokenToSendViaSwap(swapTokenName = swapTokenName, networkName = networkName)
|
||||
}
|
||||
step("Type '$inputAmount' in text field") {
|
||||
onSendScreen { amountInputTextField.performTextInput(inputAmount) }
|
||||
}
|
||||
step("Click on 'Next' button") {
|
||||
flakySafely(WAIT_UNTIL_TIMEOUT_LONG) {
|
||||
onSendScreen {
|
||||
nextButton.assertIsEnabled()
|
||||
nextButton.performClick()
|
||||
}
|
||||
}
|
||||
}
|
||||
step("Type recipient address") {
|
||||
onSendAddressScreen { addressTextField.performTextReplacement(POLYGON_RECIPIENT_ADDRESS) }
|
||||
}
|
||||
step("Open 'Send confirm' screen via 'Next' button") {
|
||||
flakySafely(WAIT_UNTIL_TIMEOUT_LONG) {
|
||||
openSendConfirmScreenViaNextButton()
|
||||
}
|
||||
}
|
||||
step("Assert 'Best rate' badge is displayed") {
|
||||
onSendConfirmScreen { bestRateBadge.assertIsDisplayed() }
|
||||
}
|
||||
step("Open 'Send via swap success' screen") {
|
||||
flakySafely(WAIT_UNTIL_TIMEOUT_LONG) {
|
||||
openSendSuccessScreenViaLongClickOnSendButton()
|
||||
}
|
||||
}
|
||||
step("Check 'Send via swap' screen") {
|
||||
checkSendViaSwapSuccessScreen()
|
||||
}
|
||||
step("Click on 'Close' button") {
|
||||
onSendSuccessScreen { closeButton.performClick() }
|
||||
}
|
||||
step("Assert 'Express status' item is displayed with title: '$expressStatusItemTitle'") {
|
||||
flakySafely(WAIT_UNTIL_TIMEOUT_LONG) {
|
||||
onTokenDetailsScreen { expressStatusItem(expressStatusItemTitle).assertIsDisplayed() }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@AllureId("4545")
|
||||
@DisplayName("Send via Swap: token with tag/memo send via swap flow")
|
||||
@Test
|
||||
fun sendViaSwapTokenWithTagTest() {
|
||||
val tokenName = "XRP Ledger"
|
||||
val swapTokenName = "Ethereum"
|
||||
val main = "MAIN"
|
||||
val inputAmount = "0.001"
|
||||
val providerName = "Changelly"
|
||||
val expressStatusItemTitle = getResourceString(R.string.express_exchange_by, providerName)
|
||||
val hotWalletScenarioState = "XRPHotWalletSvS"
|
||||
val xrpExchangeQuoteScenarioName = "xrp_exchange_quote"
|
||||
val xrpExchangeDataScenarioName = "xrp_exchange_data"
|
||||
|
||||
setupHooks(
|
||||
additionalAfterSection = {
|
||||
resetWireMockScenarioState(USER_TOKENS_API_SCENARIO)
|
||||
resetWireMockScenarioState(QUOTES_API_SCENARIO)
|
||||
resetWireMockScenarioState(xrpExchangeQuoteScenarioName)
|
||||
resetWireMockScenarioState(xrpExchangeDataScenarioName)
|
||||
}
|
||||
).run {
|
||||
|
||||
step("Set WireMock scenario: '$USER_TOKENS_API_SCENARIO' to state: '$hotWalletScenarioState'") {
|
||||
setWireMockScenarioState(scenarioName = USER_TOKENS_API_SCENARIO, state = hotWalletScenarioState)
|
||||
}
|
||||
step("Set WireMock scenario: '$QUOTES_API_SCENARIO' to state: '$hotWalletScenarioState'") {
|
||||
setWireMockScenarioState(scenarioName = QUOTES_API_SCENARIO, state = hotWalletScenarioState)
|
||||
}
|
||||
step("Set WireMock scenario: '$xrpExchangeQuoteScenarioName' to state: '$hotWalletScenarioState'") {
|
||||
setWireMockScenarioState(scenarioName = xrpExchangeQuoteScenarioName, state = hotWalletScenarioState)
|
||||
}
|
||||
step("Set WireMock scenario: '$xrpExchangeDataScenarioName' to state: '$hotWalletScenarioState'") {
|
||||
setWireMockScenarioState(scenarioName = xrpExchangeDataScenarioName, state = hotWalletScenarioState)
|
||||
}
|
||||
|
||||
step("Open 'Main Screen' with existing hot wallet") {
|
||||
openMainScreenWithExistingHotWallet(SVS_SEED_PHRASE_12)
|
||||
}
|
||||
step("Click on token with name: '$tokenName'") {
|
||||
onMainScreen { tokenWithTitleAndAddress(tokenName).clickWithAssertion() }
|
||||
}
|
||||
step("Select token to Send via Swap") {
|
||||
selectTokenToSendViaSwap(swapTokenName = swapTokenName, networkName = swapTokenName, networkType = main)
|
||||
}
|
||||
step("Type '$inputAmount' in text field") {
|
||||
onSendScreen { amountInputTextField.performTextInput(inputAmount) }
|
||||
}
|
||||
step("Click on 'Next' button") {
|
||||
flakySafely(WAIT_UNTIL_TIMEOUT_LONG) {
|
||||
onSendScreen {
|
||||
nextButton.assertIsEnabled()
|
||||
nextButton.performClick()
|
||||
}
|
||||
}
|
||||
}
|
||||
step("Type recipient address") {
|
||||
onSendAddressScreen { addressTextField.performTextReplacement(ETHEREUM_RECIPIENT_ADDRESS) }
|
||||
}
|
||||
step("Open 'Send confirm' screen via 'Next' button") {
|
||||
flakySafely(WAIT_UNTIL_TIMEOUT_LONG) {
|
||||
openSendConfirmScreenViaNextButton()
|
||||
}
|
||||
}
|
||||
step("Open 'Send via swap success' screen") {
|
||||
flakySafely(WAIT_UNTIL_TIMEOUT_LONG) {
|
||||
openSendSuccessScreenViaLongClickOnSendButton()
|
||||
}
|
||||
}
|
||||
step("Check 'Send via swap' screen") {
|
||||
checkSendViaSwapSuccessScreen()
|
||||
}
|
||||
step("Click on 'Close' button") {
|
||||
onSendSuccessScreen { closeButton.performClick() }
|
||||
}
|
||||
step("Assert 'Express status' item is displayed with title: '$expressStatusItemTitle'") {
|
||||
flakySafely(WAIT_UNTIL_TIMEOUT_LONG) {
|
||||
onTokenDetailsScreen { expressStatusItem(expressStatusItemTitle).assertIsDisplayed() }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
package com.tangem.tests.swap
|
||||
|
||||
import com.tangem.common.BaseTestCase
|
||||
import com.tangem.common.annotations.ApiEnv
|
||||
import com.tangem.common.annotations.ApiEnvConfig
|
||||
import com.tangem.datasource.api.common.config.ApiConfig
|
||||
import com.tangem.datasource.api.common.config.ApiEnvironment
|
||||
import com.tangem.domain.models.scan.ProductType
|
||||
import com.tangem.scenarios.openMainScreen
|
||||
import com.tangem.screens.onMainScreen
|
||||
import dagger.hilt.android.testing.HiltAndroidTest
|
||||
import io.qameta.allure.kotlin.AllureId
|
||||
import io.qameta.allure.kotlin.junit4.DisplayName
|
||||
import org.junit.Test
|
||||
|
||||
@HiltAndroidTest
|
||||
class SwapMainScreenTest : BaseTestCase() {
|
||||
|
||||
@ApiEnv(
|
||||
ApiEnvConfig(ApiConfig.ID.TangemTech, ApiEnvironment.PROD),
|
||||
ApiEnvConfig(ApiConfig.ID.Express, ApiEnvironment.PROD)
|
||||
)
|
||||
@AllureId("574")
|
||||
@DisplayName("Swap: 'Swap' button is not displayed for single currency card")
|
||||
@Test
|
||||
fun singleTokenNoteCardScanTest() {
|
||||
val cardType: ProductType = ProductType.Note
|
||||
|
||||
setupHooks().run {
|
||||
step("Open 'Main Screen' on '${cardType.name}' card") {
|
||||
openMainScreen(cardType)
|
||||
}
|
||||
step("Assert 'Swap' button is not displayed") {
|
||||
onMainScreen { swapButton.assertIsNotDisplayed() }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue