Updated on 2026-08-14
This commit is contained in:
parent
2c90ae7209
commit
91e137eaed
11 changed files with 1372 additions and 18 deletions
|
|
@ -9,7 +9,7 @@ import com.tangem.tap.domain.sdk.mocks.MockContent
|
|||
import com.tangem.tap.domain.sdk.mocks.MockProvider
|
||||
import io.qameta.allure.kotlin.Allure.step
|
||||
|
||||
fun BaseTestCase.openMainScreen(
|
||||
fun BaseTestCase.scanCard(
|
||||
productType: ProductType? = null,
|
||||
mockContent: MockContent? = null,
|
||||
alreadyActivatedDialogIsShown : Boolean = false
|
||||
|
|
@ -32,6 +32,20 @@ fun BaseTestCase.openMainScreen(
|
|||
AlreadyUsedWalletDialogPageObject { thisIsMyWalletButton.click() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun BaseTestCase.openMainScreen(
|
||||
productType: ProductType? = null,
|
||||
mockContent: MockContent? = null,
|
||||
alreadyActivatedDialogIsShown: Boolean = false
|
||||
) {
|
||||
step("Scan card") {
|
||||
scanCard(
|
||||
productType = productType,
|
||||
mockContent = mockContent,
|
||||
alreadyActivatedDialogIsShown = alreadyActivatedDialogIsShown
|
||||
)
|
||||
}
|
||||
step("Assert 'Main' screen is displayed") {
|
||||
onMainScreen { screenContainer.assertIsDisplayed() }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,112 @@
|
|||
package com.tangem.scenarios
|
||||
|
||||
import com.tangem.common.BaseTestCase
|
||||
import com.tangem.screens.onOnboardingScreen
|
||||
import io.qameta.allure.kotlin.Allure.step
|
||||
|
||||
fun BaseTestCase.checkBackupScreen() {
|
||||
step("Assert 'Creating a backup' top bar title is displayed") {
|
||||
onOnboardingScreen { creatingBackupTobBarTitle.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Prepare your scan or ring' title is displayed") {
|
||||
onOnboardingScreen { prepareYouCardOrRingTitle.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Start backup' text is displayed") {
|
||||
onOnboardingScreen { startBackupText.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Scan card' button is displayed") {
|
||||
onOnboardingScreen { scanCardButton.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Skip for later' button is not displayed") {
|
||||
onOnboardingScreen { skipForLaterButton.assertIsNotDisplayed() }
|
||||
}
|
||||
}
|
||||
|
||||
fun BaseTestCase.checkCreateWalletScreenForWalletNoWallets() {
|
||||
step("Assert 'Create wallet' tob bar title is displayed") {
|
||||
onOnboardingScreen { createWalletTopBarTitle.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert top bar 'Back' button is displayed") {
|
||||
onOnboardingScreen { topBarBackButton.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert top bar 'More' button is displayed") {
|
||||
onOnboardingScreen { topBarMoreButton.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Create wallet' title is displayed") {
|
||||
onOnboardingScreen { createWalletTitle.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Create wallet' text is displayed") {
|
||||
onOnboardingScreen { createWalletText.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Create wallet' button is displayed") {
|
||||
onOnboardingScreen { createWalletButton.assertIsDisplayed() }
|
||||
}
|
||||
}
|
||||
|
||||
fun BaseTestCase.openAndCheckBackupScreenForWalletNoWallets() {
|
||||
step("Click on 'Create wallet' button") {
|
||||
onOnboardingScreen { createWalletButton.performClick() }
|
||||
}
|
||||
step("Assert 'Getting started' top bar title is displayed") {
|
||||
onOnboardingScreen { gettingStartedTobBarTitle.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Backup wallet' title is displayed") {
|
||||
onOnboardingScreen { backupWalletTitle.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Backup wallet' text is displayed") {
|
||||
onOnboardingScreen { backupWalletText.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Backup now' button is displayed") {
|
||||
onOnboardingScreen { backupWalletButton.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Skip for later' button is not displayed") {
|
||||
onOnboardingScreen { skipForLaterButton.assertIsNotDisplayed() }
|
||||
}
|
||||
}
|
||||
|
||||
fun BaseTestCase.checkCreateWalletScreenForWallet2NoWallets() {
|
||||
step("Assert 'Create a wallet' top bar title is displayed") {
|
||||
onOnboardingScreen { createWalletTopBarTitle.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert top bar 'Back' button is displayed") {
|
||||
onOnboardingScreen { topBarBackButton.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert top bar 'More' button is displayed") {
|
||||
onOnboardingScreen { topBarMoreButton.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Generate keys privately' title is displayed") {
|
||||
onOnboardingScreen { generateKeysPrivatelyTitle.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Generate keys privately' text is displayed") {
|
||||
onOnboardingScreen { generateKeysPrivatelyText.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Create wallet' button is displayed") {
|
||||
onOnboardingScreen { createWalletButton.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Other options' button is displayed") {
|
||||
onOnboardingScreen { otherOptionsButton.assertIsDisplayed() }
|
||||
}
|
||||
}
|
||||
fun BaseTestCase.openAndCheckBackupScreenForWallet2NoWallets() {
|
||||
step("Click on 'Create wallet' button") {
|
||||
onOnboardingScreen { createWalletButton.performClick() }
|
||||
}
|
||||
step("Assert 'Creating a backup' top bar title is displayed") {
|
||||
onOnboardingScreen { creatingBackupTobBarTitle.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'No backup devices' title is displayed") {
|
||||
onOnboardingScreen { noBackupDevicesTitle.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'No backup devices' text is displayed") {
|
||||
onOnboardingScreen { noBackupDevicesText.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Add card or ring' button is displayed") {
|
||||
onOnboardingScreen { addCardOrRingButton.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Finalize backup' button is displayed") {
|
||||
onOnboardingScreen { finalizeBackupButton.assertIsDisplayed() }
|
||||
}
|
||||
step("Assert 'Skip for later' button is not displayed") {
|
||||
onOnboardingScreen { skipForLaterButton.assertIsNotDisplayed() }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,151 @@
|
|||
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.StoriesScreenTestTags
|
||||
import com.tangem.core.ui.test.TopAppBarTestTags
|
||||
import com.tangem.wallet.R
|
||||
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 io.github.kakaocup.kakao.common.views.KView
|
||||
import io.github.kakaocup.kakao.text.KButton
|
||||
import com.tangem.features.onboarding.v2.impl.R as OnboardingImplR
|
||||
|
||||
class OnboardingPageObject(semanticsProvider: SemanticsNodeInteractionsProvider) :
|
||||
ComposeScreen<OnboardingPageObject>(semanticsProvider = semanticsProvider) {
|
||||
|
||||
val topBarBackButton: KNode = child {
|
||||
hasTestTag(TopAppBarTestTags.CLOSE_BUTTON)
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val createWalletTopBarTitle: KNode = child {
|
||||
hasTestTag(TopAppBarTestTags.TITLE)
|
||||
hasText(getResourceString(OnboardingImplR.string.onboarding_create_wallet_header))
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val createWalletTitle: KNode = child {
|
||||
hasTestTag(StoriesScreenTestTags.TITLE)
|
||||
hasText(getResourceString(OnboardingImplR.string.onboarding_create_wallet_header))
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val createWalletText: KNode = child {
|
||||
hasTestTag(StoriesScreenTestTags.TEXT)
|
||||
hasText(getResourceString(OnboardingImplR.string.onboarding_create_wallet_body))
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val gettingStartedTobBarTitle: KNode = child {
|
||||
hasTestTag(TopAppBarTestTags.TITLE)
|
||||
hasText(getResourceString(OnboardingImplR.string.onboarding_getting_started))
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val creatingBackupTobBarTitle: KNode = child {
|
||||
hasTestTag(TopAppBarTestTags.TITLE)
|
||||
hasText(getResourceString(OnboardingImplR.string.onboarding_navbar_title_creating_backup))
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val prepareYouCardOrRingTitle: KNode = child {
|
||||
hasText(getResourceString(OnboardingImplR.string.onboarding_title_scan_origin_card))
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val startBackupText: KNode = child {
|
||||
hasText(getResourceString(OnboardingImplR.string.onboarding_subtitle_scan_primary))
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val topBarMoreButton: KNode = child {
|
||||
hasTestTag(TopAppBarTestTags.MORE_BUTTON)
|
||||
}
|
||||
|
||||
val backupWalletTitle: KNode = child {
|
||||
hasText(getResourceString(OnboardingImplR.string.onboarding_wallet_info_title_first))
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val backupWalletText: KNode = child {
|
||||
hasText(getResourceString(OnboardingImplR.string.onboarding_wallet_info_subtitle_first))
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val generateKeysPrivatelyTitle: KNode = child {
|
||||
hasText(getResourceString(OnboardingImplR.string.onboarding_create_wallet_options_title))
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val generateKeysPrivatelyText: KNode = child {
|
||||
hasText(getResourceString(OnboardingImplR.string.onboarding_create_wallet_options_message))
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val noBackupDevicesTitle: KNode = child {
|
||||
hasText(getResourceString(OnboardingImplR.string.onboarding_subtitle_no_backup_cards))
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val noBackupDevicesText: KNode = child {
|
||||
hasText(getResourceString(OnboardingImplR.string.onboarding_title_no_backup_cards))
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val createWalletButton: KNode = child {
|
||||
hasTestTag(BaseButtonTestTags.TEXT)
|
||||
hasText(getResourceString(OnboardingImplR.string.onboarding_create_wallet_button_create_wallet))
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val backupWalletButton: KNode = child {
|
||||
hasTestTag(BaseButtonTestTags.TEXT)
|
||||
hasText(getResourceString(OnboardingImplR.string.onboarding_button_backup_now))
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val scanCardButton: KNode = child {
|
||||
hasTestTag(BaseButtonTestTags.TEXT)
|
||||
hasText(getResourceString(OnboardingImplR.string.onboarding_button_backup_card))
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val otherOptionsButton: KNode = child {
|
||||
hasTestTag(BaseButtonTestTags.TEXT)
|
||||
hasText(getResourceString(OnboardingImplR.string.onboarding_create_wallet_options_button_options))
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val addCardOrRingButton: KNode = child {
|
||||
hasTestTag(BaseButtonTestTags.TEXT)
|
||||
hasText(getResourceString(OnboardingImplR.string.onboarding_button_add_backup_card))
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val finalizeBackupButton: KNode = child {
|
||||
hasTestTag(BaseButtonTestTags.TEXT)
|
||||
hasText(getResourceString(OnboardingImplR.string.onboarding_button_finalize_backup))
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val skipForLaterButton: KNode = child {
|
||||
hasTestTag(BaseButtonTestTags.TEXT)
|
||||
hasText(getResourceString(OnboardingImplR.string.onboarding_button_skip_backup))
|
||||
useUnmergedTree = true
|
||||
}
|
||||
|
||||
val enableNFCAlert: KView = KView {
|
||||
withId(R.id.alertTitle)
|
||||
}
|
||||
|
||||
val cancelButton: KButton = KButton {
|
||||
withId(android.R.id.button2)
|
||||
}
|
||||
}
|
||||
|
||||
internal fun BaseTestCase.onOnboardingScreen(function: OnboardingPageObject.() -> Unit) =
|
||||
onComposeScreen(composeTestRule, function)
|
||||
|
|
@ -3,18 +3,12 @@ package com.tangem.screens
|
|||
import androidx.compose.ui.test.SemanticsNodeInteractionsProvider
|
||||
import com.tangem.common.BaseTestCase
|
||||
import com.tangem.core.ui.test.StoriesScreenTestTags
|
||||
import com.tangem.wallet.R
|
||||
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.views.KView
|
||||
import io.github.kakaocup.kakao.text.KButton
|
||||
|
||||
class StoriesPageObject(semanticsProvider: SemanticsNodeInteractionsProvider) :
|
||||
ComposeScreen<StoriesPageObject>(
|
||||
semanticsProvider = semanticsProvider,
|
||||
viewBuilderAction = { hasTestTag(StoriesScreenTestTags.SCREEN_CONTAINER) }
|
||||
) {
|
||||
ComposeScreen<StoriesPageObject>(semanticsProvider = semanticsProvider) {
|
||||
|
||||
val scanButton: KNode = child {
|
||||
hasTestTag(StoriesScreenTestTags.SCAN_BUTTON)
|
||||
|
|
@ -23,14 +17,6 @@ class StoriesPageObject(semanticsProvider: SemanticsNodeInteractionsProvider) :
|
|||
val orderButton: KNode = child {
|
||||
hasTestTag(StoriesScreenTestTags.ORDER_BUTTON)
|
||||
}
|
||||
|
||||
val enableNFCAlert: KView = KView {
|
||||
withId(R.id.alertTitle)
|
||||
}
|
||||
|
||||
val cancelButton: KButton = KButton {
|
||||
withId(android.R.id.button2)
|
||||
}
|
||||
}
|
||||
|
||||
internal fun BaseTestCase.onStoriesScreen(function: StoriesPageObject.() -> Unit) =
|
||||
|
|
|
|||
|
|
@ -0,0 +1,64 @@
|
|||
package com.tangem.tests
|
||||
|
||||
import com.tangem.common.BaseTestCase
|
||||
import com.tangem.scenarios.*
|
||||
import com.tangem.tap.domain.sdk.mocks.content.ShibaNoBackupMockContent
|
||||
import com.tangem.tap.domain.sdk.mocks.content.ShibaNoBackupNoWalletsMockContent
|
||||
import com.tangem.tap.domain.sdk.mocks.content.Wallet2NoBackupMockContent
|
||||
import com.tangem.tap.domain.sdk.mocks.content.Wallet2NoBackupNoWalletsMockContent
|
||||
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 OnboardingTest : BaseTestCase() {
|
||||
|
||||
@AllureId("248")
|
||||
@DisplayName("Onboarding: 'Shiba' no wallets backup screen test")
|
||||
@Test
|
||||
fun shibaNoWalletsBackupScreenTest() {
|
||||
setupHooks().run {
|
||||
scanCard(mockContent = ShibaNoBackupNoWalletsMockContent)
|
||||
checkCreateWalletScreenForWalletNoWallets()
|
||||
openAndCheckBackupScreenForWalletNoWallets()
|
||||
}
|
||||
}
|
||||
|
||||
@AllureId("3989")
|
||||
@DisplayName("Onboarding: 'Shiba' with wallets backup screen test")
|
||||
@Test
|
||||
fun shibaBackupScreenTest() {
|
||||
setupHooks().run {
|
||||
scanCard(
|
||||
mockContent = ShibaNoBackupMockContent,
|
||||
alreadyActivatedDialogIsShown = true
|
||||
)
|
||||
checkBackupScreen()
|
||||
}
|
||||
}
|
||||
|
||||
@AllureId("246")
|
||||
@DisplayName("Onboarding: 'Wallet 2' no wallets backup screen test")
|
||||
@Test
|
||||
fun wallet2NoWalletsBackupScreenTest() {
|
||||
setupHooks().run {
|
||||
scanCard(mockContent = Wallet2NoBackupNoWalletsMockContent)
|
||||
checkCreateWalletScreenForWallet2NoWallets()
|
||||
openAndCheckBackupScreenForWallet2NoWallets()
|
||||
}
|
||||
}
|
||||
|
||||
@AllureId("3990")
|
||||
@DisplayName("Onboarding: 'Wallet 2' with wallets backup screen test")
|
||||
@Test
|
||||
fun wallet2BackupScreenTest() {
|
||||
setupHooks().run {
|
||||
scanCard(
|
||||
mockContent = Wallet2NoBackupMockContent,
|
||||
alreadyActivatedDialogIsShown = true
|
||||
)
|
||||
checkBackupScreen()
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue