Updated on 2026-08-14
This commit is contained in:
parent
498e62329a
commit
02f927fd48
18 changed files with 898 additions and 29 deletions
|
|
@ -126,6 +126,10 @@ abstract class BaseTestCase : TestCase(
|
|||
with(featureTogglesManager as MutableFeatureTogglesManager) {
|
||||
changeToggle("WALLET_CONNECT_REDESIGN_ENABLED", true)
|
||||
changeToggle("WALLET_BALANCE_FETCHER_ENABLED", true)
|
||||
changeToggle("SEND_VIA_SWAP_ENABLED", true)
|
||||
changeToggle("SWAP_REDESIGN_ENABLED", true)
|
||||
changeToggle("SEND_REDESIGN_ENABLED", true)
|
||||
changeToggle("NEW_ONRAMP_MAIN_ENABLED", true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,105 @@
|
|||
package com.tangem.common.utils
|
||||
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import org.json.JSONObject
|
||||
import timber.log.Timber
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
fun getWcUri(
|
||||
network: String = "ethereum",
|
||||
baseUrl: String = "[REDACTED_ENV_URL]"
|
||||
): String? {
|
||||
Timber.i("Getting WC URI for network: $network")
|
||||
|
||||
val client = OkHttpClient.Builder()
|
||||
.connectTimeout(30, TimeUnit.SECONDS) // Таймаут подключения
|
||||
.readTimeout(60, TimeUnit.SECONDS) // Таймаут чтения ответа
|
||||
.writeTimeout(30, TimeUnit.SECONDS) // Таймаут записи
|
||||
.callTimeout(90, TimeUnit.SECONDS) // Общий таймаут запроса
|
||||
.build()
|
||||
|
||||
val request = Request.Builder()
|
||||
.url("$baseUrl/wc_uri?network=$network")
|
||||
.get()
|
||||
.build()
|
||||
|
||||
return try {
|
||||
client.newCall(request).execute().use { response ->
|
||||
Timber.i("Response code: ${response.code}")
|
||||
|
||||
if (response.isSuccessful) {
|
||||
val body = response.body?.string() ?: ""
|
||||
Timber.i("Response body: $body")
|
||||
|
||||
val jsonObject = JSONObject(body)
|
||||
|
||||
if (jsonObject.getBoolean("success")) {
|
||||
val wcUri = jsonObject.getString("wcUri")
|
||||
Timber.i("Got WC URI successfully: $wcUri")
|
||||
|
||||
wcUri
|
||||
} else {
|
||||
Timber.e("API returned error: ${jsonObject.optString("error", "Unknown")}")
|
||||
null
|
||||
}
|
||||
} else {
|
||||
val errorBody = response.body?.string() ?: "No error body"
|
||||
Timber.e("Request failed: ${response.code}, body: $errorBody")
|
||||
null
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "Error getting WC URI")
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
fun checkServiceHealth(
|
||||
baseUrl: String = "[REDACTED_ENV_URL]"
|
||||
): String? {
|
||||
Timber.i("Checking service health")
|
||||
|
||||
val client = OkHttpClient()
|
||||
val request = Request.Builder()
|
||||
.url("$baseUrl/health")
|
||||
.get()
|
||||
.build()
|
||||
|
||||
return try {
|
||||
client.newCall(request).execute().use { response ->
|
||||
Timber.i("Response code: ${response.code}")
|
||||
|
||||
if (response.isSuccessful) {
|
||||
val body = response.body?.string() ?: ""
|
||||
Timber.i("Response body: $body")
|
||||
|
||||
if (body.isEmpty()) {
|
||||
Timber.e("Response body is empty")
|
||||
return null
|
||||
}
|
||||
|
||||
val jsonObject = JSONObject(body)
|
||||
val status = jsonObject.optString("status", "")
|
||||
|
||||
if (status.isNotEmpty()) {
|
||||
Timber.i("Got status successfully: $status")
|
||||
status
|
||||
} else {
|
||||
Timber.e("Status field is missing or empty")
|
||||
null
|
||||
}
|
||||
} else {
|
||||
val errorBody = response.body?.string() ?: "No error body"
|
||||
Timber.e("Request failed: ${response.code}, body: $errorBody")
|
||||
null
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "Error checking health")
|
||||
null
|
||||
}
|
||||
}
|
||||
|
|
@ -35,6 +35,10 @@ class MainScreenPageObject(semanticsProvider: SemanticsNodeInteractionsProvider)
|
|||
}
|
||||
)
|
||||
|
||||
val screenContainer: KNode = child {
|
||||
hasTestTag(MainScreenTestTags.SCREEN_CONTAINER)
|
||||
}
|
||||
|
||||
val synchronizeAddressesButton: KNode = child {
|
||||
hasText(getResourceString(R.string.common_generate_addresses))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,108 @@
|
|||
package com.tangem.screens
|
||||
|
||||
import androidx.compose.ui.test.SemanticsNodeInteractionsProvider
|
||||
import com.tangem.common.BaseTestCase
|
||||
import com.tangem.core.ui.R
|
||||
import com.tangem.core.ui.test.BaseButtonTestTags
|
||||
import com.tangem.core.ui.test.WalletConnectBottomSheetTestTags
|
||||
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 com.tangem.features.walletconnect.impl.R as WalletConnectImplR
|
||||
|
||||
class WalletConnectBottomSheetPageObject(semanticsProvider: SemanticsNodeInteractionsProvider) :
|
||||
ComposeScreen<WalletConnectBottomSheetPageObject>(semanticsProvider = semanticsProvider) {
|
||||
|
||||
val title: KNode = child {
|
||||
hasText(getResourceString(WalletConnectImplR.string.wc_wallet_connect))
|
||||
hasTestTag(WalletConnectBottomSheetTestTags.TITLE)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val appIcon: KNode = child {
|
||||
hasTestTag(WalletConnectBottomSheetTestTags.APP_ICON)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val appName: KNode = child {
|
||||
hasTestTag(WalletConnectBottomSheetTestTags.APP_NAME)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val approveIcon: KNode = child {
|
||||
hasTestTag(WalletConnectBottomSheetTestTags.APPROVE_ICON)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val appUrl: KNode = child {
|
||||
hasTestTag(WalletConnectBottomSheetTestTags.APP_URL)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val connectionRequestIcon: KNode = child {
|
||||
hasTestTag(WalletConnectBottomSheetTestTags.CONNECTION_REQUEST_ICON)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val connectionRequestText: KNode = child {
|
||||
hasTestTag(WalletConnectBottomSheetTestTags.CONNECTION_REQUEST_TEXT)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val connectionRequestChevron: KNode = child {
|
||||
hasTestTag(WalletConnectBottomSheetTestTags.CONNECTION_REQUEST_CHEVRON)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val walletIcon: KNode = child {
|
||||
hasTestTag(WalletConnectBottomSheetTestTags.WALLET_ICON)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val walletNameTitle: KNode = child {
|
||||
hasTestTag(WalletConnectBottomSheetTestTags.WALLET_NAME_TITLE)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val walletName: KNode = child {
|
||||
hasTestTag(WalletConnectBottomSheetTestTags.WALLET_NAME)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val networksIcon: KNode = child {
|
||||
hasTestTag(WalletConnectBottomSheetTestTags.NETWORKS_ICON)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val networksTitle: KNode = child {
|
||||
hasTestTag(WalletConnectBottomSheetTestTags.NETWORKS_TITLE)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val networksIcons: KNode = child {
|
||||
hasTestTag(WalletConnectBottomSheetTestTags.NETWORKS_ICONS)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val networksSelectorIcon: KNode = child {
|
||||
hasTestTag(WalletConnectBottomSheetTestTags.NETWORKS_SELECTOR_ICON)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val cancelButton: KNode = child {
|
||||
hasText(getResourceString(R.string.common_cancel))
|
||||
hasTestTag(BaseButtonTestTags.TEXT)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val connectButton: KNode = child {
|
||||
hasText(getResourceString(R.string.wc_common_connect))
|
||||
hasTestTag(BaseButtonTestTags.TEXT)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal fun BaseTestCase.onWalletConnectBottomSheet(function: WalletConnectBottomSheetPageObject.() -> Unit) =
|
||||
onComposeScreen(composeTestRule, function)
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
package com.tangem.screens
|
||||
|
||||
import androidx.compose.ui.test.SemanticsNodeInteractionsProvider
|
||||
import com.tangem.common.BaseTestCase
|
||||
import com.tangem.core.ui.test.BaseButtonTestTags
|
||||
import com.tangem.core.ui.test.WalletConnectBottomSheetTestTags
|
||||
import com.tangem.core.ui.test.WalletConnectDetailsBottomSheetTestTags
|
||||
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 com.tangem.features.walletconnect.impl.R as WalletConnectImplR
|
||||
|
||||
class WalletConnectDetailsBottomSheetPageObject(semanticsProvider: SemanticsNodeInteractionsProvider) :
|
||||
ComposeScreen<WalletConnectDetailsBottomSheetPageObject>(semanticsProvider = semanticsProvider) {
|
||||
|
||||
val title: KNode = child {
|
||||
hasTestTag(WalletConnectDetailsBottomSheetTestTags.TITLE)
|
||||
hasText(getResourceString(WalletConnectImplR.string.wc_connected_app_title))
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val date: KNode = child {
|
||||
hasTestTag(WalletConnectDetailsBottomSheetTestTags.DATE)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val closeButton: KNode = child {
|
||||
hasTestTag(WalletConnectDetailsBottomSheetTestTags.CLOSE_BUTTON)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val networksBlockTitle: KNode = child {
|
||||
hasText(getResourceString(WalletConnectImplR.string.wc_connected_networks))
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val appIcon: KNode = child {
|
||||
hasTestTag(WalletConnectBottomSheetTestTags.APP_ICON)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val approveIcon: KNode = child {
|
||||
hasTestTag(WalletConnectBottomSheetTestTags.APPROVE_ICON)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val appName: KNode = child {
|
||||
hasTestTag(WalletConnectBottomSheetTestTags.APP_NAME)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val appUrl: KNode = child {
|
||||
hasTestTag(WalletConnectBottomSheetTestTags.APP_URL)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val walletIcon: KNode = child {
|
||||
hasTestTag(WalletConnectDetailsBottomSheetTestTags.WALLET_ICON)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val walletTitle: KNode = child {
|
||||
hasTestTag(WalletConnectDetailsBottomSheetTestTags.WALLET_TITLE)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val walletName: KNode = child {
|
||||
hasTestTag(WalletConnectDetailsBottomSheetTestTags.WALLET_NAME)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val connectedNetworksTitle: KNode = child {
|
||||
hasTestTag(WalletConnectDetailsBottomSheetTestTags.NETWORKS_TITLE)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val connectedNetworkItem: KNode = child {
|
||||
hasTestTag(WalletConnectDetailsBottomSheetTestTags.NETWORK_ITEM)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val connectedNetworkIcon: KNode = child {
|
||||
hasTestTag(WalletConnectDetailsBottomSheetTestTags.NETWORK_ICON)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val connectedNetworkName: KNode = child {
|
||||
hasTestTag(WalletConnectDetailsBottomSheetTestTags.NETWORK_NAME)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val connectedNetworkSymbol: KNode = child {
|
||||
hasTestTag(WalletConnectDetailsBottomSheetTestTags.NETWORK_SYMBOL)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val disconnectButton: KNode = child {
|
||||
hasText(getResourceString(WalletConnectImplR.string.common_disconnect))
|
||||
hasTestTag(BaseButtonTestTags.TEXT)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal fun BaseTestCase.onWalletConnectDetailsBottomSheet(function: WalletConnectDetailsBottomSheetPageObject.() -> Unit) =
|
||||
onComposeScreen(composeTestRule, function)
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package com.tangem.screens
|
||||
|
||||
import androidx.compose.ui.test.SemanticsNodeInteractionsProvider
|
||||
import com.tangem.common.BaseTestCase
|
||||
import com.tangem.core.ui.R
|
||||
import com.tangem.core.ui.test.BaseButtonTestTags
|
||||
import com.tangem.core.ui.test.WalletConnectScreenTestTags
|
||||
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
|
||||
|
||||
class WalletConnectPageObject(semanticsProvider: SemanticsNodeInteractionsProvider) :
|
||||
ComposeScreen<WalletConnectPageObject>(semanticsProvider = semanticsProvider) {
|
||||
|
||||
val title: KNode = child {
|
||||
hasText(getResourceString(R.string.wc_connections))
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val moreButton: KNode = child {
|
||||
hasTestTag(WalletConnectScreenTestTags.MORE_BUTTON)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val walletName: KNode = child {
|
||||
hasTestTag(WalletConnectScreenTestTags.WALLET_NAME)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val appIcon: KNode = child {
|
||||
hasTestTag(WalletConnectScreenTestTags.APP_ICON)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val appName: KNode = child {
|
||||
hasTestTag(WalletConnectScreenTestTags.APP_NAME)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val approveIcon: KNode = child {
|
||||
hasTestTag(WalletConnectScreenTestTags.APPROVE_ICON)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val appUrl: KNode = child {
|
||||
hasTestTag(WalletConnectScreenTestTags.APP_URL)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val newConnectionButton: KNode = child {
|
||||
hasTestTag(BaseButtonTestTags.TEXT)
|
||||
hasText(getResourceString(R.string.wc_new_connection))
|
||||
useUnmergedTree = true
|
||||
}
|
||||
}
|
||||
|
||||
internal fun BaseTestCase.onWalletConnectScreen(function: WalletConnectPageObject.() -> Unit) =
|
||||
onComposeScreen(composeTestRule, function)
|
||||
38
app/src/androidTest/kotlin/com/tangem/steps/BaseScenarios.kt
Normal file
38
app/src/androidTest/kotlin/com/tangem/steps/BaseScenarios.kt
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
package com.tangem.steps
|
||||
|
||||
import com.tangem.common.BaseTestCase
|
||||
import com.tangem.common.extensions.clickWithAssertion
|
||||
import com.tangem.domain.models.scan.ProductType
|
||||
import com.tangem.screens.onDisclaimerScreen
|
||||
import com.tangem.screens.onMainScreen
|
||||
import com.tangem.screens.onMarketsTooltipScreen
|
||||
import com.tangem.screens.onStoriesScreen
|
||||
import com.tangem.tap.domain.sdk.mocks.MockProvider
|
||||
import io.qameta.allure.kotlin.Allure.step
|
||||
|
||||
fun BaseTestCase.openMainScreen(productType: ProductType? = null) {
|
||||
if (productType != null) {
|
||||
MockProvider.setMocks(productType)
|
||||
}
|
||||
step("Click on 'Accept' button") {
|
||||
onDisclaimerScreen { acceptButton.clickWithAssertion() }
|
||||
}
|
||||
step("Click on 'Accept' button") {
|
||||
onStoriesScreen { scanButton.clickWithAssertion() }
|
||||
}
|
||||
step("Assert main screen is displayed") {
|
||||
onMainScreen { screenContainer.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert main screen is displayed") {
|
||||
onMarketsTooltipScreen { contentContainer.clickWithAssertion() }
|
||||
}
|
||||
}
|
||||
|
||||
fun BaseTestCase.synchronizeAddresses(balance: String) {
|
||||
step("Click on 'Synchronize addresses' button") {
|
||||
onMainScreen { synchronizeAddressesButton.clickWithAssertion() }
|
||||
}
|
||||
step("Assert wallet balance = '$balance'") {
|
||||
onMainScreen { walletBalance().assertTextContains(balance) }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.tangem.steps
|
||||
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import androidx.test.core.app.ApplicationProvider
|
||||
|
||||
fun openAppByDeepLink(deepLinkUri: String?) {
|
||||
val deeplinkScheme = "tangem://wc?uri="
|
||||
val context = ApplicationProvider.getApplicationContext<android.content.Context>()
|
||||
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(deeplinkScheme + deepLinkUri)).apply {
|
||||
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
}
|
||||
|
||||
context.startActivity(intent)
|
||||
}
|
||||
|
|
@ -0,0 +1,139 @@
|
|||
package com.tangem.steps
|
||||
|
||||
import com.tangem.common.BaseTestCase
|
||||
import com.tangem.screens.onWalletConnectBottomSheet
|
||||
import com.tangem.screens.onWalletConnectDetailsBottomSheet
|
||||
import com.tangem.screens.onWalletConnectScreen
|
||||
import io.qameta.allure.kotlin.Allure.step
|
||||
|
||||
fun BaseTestCase.checkWalletConnectBottomSheet() {
|
||||
step("Assert 'Wallet Connect' bottom sheet title is displayed") {
|
||||
onWalletConnectBottomSheet { title.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Wallet Connect' bottom sheet app icon is displayed") {
|
||||
onWalletConnectBottomSheet { appIcon.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Wallet Connect' bottom sheet app name is displayed") {
|
||||
onWalletConnectBottomSheet { appName.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Wallet Connect' bottom sheet approve icon is displayed") {
|
||||
onWalletConnectBottomSheet { approveIcon.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Wallet Connect' bottom sheet app URL is displayed") {
|
||||
onWalletConnectBottomSheet { appUrl.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Wallet Connect' bottom sheet connection request icon is displayed") {
|
||||
onWalletConnectBottomSheet { connectionRequestIcon.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Wallet Connect' bottom sheet connection request text is displayed") {
|
||||
onWalletConnectBottomSheet { connectionRequestText.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Wallet Connect' bottom sheet connection request chevron is displayed") {
|
||||
onWalletConnectBottomSheet { connectionRequestChevron.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Wallet Connect' bottom sheet wallet icon is displayed") {
|
||||
onWalletConnectBottomSheet { walletIcon.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Wallet Connect' bottom sheet wallet title is displayed") {
|
||||
onWalletConnectBottomSheet { walletNameTitle.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Wallet Connect' bottom sheet wallet name is displayed") {
|
||||
onWalletConnectBottomSheet { walletName.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Wallet Connect' bottom sheet networks icon is displayed") {
|
||||
onWalletConnectBottomSheet { networksIcon.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Wallet Connect' bottom sheet networks title is displayed") {
|
||||
onWalletConnectBottomSheet { networksTitle.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Wallet Connect' bottom sheet right networks icons is displayed") {
|
||||
onWalletConnectBottomSheet { networksIcons.assertIsDisplayed() }
|
||||
}
|
||||
step("'Wallet Connect' bottom sheet networks selector icon is displayed") {
|
||||
onWalletConnectBottomSheet { networksSelectorIcon.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Wallet Connect' bottom sheet 'Cancel' button is displayed") {
|
||||
onWalletConnectBottomSheet { cancelButton.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Wallet Connect' bottom sheet 'Connect' button is displayed") {
|
||||
onWalletConnectBottomSheet { connectButton.assertIsDisplayed() }
|
||||
}
|
||||
}
|
||||
|
||||
fun BaseTestCase.checkWalletConnectScreen() {
|
||||
step("Assert 'Wallet Connect' title is displayed") {
|
||||
onWalletConnectScreen { title.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'More' button is displayed") {
|
||||
onWalletConnectScreen { moreButton.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert wallet name is displayed") {
|
||||
onWalletConnectScreen { walletName.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert app icon is displayed") {
|
||||
onWalletConnectScreen { appIcon.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert app name is displayed") {
|
||||
onWalletConnectScreen { appName.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert approve icon is displayed") {
|
||||
onWalletConnectScreen { approveIcon.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert app URL is displayed") {
|
||||
onWalletConnectScreen { appUrl.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'New Connection' button is displayed") {
|
||||
onWalletConnectScreen { newConnectionButton.assertIsDisplayed() }
|
||||
}
|
||||
}
|
||||
|
||||
fun BaseTestCase.checkWalletConnectDetailsBottomSheet(dAppName: String) {
|
||||
step("Assert connection details title is displayed") {
|
||||
onWalletConnectDetailsBottomSheet { title.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert date is displayed") {
|
||||
onWalletConnectDetailsBottomSheet { date.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Close' button is displayed") {
|
||||
onWalletConnectDetailsBottomSheet { closeButton.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert app icon is displayed") {
|
||||
onWalletConnectDetailsBottomSheet { appIcon.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert app name is displayed") {
|
||||
onWalletConnectDetailsBottomSheet { appName.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert approve icon is displayed") {
|
||||
onWalletConnectDetailsBottomSheet { approveIcon.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert app URL is displayed") {
|
||||
onWalletConnectDetailsBottomSheet { appUrl.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert wallet icon is displayed") {
|
||||
onWalletConnectDetailsBottomSheet { walletIcon.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert wallet title is displayed") {
|
||||
onWalletConnectDetailsBottomSheet { walletTitle.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert wallet name is displayed") {
|
||||
onWalletConnectDetailsBottomSheet { walletName.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Connected networks' title is displayed") {
|
||||
onWalletConnectDetailsBottomSheet { connectedNetworksTitle.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert connected network item is displayed") {
|
||||
onWalletConnectDetailsBottomSheet { connectedNetworkItem.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert connected network icon is displayed") {
|
||||
onWalletConnectDetailsBottomSheet { connectedNetworkIcon.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert connected dApp name: '$dAppName'") {
|
||||
onWalletConnectDetailsBottomSheet { connectedNetworkName.assertTextContains(dAppName) }
|
||||
}
|
||||
step("Assert connected network symbol is displayed") {
|
||||
onWalletConnectDetailsBottomSheet { connectedNetworkSymbol.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Disconnect button' is displayed") {
|
||||
onWalletConnectDetailsBottomSheet { disconnectButton.assertIsDisplayed() }
|
||||
}
|
||||
}
|
||||
181
app/src/androidTest/kotlin/com/tangem/tests/WalletConnectTest.kt
Normal file
181
app/src/androidTest/kotlin/com/tangem/tests/WalletConnectTest.kt
Normal file
|
|
@ -0,0 +1,181 @@
|
|||
package com.tangem.tests
|
||||
|
||||
import com.tangem.common.BaseTestCase
|
||||
import com.tangem.common.constants.TestConstants.TOTAL_BALANCE
|
||||
import com.tangem.common.extensions.clickWithAssertion
|
||||
import com.tangem.common.extensions.swipeUp
|
||||
import com.tangem.common.utils.getWcUri
|
||||
import com.tangem.scenarios.OpenMainScreenScenario
|
||||
import com.tangem.screens.*
|
||||
import com.tangem.steps.*
|
||||
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
|
||||
class WalletConnectTest : BaseTestCase() {
|
||||
|
||||
@AllureId("3833")
|
||||
@DisplayName("WC (React App): open session from deeplink on main screen")
|
||||
@Ignore("TODO [REDACTED_JIRA] React app deeplink doesn't work")
|
||||
@Test
|
||||
fun openWalletConnectSessionOnMainScreen() {
|
||||
val balance = TOTAL_BALANCE
|
||||
val dAppName = "React App"
|
||||
val deepLinkUri = getWcUri()
|
||||
|
||||
setupHooks().run {
|
||||
step("Open 'Main Screen'") {
|
||||
openMainScreen()
|
||||
}
|
||||
step("Synchronize addresses") {
|
||||
synchronizeAddresses(balance)
|
||||
}
|
||||
step("Create WC session buy deeplink") {
|
||||
openAppByDeepLink(deepLinkUri)
|
||||
}
|
||||
step("Check 'Wallet Connect' bottom sheet") {
|
||||
checkWalletConnectBottomSheet()
|
||||
}
|
||||
step("Click on 'Connect' button") {
|
||||
onWalletConnectBottomSheet { connectButton.performClick() }
|
||||
}
|
||||
step("Click 'More' button on TopBar") {
|
||||
onTopBar { moreButton.clickWithAssertion() }
|
||||
}
|
||||
step("Click on 'Wallet Connect' button") {
|
||||
onDetailsScreen { walletConnectButton.clickWithAssertion() }
|
||||
}
|
||||
step("Check 'Wallet Connect' screen") {
|
||||
checkWalletConnectScreen()
|
||||
}
|
||||
step("Click on app icon") {
|
||||
onWalletConnectScreen { appIcon.performClick() }
|
||||
}
|
||||
step("Check 'Wallet Connect' details bottom sheet") {
|
||||
checkWalletConnectDetailsBottomSheet(dAppName)
|
||||
}
|
||||
step("Click on 'Disconnect button' is displayed") {
|
||||
onWalletConnectDetailsBottomSheet { disconnectButton.performClick() }
|
||||
}
|
||||
step("Assert connection is not displayed") {
|
||||
onWalletConnectScreen { appName.assertIsNotDisplayed() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@AllureId("3834")
|
||||
@DisplayName("WC (React App): open session from deeplink not on main screen")
|
||||
@Ignore("TODO [REDACTED_JIRA] React app deeplink doesn't work")
|
||||
@Test
|
||||
fun openWalletConnectSessionNotOnMainScreen() {
|
||||
val balance = TOTAL_BALANCE
|
||||
val dAppName = "React App"
|
||||
val deepLinkUri = getWcUri()
|
||||
|
||||
setupHooks().run {
|
||||
step("Open 'Main Screen'") {
|
||||
openMainScreen()
|
||||
}
|
||||
step("Synchronize addresses") {
|
||||
synchronizeAddresses(balance)
|
||||
}
|
||||
step("Click on 'Buy' button") {
|
||||
onMainScreen { buyButton.clickWithAssertion() }
|
||||
}
|
||||
step("Create WC session buy deeplink") {
|
||||
openAppByDeepLink(deepLinkUri)
|
||||
}
|
||||
step("Check 'Wallet Connect' bottom sheet") {
|
||||
checkWalletConnectBottomSheet()
|
||||
}
|
||||
step("Click on 'Connect' button") {
|
||||
onWalletConnectBottomSheet { connectButton.performClick() }
|
||||
}
|
||||
step("Click 'More' button on TopBar") {
|
||||
onTopBar { moreButton.clickWithAssertion() }
|
||||
}
|
||||
step("Click on 'Wallet Connect' button") {
|
||||
onDetailsScreen { walletConnectButton.clickWithAssertion() }
|
||||
}
|
||||
step("Assert 'Wallet Connect' bottom sheet is displayed") {
|
||||
onWalletConnectBottomSheet { connectButton.clickWithAssertion() }
|
||||
}
|
||||
step("Check 'Wallet Connect' screen") {
|
||||
checkWalletConnectScreen()
|
||||
}
|
||||
step("Click on app icon") {
|
||||
onWalletConnectScreen { appIcon.performClick() }
|
||||
}
|
||||
step("Check 'Wallet Connect' details bottom sheet") {
|
||||
checkWalletConnectDetailsBottomSheet(dAppName)
|
||||
}
|
||||
step("Click on 'Disconnect button' is displayed") {
|
||||
onWalletConnectDetailsBottomSheet { disconnectButton.performClick() }
|
||||
}
|
||||
step("Assert connection is not displayed") {
|
||||
onWalletConnectScreen { appName.assertIsNotDisplayed() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@AllureId("886")
|
||||
@DisplayName("WC (React App): open session from deeplink ")
|
||||
@Ignore("TODO [REDACTED_JIRA] React app deeplink doesn't work")
|
||||
@Test
|
||||
fun openWalletConnectSession() {
|
||||
val balance = TOTAL_BALANCE
|
||||
val dAppName = "React App"
|
||||
val deepLinkUri = getWcUri()
|
||||
|
||||
setupHooks().run {
|
||||
step("Open 'Main Screen'") {
|
||||
openMainScreen()
|
||||
}
|
||||
step("Synchronize addresses") {
|
||||
synchronizeAddresses(balance)
|
||||
}
|
||||
step("Open recent apps") {
|
||||
device.uiDevice.pressRecentApps()
|
||||
}
|
||||
step("Stop app by swipe") {
|
||||
swipeUp(startHeightRatio = 0.8f)
|
||||
}
|
||||
step("Create WC session buy deeplink") {
|
||||
openAppByDeepLink(deepLinkUri)
|
||||
}
|
||||
step("Open 'Main Screen'") {
|
||||
scenario(OpenMainScreenScenario(composeTestRule))
|
||||
}
|
||||
step("Check 'Wallet Connect' bottom sheet") {
|
||||
checkWalletConnectBottomSheet()
|
||||
}
|
||||
step("Click on 'Connect' button") {
|
||||
onWalletConnectBottomSheet { connectButton.performClick() }
|
||||
}
|
||||
step("Click 'More' button on TopBar") {
|
||||
onTopBar { moreButton.clickWithAssertion() }
|
||||
}
|
||||
step("Click on 'Wallet Connect' button") {
|
||||
onDetailsScreen { walletConnectButton.clickWithAssertion() }
|
||||
}
|
||||
step("Check 'Wallet Connect' screen") {
|
||||
checkWalletConnectScreen()
|
||||
}
|
||||
step("Click on app icon") {
|
||||
onWalletConnectScreen { appIcon.performClick() }
|
||||
}
|
||||
step("Check 'Wallet Connect' details bottom sheet") {
|
||||
checkWalletConnectDetailsBottomSheet(dAppName)
|
||||
}
|
||||
step("Click on 'Disconnect button' is displayed") {
|
||||
onWalletConnectDetailsBottomSheet { disconnectButton.performClick() }
|
||||
}
|
||||
step("Assert connection is not displayed") {
|
||||
onWalletConnectScreen { appName.assertIsNotDisplayed() }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -8,6 +8,7 @@ import androidx.compose.material3.Text
|
|||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
|
||||
|
|
@ -20,6 +21,7 @@ import com.tangem.core.ui.extensions.resourceReference
|
|||
import com.tangem.core.ui.extensions.stringReference
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.test.WalletConnectDetailsBottomSheetTestTags
|
||||
|
||||
/**
|
||||
* Title component for [TangemModalBottomSheet] with [TangemIconButton] for buttons.
|
||||
|
|
@ -54,7 +56,9 @@ fun TangemModalBottomSheetTitle(
|
|||
text = title.resolveReference(),
|
||||
style = TangemTheme.typography.subtitle1,
|
||||
color = TangemTheme.colors.text.primary1,
|
||||
modifier = Modifier.align(Alignment.CenterHorizontally),
|
||||
modifier = Modifier
|
||||
.align(Alignment.CenterHorizontally)
|
||||
.testTag(WalletConnectDetailsBottomSheetTestTags.TITLE),
|
||||
)
|
||||
}
|
||||
if (subtitle != null) {
|
||||
|
|
@ -62,7 +66,9 @@ fun TangemModalBottomSheetTitle(
|
|||
text = subtitle.resolveReference(),
|
||||
style = TangemTheme.typography.caption1,
|
||||
color = TangemTheme.colors.text.tertiary,
|
||||
modifier = Modifier.align(Alignment.CenterHorizontally),
|
||||
modifier = Modifier
|
||||
.align(Alignment.CenterHorizontally)
|
||||
.testTag(WalletConnectDetailsBottomSheetTestTags.DATE),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -72,7 +78,8 @@ fun TangemModalBottomSheetTitle(
|
|||
onClick = onEndClick,
|
||||
modifier = Modifier
|
||||
.padding(16.dp)
|
||||
.align(Alignment.CenterEnd),
|
||||
.align(Alignment.CenterEnd)
|
||||
.testTag(WalletConnectDetailsBottomSheetTestTags.CLOSE_BUTTON),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
package com.tangem.core.ui.test
|
||||
|
||||
object WalletConnectBottomSheetTestTags {
|
||||
const val TITLE = "WALLET_CONNECT_BOTTOM_SHEET_TITLE"
|
||||
const val APP_ICON = "WALLET_CONNECT_BOTTOM_SHEET_APP_ICON"
|
||||
const val APP_NAME = "WALLET_CONNECT_BOTTOM_SHEET_APP_NAME"
|
||||
const val APPROVE_ICON = "WALLET_CONNECT_BOTTOM_SHEET_APPROVE_ICON"
|
||||
const val APP_URL = "WALLET_CONNECT_BOTTOM_SHEET_APP_URL"
|
||||
|
||||
const val CONNECTION_REQUEST_ICON = "WALLET_CONNECT_BOTTOM_SHEET_CONNECTION_REQUEST_ICON"
|
||||
const val CONNECTION_REQUEST_TEXT = "WALLET_CONNECT_BOTTOM_SHEET_CONNECTION_REQUEST_TEXT"
|
||||
const val CONNECTION_REQUEST_CHEVRON = "WALLET_CONNECT_BOTTOM_SHEET_CONNECTION_REQUEST_CHEVRON"
|
||||
|
||||
const val WALLET_ICON = "WALLET_CONNECT_BOTTOM_SHEET_WALLET_ICON"
|
||||
const val WALLET_NAME_TITLE = "WALLET_CONNECT_BOTTOM_SHEET_WALLET_NAME_TITLE"
|
||||
const val WALLET_NAME = "WALLET_CONNECT_BOTTOM_SHEET_WALLET_NAME"
|
||||
|
||||
const val NETWORKS_ICON = "WALLET_CONNECT_BOTTOM_SHEET_NETWORKS_ICON"
|
||||
const val NETWORKS_TITLE = "WALLET_CONNECT_BOTTOM_SHEET_NETWORKS_TITLE"
|
||||
const val NETWORKS_SELECTOR_ICON = "WALLET_CONNECT_BOTTOM_SHEET_NETWORKS_SELECTOR_ICON"
|
||||
const val NETWORKS_ICONS = "WALLET_CONNECT_BOTTOM_SHEET_NETWORKS_ICONS"
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.tangem.core.ui.test
|
||||
|
||||
object WalletConnectDetailsBottomSheetTestTags {
|
||||
const val TITLE = "WALLET_CONNECT_DETAILS_BOTTOM_SHEET_TITLE"
|
||||
const val DATE = "WALLET_CONNECT_DETAILS_BOTTOM_SHEET_DATE"
|
||||
const val CLOSE_BUTTON = "WALLET_CONNECT_DETAILS_BOTTOM_CLOSE_BUTTON"
|
||||
const val DISCONNECT_BUTTON = "WALLET_CONNECT_DETAILS_BOTTOM_SHEET_DISCONNECT_BUTTON"
|
||||
const val WALLET_ICON = "WALLET_CONNECT_DETAILS_BOTTOM_WALLET_ICON"
|
||||
const val WALLET_TITLE = "WALLET_CONNECT_DETAILS_BOTTOM_WALLET"
|
||||
const val WALLET_NAME = "WALLET_CONNECT_DETAILS_BOTTOM_WALLET_NAME"
|
||||
const val NETWORKS_TITLE = "WALLET_CONNECT_DETAILS_BOTTOM_WALLET_NAME"
|
||||
const val NETWORK_ITEM = "WALLET_CONNECT_DETAILS_BOTTOM_SHEET_NETWORK_ITEM"
|
||||
const val NETWORK_ICON = "WALLET_CONNECT_DETAILS_BOTTOM_SHEET_NETWORK_ICON"
|
||||
const val NETWORK_NAME = "WALLET_CONNECT_DETAILS_BOTTOM_SHEET_NETWORK_NAME"
|
||||
const val NETWORK_SYMBOL = "WALLET_CONNECT_DETAILS_BOTTOM_SHEET_NETWORK_SYMBOL"
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.tangem.core.ui.test
|
||||
|
||||
object WalletConnectScreenTestTags {
|
||||
const val MORE_BUTTON = "WALLET_CONNECT_SCREEN_MORE_BUTTON"
|
||||
const val WALLET_NAME = "WALLET_CONNECT_SCREEN_WALLET_NAME"
|
||||
const val APP_ICON = "WALLET_CONNECT_SCREEN_APP_ICON"
|
||||
const val APP_NAME = "WALLET_CONNECT_SCREEN_APP_NAME"
|
||||
const val APPROVE_ICON = "WALLET_CONNECT_SCREEN_APPROVE_ICON"
|
||||
const val APP_URL = "WALLET_CONNECT_SCREEN_APP_URL"
|
||||
}
|
||||
|
|
@ -10,6 +10,7 @@ import androidx.compose.ui.Alignment
|
|||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
|
@ -17,6 +18,8 @@ import coil.compose.AsyncImage
|
|||
import com.tangem.core.ui.extensions.clickableSingle
|
||||
import com.tangem.core.ui.extensions.conditional
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.test.WalletConnectBottomSheetTestTags
|
||||
import com.tangem.core.ui.test.WalletConnectDetailsBottomSheetTestTags
|
||||
import com.tangem.features.walletconnect.connections.entity.VerifiedDAppState
|
||||
import com.tangem.features.walletconnect.impl.R
|
||||
|
||||
|
|
@ -43,7 +46,8 @@ internal fun WcAppInfoItem(
|
|||
AsyncImage(
|
||||
modifier = Modifier
|
||||
.size(TangemTheme.dimens.size48)
|
||||
.clip(RoundedCornerShape(TangemTheme.dimens.radius8)),
|
||||
.clip(RoundedCornerShape(TangemTheme.dimens.radius8))
|
||||
.testTag(WalletConnectBottomSheetTestTags.APP_ICON),
|
||||
model = iconUrl,
|
||||
contentDescription = title,
|
||||
error = painterResource(R.drawable.img_wc_dapp_icon_placeholder_48),
|
||||
|
|
@ -58,7 +62,9 @@ internal fun WcAppInfoItem(
|
|||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
Text(
|
||||
modifier = Modifier.weight(1f, fill = false),
|
||||
modifier = Modifier
|
||||
.weight(1f, fill = false)
|
||||
.testTag(WalletConnectBottomSheetTestTags.APP_NAME),
|
||||
text = title,
|
||||
color = TangemTheme.colors.text.primary1,
|
||||
style = TangemTheme.typography.h3,
|
||||
|
|
@ -67,7 +73,9 @@ internal fun WcAppInfoItem(
|
|||
)
|
||||
if (verifiedDAppState is VerifiedDAppState.Verified) {
|
||||
Icon(
|
||||
modifier = Modifier.size(20.dp),
|
||||
modifier = Modifier
|
||||
.size(20.dp)
|
||||
.testTag(WalletConnectBottomSheetTestTags.APPROVE_ICON),
|
||||
painter = painterResource(R.drawable.img_approvale2_20),
|
||||
contentDescription = null,
|
||||
tint = Color.Unspecified,
|
||||
|
|
@ -78,6 +86,7 @@ internal fun WcAppInfoItem(
|
|||
text = subtitle,
|
||||
color = TangemTheme.colors.text.tertiary,
|
||||
style = TangemTheme.typography.body2,
|
||||
modifier = Modifier.testTag(WalletConnectBottomSheetTestTags.APP_URL),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -86,11 +95,15 @@ internal fun WcAppInfoItem(
|
|||
@Composable
|
||||
internal fun WcNetworkInfoItem(@DrawableRes icon: Int, name: String, symbol: String, modifier: Modifier = Modifier) {
|
||||
Row(
|
||||
modifier = modifier.padding(vertical = 14.dp, horizontal = 12.dp),
|
||||
modifier = modifier
|
||||
.padding(vertical = 14.dp, horizontal = 12.dp)
|
||||
.testTag(WalletConnectDetailsBottomSheetTestTags.NETWORK_ITEM),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
Icon(
|
||||
modifier = Modifier.size(24.dp),
|
||||
modifier = Modifier
|
||||
.size(24.dp)
|
||||
.testTag(WalletConnectDetailsBottomSheetTestTags.NETWORK_ICON),
|
||||
painter = painterResource(icon),
|
||||
contentDescription = null,
|
||||
tint = Color.Unspecified,
|
||||
|
|
@ -98,7 +111,8 @@ internal fun WcNetworkInfoItem(@DrawableRes icon: Int, name: String, symbol: Str
|
|||
Text(
|
||||
modifier = Modifier
|
||||
.padding(start = 12.dp)
|
||||
.weight(1f, fill = false),
|
||||
.weight(1f, fill = false)
|
||||
.testTag(WalletConnectDetailsBottomSheetTestTags.NETWORK_NAME),
|
||||
text = name,
|
||||
style = TangemTheme.typography.body1,
|
||||
color = TangemTheme.colors.text.primary1,
|
||||
|
|
@ -106,7 +120,9 @@ internal fun WcNetworkInfoItem(@DrawableRes icon: Int, name: String, symbol: Str
|
|||
overflow = TextOverflow.Ellipsis,
|
||||
)
|
||||
Text(
|
||||
modifier = Modifier.padding(start = 4.dp),
|
||||
modifier = Modifier
|
||||
.padding(start = 4.dp)
|
||||
.testTag(WalletConnectDetailsBottomSheetTestTags.NETWORK_SYMBOL),
|
||||
text = symbol,
|
||||
style = TangemTheme.typography.body1,
|
||||
color = TangemTheme.colors.text.tertiary,
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import androidx.compose.ui.graphics.Color
|
|||
import androidx.compose.ui.graphics.StrokeCap
|
||||
import androidx.compose.ui.graphics.painter.Painter
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
|
|
@ -42,6 +43,7 @@ import com.tangem.core.ui.extensions.wrappedList
|
|||
import com.tangem.core.ui.res.TangemColorPalette
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.test.WalletConnectBottomSheetTestTags
|
||||
import com.tangem.features.walletconnect.connections.entity.*
|
||||
import com.tangem.features.walletconnect.impl.R
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
|
|
@ -62,6 +64,7 @@ internal fun WcAppInfoModalBottomSheet(state: WcAppInfoUM, onBack: () -> Unit, o
|
|||
title = resourceReference(R.string.wc_wallet_connect),
|
||||
endIconRes = R.drawable.ic_close_24,
|
||||
onEndClick = onDismiss,
|
||||
modifier = Modifier.testTag(WalletConnectBottomSheetTestTags.TITLE),
|
||||
)
|
||||
},
|
||||
content = {
|
||||
|
|
@ -157,7 +160,9 @@ private fun WcAppInfoFirstBlock(state: WcAppInfoUM.Content, modifier: Modifier =
|
|||
private fun ConnectionRequestBlock(expanded: Boolean, modifier: Modifier = Modifier) {
|
||||
Row(modifier = modifier, verticalAlignment = Alignment.CenterVertically) {
|
||||
Icon(
|
||||
modifier = Modifier.size(24.dp),
|
||||
modifier = Modifier
|
||||
.size(24.dp)
|
||||
.testTag(WalletConnectBottomSheetTestTags.CONNECTION_REQUEST_ICON),
|
||||
painter = painterResource(R.drawable.ic_connect_new_24),
|
||||
contentDescription = null,
|
||||
tint = TangemTheme.colors.icon.accent,
|
||||
|
|
@ -165,7 +170,8 @@ private fun ConnectionRequestBlock(expanded: Boolean, modifier: Modifier = Modif
|
|||
Text(
|
||||
modifier = Modifier
|
||||
.padding(start = TangemTheme.dimens.spacing4)
|
||||
.weight(1f),
|
||||
.weight(1f)
|
||||
.testTag(WalletConnectBottomSheetTestTags.CONNECTION_REQUEST_TEXT),
|
||||
text = stringResourceSafe(R.string.wc_connection_request),
|
||||
style = TangemTheme.typography.body1,
|
||||
color = TangemTheme.colors.text.primary1,
|
||||
|
|
@ -173,7 +179,8 @@ private fun ConnectionRequestBlock(expanded: Boolean, modifier: Modifier = Modif
|
|||
Icon(
|
||||
modifier = Modifier
|
||||
.padding(start = TangemTheme.dimens.spacing12)
|
||||
.size(width = 18.dp, height = 24.dp),
|
||||
.size(width = 18.dp, height = 24.dp)
|
||||
.testTag(WalletConnectBottomSheetTestTags.CONNECTION_REQUEST_CHEVRON),
|
||||
painter = painterResource(if (expanded) R.drawable.ic_chevron_up_24 else R.drawable.ic_chevron_24),
|
||||
contentDescription = null,
|
||||
tint = TangemTheme.colors.icon.informative,
|
||||
|
|
@ -319,7 +326,9 @@ private fun WcAppInfoSecondBlock(state: WcAppInfoUM.Content, modifier: Modifier
|
|||
private fun WalletRowItem(walletName: String, showEndIcon: Boolean, modifier: Modifier = Modifier) {
|
||||
Row(modifier = modifier, verticalAlignment = Alignment.CenterVertically) {
|
||||
Icon(
|
||||
modifier = Modifier.size(24.dp),
|
||||
modifier = Modifier
|
||||
.size(24.dp)
|
||||
.testTag(WalletConnectBottomSheetTestTags.WALLET_ICON),
|
||||
painter = painterResource(R.drawable.ic_wallet_new_24),
|
||||
contentDescription = null,
|
||||
tint = TangemTheme.colors.icon.accent,
|
||||
|
|
@ -330,14 +339,18 @@ private fun WalletRowItem(walletName: String, showEndIcon: Boolean, modifier: Mo
|
|||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
Text(
|
||||
modifier = Modifier.padding(start = TangemTheme.dimens.spacing4),
|
||||
modifier = Modifier
|
||||
.padding(start = TangemTheme.dimens.spacing4)
|
||||
.testTag(WalletConnectBottomSheetTestTags.WALLET_NAME_TITLE),
|
||||
text = stringResourceSafe(R.string.manage_tokens_network_selector_wallet),
|
||||
style = TangemTheme.typography.body1,
|
||||
color = TangemTheme.colors.text.primary1,
|
||||
maxLines = 1,
|
||||
)
|
||||
Text(
|
||||
modifier = Modifier.padding(start = TangemTheme.dimens.spacing16),
|
||||
modifier = Modifier
|
||||
.padding(start = TangemTheme.dimens.spacing16)
|
||||
.testTag(WalletConnectBottomSheetTestTags.WALLET_NAME),
|
||||
text = walletName,
|
||||
textAlign = TextAlign.End,
|
||||
style = TangemTheme.typography.body1,
|
||||
|
|
@ -366,7 +379,9 @@ private fun SelectNetworksBlock(networksInfo: WcNetworksInfo, modifier: Modifier
|
|||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
Icon(
|
||||
modifier = Modifier.size(24.dp),
|
||||
modifier = Modifier
|
||||
.size(24.dp)
|
||||
.testTag(WalletConnectBottomSheetTestTags.NETWORKS_ICON),
|
||||
painter = painterResource(R.drawable.ic_network_new_24),
|
||||
contentDescription = null,
|
||||
tint = TangemTheme.colors.icon.accent,
|
||||
|
|
@ -374,7 +389,8 @@ private fun SelectNetworksBlock(networksInfo: WcNetworksInfo, modifier: Modifier
|
|||
Text(
|
||||
modifier = Modifier
|
||||
.padding(start = TangemTheme.dimens.spacing4)
|
||||
.weight(1f),
|
||||
.weight(1f)
|
||||
.testTag(WalletConnectBottomSheetTestTags.NETWORKS_TITLE),
|
||||
text = stringResourceSafe(R.string.wc_common_networks),
|
||||
style = TangemTheme.typography.body1,
|
||||
color = TangemTheme.colors.text.primary1,
|
||||
|
|
@ -385,7 +401,9 @@ private fun SelectNetworksBlock(networksInfo: WcNetworksInfo, modifier: Modifier
|
|||
is WcNetworksInfo.NoneNetworksAdded -> Unit
|
||||
}
|
||||
Icon(
|
||||
modifier = Modifier.size(width = 18.dp, height = 24.dp),
|
||||
modifier = Modifier
|
||||
.size(width = 18.dp, height = 24.dp)
|
||||
.testTag(WalletConnectBottomSheetTestTags.NETWORKS_SELECTOR_ICON),
|
||||
painter = painterResource(id = R.drawable.ic_select_18_24),
|
||||
contentDescription = null,
|
||||
tint = TangemTheme.colors.icon.informative,
|
||||
|
|
@ -417,7 +435,8 @@ private fun NetworkIcons(items: ImmutableList<WcNetworkInfoItem>, modifier: Modi
|
|||
)
|
||||
.padding(2.dp)
|
||||
.clip(CircleShape)
|
||||
.size(20.dp),
|
||||
.size(20.dp)
|
||||
.testTag(WalletConnectBottomSheetTestTags.NETWORKS_ICONS),
|
||||
)
|
||||
}
|
||||
if (remainingCount > 0) {
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import androidx.compose.runtime.key
|
|||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
|
|
@ -28,6 +29,7 @@ import com.tangem.core.ui.extensions.wrappedList
|
|||
import com.tangem.core.ui.res.TangemColorPalette
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.test.WalletConnectDetailsBottomSheetTestTags
|
||||
import com.tangem.core.ui.utils.DateTimeFormatters
|
||||
import com.tangem.core.ui.utils.toDateFormatWithTodayYesterday
|
||||
import com.tangem.core.ui.utils.toTimeFormat
|
||||
|
|
@ -116,7 +118,8 @@ private fun WcConnectedAppInfoBSContent(state: WcConnectedAppInfoUM, modifier: M
|
|||
SecondaryButton(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(vertical = 16.dp),
|
||||
.padding(vertical = 16.dp)
|
||||
.testTag(WalletConnectDetailsBottomSheetTestTags.DISCONNECT_BUTTON),
|
||||
text = stringResourceSafe(R.string.common_disconnect),
|
||||
enabled = state.disconnectButtonConfig.enabled,
|
||||
showProgress = state.disconnectButtonConfig.showProgress,
|
||||
|
|
@ -142,7 +145,9 @@ private fun AppInfoFirstBlock(state: WcConnectedAppInfoUM, modifier: Modifier =
|
|||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
Icon(
|
||||
modifier = Modifier.size(24.dp),
|
||||
modifier = Modifier
|
||||
.size(24.dp)
|
||||
.testTag(WalletConnectDetailsBottomSheetTestTags.WALLET_ICON),
|
||||
painter = painterResource(R.drawable.ic_wallet_new_24),
|
||||
contentDescription = null,
|
||||
tint = TangemTheme.colors.icon.accent,
|
||||
|
|
@ -150,7 +155,8 @@ private fun AppInfoFirstBlock(state: WcConnectedAppInfoUM, modifier: Modifier =
|
|||
Text(
|
||||
modifier = Modifier
|
||||
.padding(start = TangemTheme.dimens.spacing4)
|
||||
.weight(1f),
|
||||
.weight(1f)
|
||||
.testTag(WalletConnectDetailsBottomSheetTestTags.WALLET_TITLE),
|
||||
text = stringResourceSafe(R.string.manage_tokens_network_selector_wallet),
|
||||
style = TangemTheme.typography.body1,
|
||||
color = TangemTheme.colors.text.primary1,
|
||||
|
|
@ -158,7 +164,8 @@ private fun AppInfoFirstBlock(state: WcConnectedAppInfoUM, modifier: Modifier =
|
|||
Text(
|
||||
modifier = Modifier
|
||||
.padding(start = TangemTheme.dimens.spacing16)
|
||||
.weight(1f),
|
||||
.weight(1f)
|
||||
.testTag(WalletConnectDetailsBottomSheetTestTags.WALLET_NAME),
|
||||
text = state.walletName,
|
||||
textAlign = TextAlign.End,
|
||||
style = TangemTheme.typography.body1,
|
||||
|
|
@ -174,7 +181,8 @@ private fun NetworksBlock(networks: ImmutableList<WcNetworkInfoItem.Required>, m
|
|||
Text(
|
||||
modifier = Modifier
|
||||
.padding(top = 12.dp, bottom = 4.dp)
|
||||
.padding(horizontal = 12.dp),
|
||||
.padding(horizontal = 12.dp)
|
||||
.testTag(WalletConnectDetailsBottomSheetTestTags.NETWORKS_TITLE),
|
||||
text = stringResourceSafe(R.string.wc_connected_networks),
|
||||
style = TangemTheme.typography.subtitle2,
|
||||
color = TangemTheme.colors.text.tertiary,
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import androidx.compose.ui.Modifier
|
|||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalDensity
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
|
|
@ -35,6 +36,7 @@ import com.tangem.core.ui.components.snackbar.TangemSnackbarHost
|
|||
import com.tangem.core.ui.extensions.stringResourceSafe
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.test.WalletConnectScreenTestTags
|
||||
import com.tangem.features.walletconnect.connections.entity.*
|
||||
import com.tangem.features.walletconnect.connections.ui.preview.WcConnectionsPreviewData
|
||||
import com.tangem.features.walletconnect.impl.R
|
||||
|
|
@ -170,7 +172,9 @@ private fun ConnectionItem(connection: WcConnectionsUM, modifier: Modifier = Mod
|
|||
Column(modifier = modifier) {
|
||||
key("${connection.userWalletId}_${connection.walletName}") {
|
||||
Text(
|
||||
modifier = Modifier.padding(top = 12.dp, bottom = 4.dp, start = 12.dp, end = 12.dp),
|
||||
modifier = Modifier
|
||||
.padding(top = 12.dp, bottom = 4.dp, start = 12.dp, end = 12.dp)
|
||||
.testTag(WalletConnectScreenTestTags.WALLET_NAME),
|
||||
text = connection.walletName,
|
||||
color = TangemTheme.colors.text.tertiary,
|
||||
style = TangemTheme.typography.subtitle2,
|
||||
|
|
@ -199,7 +203,8 @@ private fun AppInfoItem(appInfo: WcConnectedAppInfo, modifier: Modifier = Modifi
|
|||
AsyncImage(
|
||||
modifier = Modifier
|
||||
.size(40.dp)
|
||||
.clip(RoundedCornerShape(TangemTheme.dimens.radius8)),
|
||||
.clip(RoundedCornerShape(TangemTheme.dimens.radius8))
|
||||
.testTag(WalletConnectScreenTestTags.APP_ICON),
|
||||
model = appInfo.iconUrl,
|
||||
error = painterResource(R.drawable.img_wc_dapp_icon_placeholder_48),
|
||||
fallback = painterResource(R.drawable.img_wc_dapp_icon_placeholder_48),
|
||||
|
|
@ -214,7 +219,9 @@ private fun AppInfoItem(appInfo: WcConnectedAppInfo, modifier: Modifier = Modifi
|
|||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
Text(
|
||||
modifier = Modifier.weight(1f, fill = false),
|
||||
modifier = Modifier
|
||||
.weight(1f, fill = false)
|
||||
.testTag(WalletConnectScreenTestTags.APP_NAME),
|
||||
text = appInfo.name,
|
||||
color = TangemTheme.colors.text.primary1,
|
||||
style = TangemTheme.typography.subtitle2,
|
||||
|
|
@ -223,7 +230,9 @@ private fun AppInfoItem(appInfo: WcConnectedAppInfo, modifier: Modifier = Modifi
|
|||
)
|
||||
if (appInfo.verifiedState is VerifiedDAppState.Verified) {
|
||||
Icon(
|
||||
modifier = Modifier.size(20.dp),
|
||||
modifier = Modifier
|
||||
.size(20.dp)
|
||||
.testTag(WalletConnectScreenTestTags.APPROVE_ICON),
|
||||
painter = painterResource(R.drawable.img_approvale2_20),
|
||||
contentDescription = null,
|
||||
tint = Color.Unspecified,
|
||||
|
|
@ -234,6 +243,7 @@ private fun AppInfoItem(appInfo: WcConnectedAppInfo, modifier: Modifier = Modifi
|
|||
text = appInfo.subtitle,
|
||||
color = TangemTheme.colors.text.tertiary,
|
||||
style = TangemTheme.typography.caption2,
|
||||
modifier = Modifier.testTag(WalletConnectScreenTestTags.APP_URL),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -259,6 +269,7 @@ private fun ConnectionsTopBar(
|
|||
TopAppBarButton(
|
||||
button = config.startButtonUM,
|
||||
tint = TangemTheme.colors.icon.primary1,
|
||||
modifier = Modifier.testTag(WalletConnectScreenTestTags.MORE_BUTTON),
|
||||
)
|
||||
},
|
||||
title = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue