[#1448] Screenshot testing enabled
* [#1448] Screenshot testing enabled Closes #1448 * Changelog update --------- Co-authored-by: Honza <rychnovsky.honza@gmail.com>
This commit is contained in:
parent
b2f750fb38
commit
66458a221a
|
@ -6,6 +6,9 @@ and this application adheres to [Semantic Versioning](https://semver.org/spec/v2
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
## Fixed
|
||||
- The app screenshot testing has been re-enabled after we moved away from AppCompat components
|
||||
|
||||
## [1.1.5 (706)] - 2024-08-09
|
||||
|
||||
### Changed
|
||||
|
|
|
@ -27,10 +27,12 @@ import androidx.compose.ui.Modifier
|
|||
import androidx.compose.ui.graphics.ColorFilter
|
||||
import androidx.compose.ui.graphics.painter.ColorPainter
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import co.electriccoin.zcash.ui.design.R
|
||||
import co.electriccoin.zcash.ui.design.component.AnimationConstants.ANIMATION_DURATION
|
||||
import co.electriccoin.zcash.ui.design.component.AnimationConstants.INITIAL_DELAY
|
||||
import co.electriccoin.zcash.ui.design.component.AnimationConstants.WELCOME_ANIM_TEST_TAG
|
||||
import co.electriccoin.zcash.ui.design.theme.ZcashTheme
|
||||
import co.electriccoin.zcash.ui.design.util.screenHeight
|
||||
import kotlinx.coroutines.delay
|
||||
|
@ -40,6 +42,7 @@ import kotlin.time.Duration.Companion.milliseconds
|
|||
object AnimationConstants {
|
||||
const val ANIMATION_DURATION = 700
|
||||
const val INITIAL_DELAY = 1000
|
||||
const val WELCOME_ANIM_TEST_TAG = "WELCOME_ANIM_TEST_TAG"
|
||||
|
||||
fun together() = (ANIMATION_DURATION + INITIAL_DELAY).toLong()
|
||||
}
|
||||
|
@ -56,7 +59,7 @@ fun WelcomeAnimationAutostart(
|
|||
|
||||
WelcomeAnimation(
|
||||
animationState = currentAnimationState,
|
||||
modifier = modifier
|
||||
modifier = modifier.testTag(WELCOME_ANIM_TEST_TAG)
|
||||
)
|
||||
|
||||
// Let's start the animation automatically in case e.g. authentication is not involved
|
||||
|
|
|
@ -2,26 +2,14 @@
|
|||
|
||||
package co.electroniccoin.zcash.ui.screenshot
|
||||
|
||||
import org.junit.Test
|
||||
|
||||
// NOTE: this is just a placeholder test to satisfy this module test settings and will be removed once the below
|
||||
// issue is resolved
|
||||
class ScreenshotTest {
|
||||
@Test
|
||||
fun placeholderTest() {
|
||||
assert(true)
|
||||
}
|
||||
}
|
||||
/*
|
||||
TODO [#1448]: Re-enable or rework screenshot testing
|
||||
TODO [#1448]: https://github.com/Electric-Coin-Company/zashi-android/issues/1448
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.os.LocaleList
|
||||
import androidx.activity.viewModels
|
||||
import androidx.compose.ui.test.ExperimentalTestApi
|
||||
import androidx.compose.ui.test.assertIsEnabled
|
||||
import androidx.compose.ui.test.hasContentDescription
|
||||
import androidx.compose.ui.test.hasTestTag
|
||||
import androidx.compose.ui.test.hasText
|
||||
import androidx.compose.ui.test.junit4.AndroidComposeTestRule
|
||||
import androidx.compose.ui.test.junit4.ComposeContentTestRule
|
||||
|
@ -54,6 +42,7 @@ import co.electriccoin.zcash.ui.MainActivity
|
|||
import co.electriccoin.zcash.ui.NavigationTargets
|
||||
import co.electriccoin.zcash.ui.R
|
||||
import co.electriccoin.zcash.ui.common.viewmodel.SecretState
|
||||
import co.electriccoin.zcash.ui.design.component.AnimationConstants.WELCOME_ANIM_TEST_TAG
|
||||
import co.electriccoin.zcash.ui.design.component.ConfigurationOverride
|
||||
import co.electriccoin.zcash.ui.design.component.UiMode
|
||||
import co.electriccoin.zcash.ui.screen.account.AccountTag
|
||||
|
@ -168,6 +157,7 @@ class ScreenshotTest : UiTestPrerequisites() {
|
|||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalTestApi::class)
|
||||
@Suppress("LongMethod", "CyclomaticComplexMethod")
|
||||
private fun takeScreenshotsForRestoreWallet(
|
||||
resContext: Context,
|
||||
|
@ -183,6 +173,8 @@ class ScreenshotTest : UiTestPrerequisites() {
|
|||
composeTestRule.activity.walletViewModel.secretState.value is SecretState.None
|
||||
}
|
||||
|
||||
composeTestRule.waitUntilDoesNotExist(hasTestTag(WELCOME_ANIM_TEST_TAG), DEFAULT_TIMEOUT_MILLISECONDS)
|
||||
|
||||
composeTestRule.onNodeWithText(
|
||||
text =
|
||||
resContext.getString(
|
||||
|
@ -324,6 +316,7 @@ class ScreenshotTest : UiTestPrerequisites() {
|
|||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalTestApi::class)
|
||||
private fun onboardingScreenshots(
|
||||
resContext: Context,
|
||||
tag: String,
|
||||
|
@ -339,6 +332,8 @@ private fun onboardingScreenshots(
|
|||
ScreenshotTest.takeScreenshot(tag, "Onboarding 1")
|
||||
}
|
||||
|
||||
composeTestRule.waitUntilDoesNotExist(hasTestTag(WELCOME_ANIM_TEST_TAG), DEFAULT_TIMEOUT_MILLISECONDS)
|
||||
|
||||
composeTestRule.onNodeWithText(
|
||||
text = resContext.getString(R.string.onboarding_create_new_wallet),
|
||||
ignoreCase = true
|
||||
|
@ -347,7 +342,10 @@ private fun onboardingScreenshots(
|
|||
}
|
||||
|
||||
// Security Warning screen
|
||||
composeTestRule.onNodeWithText(text = resContext.getString(R.string.security_warning_acknowledge)).also {
|
||||
composeTestRule.onNodeWithText(
|
||||
text = resContext.getString(R.string.security_warning_acknowledge),
|
||||
ignoreCase = true
|
||||
).also {
|
||||
it.assertExists()
|
||||
it.performClick()
|
||||
ScreenshotTest.takeScreenshot(tag, "Security Warning")
|
||||
|
@ -551,4 +549,3 @@ private fun seedScreenshots(
|
|||
|
||||
ScreenshotTest.takeScreenshot(tag, "Seed 1")
|
||||
}
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue