Created
October 4, 2021 20:57
-
-
Save mcatta/886ca07949574b64908d7ace7bdabfa9 to your computer and use it in GitHub Desktop.
WelcomeRobotScreen sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| internal class WelcomeRobotScreen( | |
| private val baseAndroidComposeTest: BaseAndroidComposeTest | |
| ) : BaseRobotScreen( | |
| baseAndroidComposeTest.composeTestRule | |
| ) { | |
| private val usernameField by lazy { composeTestRule.onNode(hasText(getString(R.string.welcome_username_hint))) } | |
| private val confirmButton by lazy { composeTestRule.onNode(hasText(getString(R.string.welcome_confirm_button))) } | |
| fun typeUsername(username: String) = usernameField.performTextReplacement(username) | |
| fun isConfirmEnabled(enabled: Boolean) = confirmButton.assert( | |
| if (enabled) isEnabled() else isEnabled().not() | |
| ) | |
| infix fun confirmUsername(func: RepoListRobotScreen.() -> Unit): RepoListRobotScreen { | |
| confirmButton.performClick() | |
| return baseAndroidComposeTest.repoListRobotScreen(func = func) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment