From a8c5f41ea60a7a70b12d677b2f4c062ec3dfc852 Mon Sep 17 00:00:00 2001 From: Tangem Date: Sat, 22 Nov 2025 13:34:46 +0300 Subject: [PATCH] Updated on 2026-08-14 --- .../com/tangem/scenarios/SendScenarios.kt | 14 +--- .../tangem/screens/SendAddressPageObject.kt | 14 ++-- .../tangem/screens/SendConfirmPageObject.kt | 5 ++ .../kotlin/com/tangem/tests/FeedbackTest.kt | 4 ++ .../MainScreenActionButtonsTest.kt | 1 + .../send/addressScreen/MyWalletsBlockTest.kt | 9 ++- .../send/addressScreen/RecentBlockTest.kt | 69 +++++++++++++------ .../confirmScreen/SendConfirmScreenTest.kt | 13 +++- 8 files changed, 86 insertions(+), 43 deletions(-) diff --git a/app/src/androidTest/kotlin/com/tangem/scenarios/SendScenarios.kt b/app/src/androidTest/kotlin/com/tangem/scenarios/SendScenarios.kt index f1d548fd8e..6bcaa775de 100644 --- a/app/src/androidTest/kotlin/com/tangem/scenarios/SendScenarios.kt +++ b/app/src/androidTest/kotlin/com/tangem/scenarios/SendScenarios.kt @@ -132,18 +132,10 @@ fun BaseTestCase.checkDestinationTagBlock(hint: String) { } } -fun BaseTestCase.checkRecentAddressItem(address: String, description: String) { - step("Assert recent address '$address' is displayed") { +fun BaseTestCase.checkRecentAddressItem(address: String, description: String?) { + step("Assert recent address '$address' with description '$description' is displayed") { onSendAddressScreen { - recentAddressItem(address).assertIsDisplayed() - } - } - step("Assert recent address item description is '$description'") { - onSendAddressScreen { - recentAddressItemDescription(description).assertTextContains( - description, - substring = true - ) + recentAddressItem(recipientAddress = address, description = description).assertIsDisplayed() } } } \ No newline at end of file diff --git a/app/src/androidTest/kotlin/com/tangem/screens/SendAddressPageObject.kt b/app/src/androidTest/kotlin/com/tangem/screens/SendAddressPageObject.kt index 7ed6cddb65..aa4b7b3647 100644 --- a/app/src/androidTest/kotlin/com/tangem/screens/SendAddressPageObject.kt +++ b/app/src/androidTest/kotlin/com/tangem/screens/SendAddressPageObject.kt @@ -81,12 +81,19 @@ class SendAddressPageObject(semanticsProvider: SemanticsNodeInteractionsProvider useUnmergedTree = true } - fun recentAddressItem(recipientAddress: String, isMyWallet: Boolean = false): KNode = child { + fun recentAddressItem( + recipientAddress: String, + isMyWallet: Boolean = false, + description: String? = null + ): KNode = child { hasTestTag(SendAddressScreenTestTags.RECENT_ADDRESS_ITEM) hasAnyChild(withTestTag(SendAddressScreenTestTags.RECENT_ADDRESS_ICON)) hasAnyDescendant(withText(recipientAddress)) hasAnyDescendant(withTestTag(SendAddressScreenTestTags.RECENT_ADDRESS_TEXT)) useUnmergedTree = true + if (description != null) { + hasAnyDescendant(withText(description, substring = true)) + } if (isMyWallet) { hasAnySibling(withText(getResourceString(CoreUiR.string.send_recipient_wallets_title))) hasAnyDescendant(withText(getResourceString(CoreUiR.string.manage_tokens_network_selector_wallet))) @@ -96,11 +103,6 @@ class SendAddressPageObject(semanticsProvider: SemanticsNodeInteractionsProvider } } - fun recentAddressItemDescription(recipientAddress: String): KNode = recentAddressItem(recipientAddress).child { - hasParent(withTestTag(SendAddressScreenTestTags.RECENT_ADDRESS_TEXT)) - useUnmergedTree = true - } - fun destinationTagBlockTitle(isMemoCorrectOrEmpty: Boolean = true): KNode = child { hasTestTag(SendAddressScreenTestTags.DESTINATION_TAG_TEXT_FIELD_TITLE) useUnmergedTree = true diff --git a/app/src/androidTest/kotlin/com/tangem/screens/SendConfirmPageObject.kt b/app/src/androidTest/kotlin/com/tangem/screens/SendConfirmPageObject.kt index 8beeddb2eb..505b43899c 100644 --- a/app/src/androidTest/kotlin/com/tangem/screens/SendConfirmPageObject.kt +++ b/app/src/androidTest/kotlin/com/tangem/screens/SendConfirmPageObject.kt @@ -20,6 +20,11 @@ class SendConfirmPageObject(semanticsProvider: SemanticsNodeInteractionsProvider useUnmergedTree = true } + val closeButton: KNode = child { + hasTestTag(TopAppBarTestTags.CLOSE_BUTTON) + useUnmergedTree = true + } + val sendButton: KNode = child { hasTestTag(BaseButtonTestTags.BUTTON) hasAnyDescendant(withText(getResourceString(R.string.common_send))) diff --git a/app/src/androidTest/kotlin/com/tangem/tests/FeedbackTest.kt b/app/src/androidTest/kotlin/com/tangem/tests/FeedbackTest.kt index f6cd0fc1e3..9d75140152 100644 --- a/app/src/androidTest/kotlin/com/tangem/tests/FeedbackTest.kt +++ b/app/src/androidTest/kotlin/com/tangem/tests/FeedbackTest.kt @@ -36,7 +36,11 @@ class FeedbackTest : BaseTestCase() { step("Open 'Main Screen'") { openMainScreen() } + step("Synchronize addresses") { + synchronizeAddresses() + } step("Click 'More' button on TopBar") { + waitForIdle() onTopBar { moreButton.clickWithAssertion() } } step("Click 'Contact support' button") { diff --git a/app/src/androidTest/kotlin/com/tangem/tests/actionButtons/MainScreenActionButtonsTest.kt b/app/src/androidTest/kotlin/com/tangem/tests/actionButtons/MainScreenActionButtonsTest.kt index 0f72322a4e..fd03d3bd1e 100644 --- a/app/src/androidTest/kotlin/com/tangem/tests/actionButtons/MainScreenActionButtonsTest.kt +++ b/app/src/androidTest/kotlin/com/tangem/tests/actionButtons/MainScreenActionButtonsTest.kt @@ -23,6 +23,7 @@ import org.junit.Test @HiltAndroidTest class MainScreenActionButtonsTest : BaseTestCase() { + @ApiEnv(ApiEnvConfig(ApiConfig.ID.MoonPay, ApiEnvironment.PROD)) @AllureId("79") @DisplayName("Action buttons (long tap): validate UI") @Test diff --git a/app/src/androidTest/kotlin/com/tangem/tests/send/addressScreen/MyWalletsBlockTest.kt b/app/src/androidTest/kotlin/com/tangem/tests/send/addressScreen/MyWalletsBlockTest.kt index 13d2d3d727..f26e567935 100644 --- a/app/src/androidTest/kotlin/com/tangem/tests/send/addressScreen/MyWalletsBlockTest.kt +++ b/app/src/androidTest/kotlin/com/tangem/tests/send/addressScreen/MyWalletsBlockTest.kt @@ -85,8 +85,13 @@ class MyWalletsBlockTest : BaseTestCase() { step("Assert 'My wallets' title is not displayed") { onSendAddressScreen { myWalletsTitle.assertIsNotDisplayed() } } - step("Assert recent address item is not displayed") { - onSendAddressScreen { recentAddressItem(ETHEREUM_ADDRESS).assertIsNotDisplayed() } + step("Assert 'My wallets' item is not displayed") { + onSendAddressScreen { + recentAddressItem( + recipientAddress = ETHEREUM_ADDRESS, + isMyWallet = true + ).assertIsNotDisplayed() + } } } } diff --git a/app/src/androidTest/kotlin/com/tangem/tests/send/addressScreen/RecentBlockTest.kt b/app/src/androidTest/kotlin/com/tangem/tests/send/addressScreen/RecentBlockTest.kt index 74e5dac269..1a169ead0b 100644 --- a/app/src/androidTest/kotlin/com/tangem/tests/send/addressScreen/RecentBlockTest.kt +++ b/app/src/androidTest/kotlin/com/tangem/tests/send/addressScreen/RecentBlockTest.kt @@ -21,7 +21,9 @@ import org.junit.Test @HiltAndroidTest class RecentBlockTest : BaseTestCase() { private val txHistoryScenarioName = "dogecoin_tx_history" - private val descriptionForWalletTransaction = "DOGE 0.0192, 11/10/2025, 1:46 PM" + private val recentTransactionAmount1 = "DOGE 0.0192" + private val recentTransactionAmount2 = "DOGE 0.10" + private val recentTransactionAmount3 = "DOGE 0.005" @AllureId("4005") @DisplayName("Send (address screen): check address history") @@ -62,8 +64,16 @@ class RecentBlockTest : BaseTestCase() { step("Assert recipient address is displayed") { onSendConfirmScreen { recipientAddress(DOGECOIN_ADDRESS).assertIsDisplayed() } } - step("Press system 'Back' button") { - device.uiDevice.pressBack() + step("Click on top bar 'Close' button") { + waitForIdle() + onSendConfirmScreen { closeButton.clickWithAssertion() } + } + step("Assert 'Send Address' screen is displayed") { + waitForIdle() + onSendAddressScreen { container.assertIsDisplayed() } + } + step("Assert address text field is displayed") { + onSendAddressScreen { addressTextField.assertIsDisplayed() } } step("Assert address text field contains correct recipient address") { onSendAddressScreen { addressTextField.assertTextContains(DOGECOIN_ADDRESS) } @@ -127,10 +137,26 @@ class RecentBlockTest : BaseTestCase() { @DisplayName("Send (address screen): check 'Recent' block, transaction history is empty") @Test fun recentBlockTransactionHistoryEmptyTest() { - val tokenName = "POL (ex-MATIC)" + val tokenName = "Dogecoin" val sendAmount = "1" + val txHistoryScenarioState = "Empty" - setupHooks().run { + setupHooks( + additionalAfterSection = { + resetWireMockScenarioState(USER_TOKENS_API_SCENARIO) + resetWireMockScenarioState(QUOTES_API_SCENARIO) + resetWireMockScenarioState(txHistoryScenarioName) + } + ).run { + step("Set WireMock scenario: '$USER_TOKENS_API_SCENARIO' to state: '$tokenName'") { + setWireMockScenarioState(scenarioName = USER_TOKENS_API_SCENARIO, state = tokenName) + } + step("Set WireMock scenario: '$QUOTES_API_SCENARIO' to state: '$tokenName'") { + setWireMockScenarioState(scenarioName = QUOTES_API_SCENARIO, state = tokenName) + } + step("Set WireMock scenario: '$txHistoryScenarioName' to state: '$txHistoryScenarioState'") { + setWireMockScenarioState(scenarioName = txHistoryScenarioName, state = txHistoryScenarioState) + } step("Open 'Main Screen'") { openMainScreen() } @@ -201,7 +227,6 @@ class RecentBlockTest : BaseTestCase() { val txHistoryScenarioState = "11OutgoingTransactions" val recipientAddressBase = "DJ2TaZ5vvp3mBLugUpKjVM3pRBLi4uYaq" val shortenedRecipientAddress = "DJ2TaZ5vvp3mBLugU...Li4uYaq123456789b" - val descriptionForTransaction = "DOGE 0.10, 11/10/2025, 1:46 PM" setupHooks( additionalAfterSection = { @@ -232,37 +257,38 @@ class RecentBlockTest : BaseTestCase() { onSendAddressScreen { recentAddressesTitle.assertIsDisplayed() } } step("Check recent address item №1") { - checkRecentAddressItem(address = DOGECOIN_ADDRESS, description = descriptionForWalletTransaction) + checkRecentAddressItem(address = DOGECOIN_ADDRESS, description = recentTransactionAmount1) } step("Check recent address item №2") { - checkRecentAddressItem(address = shortenedRecipientAddress, description = descriptionForTransaction) + checkRecentAddressItem(address = shortenedRecipientAddress, description = recentTransactionAmount2) } step("Check recent address item №3") { - checkRecentAddressItem(address = recipientAddressBase + "k", description = descriptionForTransaction) + checkRecentAddressItem(address = recipientAddressBase + "k", description = recentTransactionAmount2) } step("Check recent address item №4") { - checkRecentAddressItem(address = recipientAddressBase + "c", description = descriptionForTransaction) + checkRecentAddressItem(address = recipientAddressBase + "c", description = recentTransactionAmount2) } step("Check recent address item №5") { - checkRecentAddressItem(address = recipientAddressBase + "d", description = descriptionForTransaction) + checkRecentAddressItem(address = recipientAddressBase + "d", description = recentTransactionAmount2) } step("Check recent address item №6") { - checkRecentAddressItem(address = recipientAddressBase + "e", description = descriptionForTransaction) + checkRecentAddressItem(address = recipientAddressBase + "e", description = recentTransactionAmount2) } step("Swipe up") { - swipeVertical(SwipeDirection.UP) + waitForIdle() + swipeVertical(SwipeDirection.UP, startHeightRatio = 0.6f) } step("Check recent address item №7") { - checkRecentAddressItem(address = recipientAddressBase + "f", description = descriptionForTransaction) + checkRecentAddressItem(address = recipientAddressBase + "f", description = recentTransactionAmount2) } step("Check recent address item №8") { - checkRecentAddressItem(address = recipientAddressBase + "g", description = descriptionForTransaction) + checkRecentAddressItem(address = recipientAddressBase + "g", description = recentTransactionAmount2) } step("Check recent address item №9") { - checkRecentAddressItem(address = recipientAddressBase + "o", description = descriptionForTransaction) + checkRecentAddressItem(address = recipientAddressBase + "o", description = recentTransactionAmount2) } step("Check recent address item №10") { - checkRecentAddressItem(address = recipientAddressBase + "p", description = descriptionForTransaction) + checkRecentAddressItem(address = recipientAddressBase + "p", description = recentTransactionAmount2) } step("Assert recent address item №11 is not displayed") { onSendAddressScreen { recentAddressItem(recipientAddressBase + "a").assertIsNotDisplayed() } @@ -283,7 +309,6 @@ class RecentBlockTest : BaseTestCase() { val tokenName = "Dogecoin" val sendAmount = "1" val txHistoryScenarioState = "2OutgoingTransactions" - val descriptionForWalletTransaction2 = "DOGE 0.0192, 11/09/2025, 3:18 PM" setupHooks( additionalAfterSection = { @@ -313,11 +338,11 @@ class RecentBlockTest : BaseTestCase() { step("Assert 'Recent' title is displayed") { onSendAddressScreen { recentAddressesTitle.assertIsDisplayed() } } - step("Check recent address item") { - checkRecentAddressItem(address = DOGECOIN_ADDRESS, description = descriptionForWalletTransaction) + step("Check recent address item №1") { + checkRecentAddressItem(address = DOGECOIN_ADDRESS, description = recentTransactionAmount1) } - step("Check recent address item") { - checkRecentAddressItem(address = DOGECOIN_ADDRESS, description = descriptionForWalletTransaction2) + step("Check recent address item №2") { + checkRecentAddressItem(address = DOGECOIN_ADDRESS, description = recentTransactionAmount3) } step("Click on recent address item") { onSendAddressScreen { recentAddressItem(DOGECOIN_ADDRESS).performClick() } diff --git a/app/src/androidTest/kotlin/com/tangem/tests/send/confirmScreen/SendConfirmScreenTest.kt b/app/src/androidTest/kotlin/com/tangem/tests/send/confirmScreen/SendConfirmScreenTest.kt index 5a89153081..6ecfda055b 100644 --- a/app/src/androidTest/kotlin/com/tangem/tests/send/confirmScreen/SendConfirmScreenTest.kt +++ b/app/src/androidTest/kotlin/com/tangem/tests/send/confirmScreen/SendConfirmScreenTest.kt @@ -5,6 +5,8 @@ import com.tangem.common.constants.TestConstants.ETHEREUM_RECIPIENT_ADDRESS import com.tangem.common.constants.TestConstants.POLKADOT_RECIPIENT_ADDRESS 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 +import com.tangem.common.constants.TestConstants.WAIT_UNTIL_TIMEOUT_LONG import com.tangem.common.extensions.* import com.tangem.common.utils.resetWireMockScenarioState import com.tangem.common.utils.setWireMockScenarioState @@ -290,10 +292,17 @@ class SendConfirmScreenTest : BaseTestCase() { } step("Click on 'Refresh' button") { waitForIdle() - onSendConfirmScreen { refreshButton.clickWithAssertion() } + onSendConfirmScreen { + flakySafely(WAIT_UNTIL_TIMEOUT) { + refreshButton.clickWithAssertion() + refreshButton.assertDoesNotExist() + } + } } step("Check network fee block") { - checkNetworkFeeBlock(currentFeeAmount = currentFeeAmount, withFeeSelector = false) + flakySafely(WAIT_UNTIL_TIMEOUT_LONG) { + checkNetworkFeeBlock(currentFeeAmount = currentFeeAmount, withFeeSelector = false) + } } } }