mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 09:25:49 +03:00
adding warning when the signout flow is unexpected
This commit is contained in:
parent
9e9698520a
commit
528c5a3671
2 changed files with 11 additions and 5 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue