2022-06-13 23:50:55 -07:00
|
|
|
package co.electriccoin.zcash.ui.screen.onboarding.integration
|
|
|
|
|
|
|
|
import androidx.compose.ui.test.junit4.createAndroidComposeRule
|
|
|
|
import androidx.compose.ui.test.onNodeWithText
|
|
|
|
import androidx.compose.ui.test.performClick
|
|
|
|
import androidx.test.filters.MediumTest
|
|
|
|
import co.electriccoin.zcash.test.UiTestPrerequisites
|
|
|
|
import co.electriccoin.zcash.ui.R
|
|
|
|
import co.electriccoin.zcash.ui.common.UiTestingActivity
|
2023-03-03 05:06:03 -08:00
|
|
|
import co.electriccoin.zcash.ui.screen.onboarding.LongOnboardingTestSetup
|
2022-06-13 23:50:55 -07:00
|
|
|
import co.electriccoin.zcash.ui.screen.onboarding.model.OnboardingStage
|
|
|
|
import co.electriccoin.zcash.ui.test.getStringResource
|
|
|
|
import org.junit.Assert.assertEquals
|
|
|
|
import org.junit.Rule
|
|
|
|
import org.junit.Test
|
|
|
|
|
|
|
|
class OnboardingActivityTest : UiTestPrerequisites() {
|
|
|
|
@get:Rule
|
|
|
|
val composeTestRule = createAndroidComposeRule<UiTestingActivity>()
|
|
|
|
|
2023-03-03 05:06:03 -08:00
|
|
|
private fun newTestSetup() = LongOnboardingTestSetup(
|
2023-02-21 10:28:03 -08:00
|
|
|
composeTestRule,
|
|
|
|
OnboardingStage.ShieldedByDefault
|
|
|
|
)
|
2022-06-13 23:50:55 -07:00
|
|
|
|
|
|
|
@Test
|
|
|
|
@MediumTest
|
|
|
|
fun current_stage_restoration_activity() {
|
|
|
|
val testSetup = newTestSetup()
|
|
|
|
testSetup.setDefaultContent()
|
|
|
|
|
|
|
|
assertEquals(OnboardingStage.ShieldedByDefault, testSetup.getOnboardingStage())
|
|
|
|
|
|
|
|
composeTestRule.onNodeWithText(getStringResource(R.string.onboarding_next)).also {
|
|
|
|
it.performClick()
|
|
|
|
}
|
|
|
|
|
|
|
|
assertEquals(OnboardingStage.UnifiedAddresses, testSetup.getOnboardingStage())
|
|
|
|
|
|
|
|
composeTestRule.activityRule.scenario.onActivity {
|
|
|
|
it.recreate()
|
|
|
|
}
|
|
|
|
|
|
|
|
assertEquals(OnboardingStage.UnifiedAddresses, testSetup.getOnboardingStage())
|
|
|
|
}
|
|
|
|
}
|