[#282] Tests fail on low resolution devices.

- Scrolling enabled for screens from Backup and Profile parts of the app.
- UI tests improved to always scroll to the desired views before working with them.
This commit is contained in:
Honza Rychnovsky 2022-04-12 15:31:27 +02:00 committed by GitHub
parent e44e901676
commit fff0dc4110
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 2 deletions

View File

@ -9,6 +9,7 @@ import androidx.compose.ui.test.onAllNodesWithTag
import androidx.compose.ui.test.onChildren
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performClick
import androidx.compose.ui.test.performScrollTo
import androidx.test.filters.MediumTest
import cash.z.ecc.sdk.fixture.PersistableWalletFixture
import co.electriccoin.zcash.ui.R
@ -54,6 +55,7 @@ class BackupViewTest {
val testSetup = newTestSetup(BackupStage.Seed)
composeTestRule.onNodeWithText(getStringResource(R.string.new_wallet_3_button_copy)).also {
it.performScrollTo()
it.performClick()
}
@ -113,7 +115,10 @@ class BackupViewTest {
assertEquals(BackupStage.Seed, testSetup.getStage())
composeTestRule.onNode(hasText(getStringResource(R.string.new_wallet_3_button_finished))).performClick()
composeTestRule.onNode(hasText(getStringResource(R.string.new_wallet_3_button_finished))).also {
it.performScrollTo()
it.performClick()
}
assertEquals(BackupStage.Test, testSetup.getStage())
@ -171,12 +176,14 @@ class BackupViewTest {
assertEquals(BackupStage.Seed, testSetup.getStage())
composeTestRule.onNodeWithText(getStringResource(R.string.new_wallet_3_button_copy)).also {
it.performScrollTo()
it.performClick()
}
assertEquals(1, testSetup.getOnCopyToClipboardCount())
composeTestRule.onNodeWithText(getStringResource(R.string.new_wallet_3_button_finished)).also {
it.performScrollTo()
it.performClick()
}

View File

@ -93,6 +93,7 @@ class ProfileViewTest {
assertEquals(0, testSetup.getOnSettingsCount())
composeTestRule.onNodeWithText(getStringResource(R.string.profile_settings)).also {
it.performScrollTo()
it.performClick()
}

View File

@ -6,6 +6,8 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Card
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.runtime.Composable
@ -121,7 +123,7 @@ private fun EducationRecoveryPhrase(onNext: () -> Unit) {
@Composable
private fun SeedPhrase(persistableWallet: PersistableWallet, onNext: () -> Unit, onCopyToClipboard: () -> Unit) {
Column {
Column(Modifier.verticalScroll(rememberScrollState())) {
Header(stringResource(R.string.new_wallet_3_header))
Body(stringResource(R.string.new_wallet_3_body_1))