Updated on 2026-08-14

This commit is contained in:
Tangem 2026-07-14 14:18:06 +03:00
parent 32632f7309
commit fb9ba88c84
2 changed files with 10 additions and 8 deletions

View file

@ -1,6 +1,7 @@
package com.tangem.tests.main package com.tangem.tests.main
import com.tangem.common.BaseTestCase import com.tangem.common.BaseTestCase
import com.tangem.common.constants.TestConstants.USER_TOKENS_API_SCENARIO
import com.tangem.common.extensions.clickWithAssertion import com.tangem.common.extensions.clickWithAssertion
import com.tangem.common.utils.resetWireMockScenarioState import com.tangem.common.utils.resetWireMockScenarioState
import com.tangem.common.utils.setWireMockScenarioState import com.tangem.common.utils.setWireMockScenarioState
@ -27,16 +28,15 @@ class OrganizeTokensTest : BaseTestCase() {
@DisplayName("Organize tokens: Correct tokens list displaying for current wallet") @DisplayName("Organize tokens: Correct tokens list displaying for current wallet")
@Test @Test
fun organizeTokensCorrectTokensListDisplaying() { fun organizeTokensCorrectTokensListDisplaying() {
val userTokensScenario = "user_tokens_api"
val userTokensState = "Wallet2MockTokensList" val userTokensState = "Wallet2MockTokensList"
setupHooks( setupHooks(
additionalAfterSection = { additionalAfterSection = {
resetWireMockScenarioState(userTokensScenario) resetWireMockScenarioState(USER_TOKENS_API_SCENARIO)
} }
).run { ).run {
step("Set WireMock scenario: '$userTokensScenario' to state: '$userTokensState'") { step("Set WireMock scenario: '$USER_TOKENS_API_SCENARIO' to state: '$userTokensState'") {
setWireMockScenarioState(userTokensScenario, userTokensState) setWireMockScenarioState(USER_TOKENS_API_SCENARIO, userTokensState)
} }
step("Open 'Main Screen'") { step("Open 'Main Screen'") {
openMainScreen() openMainScreen()
@ -83,6 +83,9 @@ class OrganizeTokensTest : BaseTestCase() {
val sourceIndex = 2 val sourceIndex = 2
val destinationIndex = 1 val destinationIndex = 1
val before = getDisplayedTokenTitles() val before = getDisplayedTokenTitles()
require(before.size > sourceIndex && before.size > destinationIndex) {
"Expected at least ${maxOf(sourceIndex, destinationIndex) + 1} tokens to reorder, but got ${before.size}: $before"
}
dragToken(source = before[sourceIndex], destination = before[destinationIndex]) dragToken(source = before[sourceIndex], destination = before[destinationIndex])
val expected = before.toMutableList().apply { val expected = before.toMutableList().apply {
add(destinationIndex, removeAt(sourceIndex)) add(destinationIndex, removeAt(sourceIndex))

View file

@ -57,12 +57,11 @@ class TokenListTest : BaseTestCase() {
@DisplayName("Main: token list differs after switching to a second wallet") @DisplayName("Main: token list differs after switching to a second wallet")
@Test @Test
fun tokenListChangedAfterSwitchingWalletTest() { fun tokenListChangedAfterSwitchingWalletTest() {
val userTokensScenario = "user_tokens_api"
val userTokensState = "ReducedTokens" val userTokensState = "ReducedTokens"
setupHooks( setupHooks(
additionalAfterSection = { additionalAfterSection = {
resetWireMockScenarioState(userTokensScenario) resetWireMockScenarioState(USER_TOKENS_API_SCENARIO)
} }
).run { ).run {
step("Open 'Main Screen'") { step("Open 'Main Screen'") {
@ -74,8 +73,8 @@ class TokenListTest : BaseTestCase() {
val firstWalletTokens = getMainScreenTokensOrder() val firstWalletTokens = getMainScreenTokensOrder()
step("Set WireMock scenario: '$userTokensScenario' to state: '$userTokensState'") { step("Set WireMock scenario: '$USER_TOKENS_API_SCENARIO' to state: '$userTokensState'") {
setWireMockScenarioState(userTokensScenario, userTokensState) setWireMockScenarioState(USER_TOKENS_API_SCENARIO, userTokensState)
} }
step("Add a second card wallet") { step("Add a second card wallet") {
addNewCardWalletWithoutSync(Wallet2MockContent) addNewCardWalletWithoutSync(Wallet2MockContent)