From fff0dc4110a4d53a482d5f05b56cbd32b578757a Mon Sep 17 00:00:00 2001 From: Honza Rychnovsky Date: Tue, 12 Apr 2022 15:31:27 +0200 Subject: [PATCH] [#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. --- .../zcash/ui/screen/backup/view/BackupViewTest.kt | 9 ++++++++- .../zcash/ui/screen/profile/view/ProfileViewTest.kt | 1 + .../zcash/ui/screen/backup/view/BackupView.kt | 4 +++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ui-lib/src/androidTest/java/co/electriccoin/zcash/ui/screen/backup/view/BackupViewTest.kt b/ui-lib/src/androidTest/java/co/electriccoin/zcash/ui/screen/backup/view/BackupViewTest.kt index 732a3f99..a1c5f4c6 100644 --- a/ui-lib/src/androidTest/java/co/electriccoin/zcash/ui/screen/backup/view/BackupViewTest.kt +++ b/ui-lib/src/androidTest/java/co/electriccoin/zcash/ui/screen/backup/view/BackupViewTest.kt @@ -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() } diff --git a/ui-lib/src/androidTest/java/co/electriccoin/zcash/ui/screen/profile/view/ProfileViewTest.kt b/ui-lib/src/androidTest/java/co/electriccoin/zcash/ui/screen/profile/view/ProfileViewTest.kt index 30b0334f..6f6d3191 100644 --- a/ui-lib/src/androidTest/java/co/electriccoin/zcash/ui/screen/profile/view/ProfileViewTest.kt +++ b/ui-lib/src/androidTest/java/co/electriccoin/zcash/ui/screen/profile/view/ProfileViewTest.kt @@ -93,6 +93,7 @@ class ProfileViewTest { assertEquals(0, testSetup.getOnSettingsCount()) composeTestRule.onNodeWithText(getStringResource(R.string.profile_settings)).also { + it.performScrollTo() it.performClick() } diff --git a/ui-lib/src/main/java/co/electriccoin/zcash/ui/screen/backup/view/BackupView.kt b/ui-lib/src/main/java/co/electriccoin/zcash/ui/screen/backup/view/BackupView.kt index 53347364..3d598686 100644 --- a/ui-lib/src/main/java/co/electriccoin/zcash/ui/screen/backup/view/BackupView.kt +++ b/ui-lib/src/main/java/co/electriccoin/zcash/ui/screen/backup/view/BackupView.kt @@ -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))