Updated on 2026-08-14

This commit is contained in:
Tangem 2026-05-04 12:21:04 +05:00
parent 31048beddb
commit 3fe7585ba8
4 changed files with 31 additions and 13 deletions

View file

@ -20,9 +20,6 @@ fun BaseTestCase.scanCard(
productType != null -> MockProvider.setMocks(productType)
else -> MockProvider.setMocks(ProductType.Wallet)
}
step("Click on 'Accept' button") {
onDisclaimerScreen { acceptButton.clickWithAssertion() }
}
step("Click on 'Get started' button") {
onStoriesScreen { getStartedButton.clickWithAssertion() }
}
@ -60,9 +57,6 @@ fun BaseTestCase.openMainScreen(
}
fun BaseTestCase.openMainScreenWithExistingHotWallet(seedPhrase: String) {
step("Click on 'Accept' button") {
onDisclaimerScreen { acceptButton.clickWithAssertion() }
}
step("Click on 'Get started' button") {
onStoriesScreen { getStartedButton.clickWithAssertion() }
}
@ -134,6 +128,10 @@ fun BaseTestCase.synchronizeAddresses(
onMainScreen { totalBalanceText.assert(!hasText(DASH_SIGN)) }
}
}
step("Expand 'Main account' to reveal tokens") {
onMainScreen { mainAccount().performClick() }
}
}
fun BaseTestCase.openDeviceSettingsScreen() {

View file

@ -219,6 +219,24 @@ class MainScreenPageObject(semanticsProvider: SemanticsNodeInteractionsProvider)
useUnmergedTree = true
}
/**
* Main account header on the main screen. Click to expand/collapse its tokens list.
*/
fun mainAccount(): LazyListItemNode = accountWithName(getResourceString(CoreUiR.string.account_main_account_title))
/**
* Account header on the main screen, located by its visible name. Click to expand/collapse its tokens list.
* The account's title text lives on a descendant of the test-tagged node, so we match by descendant.
*/
@OptIn(ExperimentalTestApi::class)
fun accountWithName(name: String): LazyListItemNode {
return lazyList.childWith<LazyListItemNode> {
hasTestTag(MainScreenTestTags.TOKEN_LIST_ITEM)
hasAnyDescendant(withText(name))
useUnmergedTree = true
}
}
/**
* Find token list item with title and address
*/
@ -226,7 +244,8 @@ class MainScreenPageObject(semanticsProvider: SemanticsNodeInteractionsProvider)
fun tokenWithTitleAndAddress(tokenTitle: String): KNode {
return lazyList.childWith<LazyListItemNode> {
hasTestTag(MainScreenTestTags.TOKEN_LIST_ITEM)
hasText(tokenTitle)
hasAnyDescendant(withText(tokenTitle))
useUnmergedTree = true
}.child<KNode> {
hasTestTag(TokenElementsTestTags.TOKEN_FIAT_AMOUNT)
useUnmergedTree = true
@ -237,7 +256,8 @@ class MainScreenPageObject(semanticsProvider: SemanticsNodeInteractionsProvider)
fun tokenWithCustomDerivationIcon(tokenTitle: String): KNode {
return lazyList.childWith<LazyListItemNode> {
hasTestTag(MainScreenTestTags.TOKEN_LIST_ITEM)
hasText(tokenTitle)
hasAnyDescendant(withText(tokenTitle))
useUnmergedTree = true
}.child<KNode> {
hasTestTag(TokenElementsTestTags.TOKEN_CUSTOM_DERIVATION_ICON)
useUnmergedTree = true
@ -277,8 +297,9 @@ class MainScreenPageObject(semanticsProvider: SemanticsNodeInteractionsProvider)
fun tokenWithTitleAndPosition(tokenTitle: String, index: Int): KNode {
return lazyList.childWith<LazyListItemNode> {
hasTestTag(MainScreenTestTags.TOKEN_LIST_ITEM)
hasText(tokenTitle)
hasAnyDescendant(withText(tokenTitle))
hasLazyListItemPosition(index)
useUnmergedTree = true
}.child<KNode> {
hasTestTag(TokenElementsTestTags.TOKEN_TITLE)
useUnmergedTree = true

View file

@ -18,7 +18,6 @@ import com.tangem.scenarios.synchronizeAddresses
import com.tangem.screens.ThirdPartyAppPageObject
import com.tangem.screens.onCreateWalletStartScreen
import com.tangem.screens.onDetailsScreen
import com.tangem.screens.onDisclaimerScreen
import com.tangem.screens.onFailedTransactionDialog
import com.tangem.screens.onMainScreen
import com.tangem.screens.onScanWarningDialog
@ -165,9 +164,6 @@ class FeedbackTest : BaseTestCase() {
MockProvider.resetEmulateError()
}
).run {
step("Click on 'Accept' button") {
onDisclaimerScreen { acceptButton.clickWithAssertion() }
}
step("Set scanning error") {
MockProvider.setEmulateError(TangemSdkError.TagLost())
}

View file

@ -10,6 +10,7 @@ import com.tangem.screens.onStoriesScreen
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
@ -18,6 +19,7 @@ class TermsOfServiceTest : BaseTestCase() {
@AllureId("3573")
@DisplayName("ToS: success acceptance")
@Test
@Ignore("[REDACTED_JIRA]")
fun validateTermsOfServiceScreenTest() {
setupHooks().run {
val tosUrl = "https://tangem.com/tangem_tos.html"
@ -46,6 +48,7 @@ class TermsOfServiceTest : BaseTestCase() {
@AllureId("3574")
@DisplayName("ToS: accept after app restart")
@Test
@Ignore("[REDACTED_JIRA]")
fun acceptTermsOfServiceAfterAppRestart() {
val packageName = getTargetContext().packageName
val tosUrl = "https://tangem.com/tangem_tos.html"