adding warning when the signout flow is unexpected

This commit is contained in:
Adam Brown 2021-11-08 17:08:53 +00:00
parent 9e9698520a
commit 528c5a3671
2 changed files with 11 additions and 5 deletions

View file

@ -80,12 +80,12 @@ class UiAllScreensSanityTest {
verifyCreatedRoom()
}
elementRobot.signout()
elementRobot.signout(expectSignOutWarning = true)
// Login again on the same account
elementRobot.login(userId)
elementRobot.dismissVerificationIfPresent()
// TODO Deactivate account instead of logout?
elementRobot.signout()
elementRobot.signout(expectSignOutWarning = false)
}
}

View file

@ -95,15 +95,19 @@ class ElementRobot {
waitUntilViewVisible(withId(R.id.bottomNavigationView))
}
fun signout() {
fun signout(expectSignOutWarning: Boolean) {
clickOn(R.id.groupToolbarAvatarImageView)
clickOn(R.id.homeDrawerHeaderSignoutView)
val hasSentMessages = kotlin.runCatching {
val isShowingSignOutWarning = kotlin.runCatching {
waitUntilViewVisible(withId(R.id.exitAnywayButton))
}.isSuccess
if (hasSentMessages) {
if (expectSignOutWarning != isShowingSignOutWarning) {
Timber.w("Unexpected sign out flow, expected warning to be: ${expectSignOutWarning.toWarningType()} but was ${isShowingSignOutWarning.toWarningType()}")
}
if (isShowingSignOutWarning) {
// We have sent a message in a e2e room, accept to loose it
clickOn(R.id.exitAnywayButton)
// Dark pattern
@ -135,3 +139,5 @@ class ElementRobot {
}.onFailure { Timber.w("Verification popup missing", it) }
}
}
private fun Boolean.toWarningType() = if (this) "shown" else "skipped"