From 711ec52286820d1d9030b3ed899ebb05979fd000 Mon Sep 17 00:00:00 2001 From: Nikita Evdokimov Date: Mon, 14 Oct 2024 19:22:59 +0300 Subject: [PATCH] ISSUE-678: Close crash dialogs --- .../kaspersky/kaspresso/params/SystemDialogsSafetyParams.kt | 5 +++-- .../kaspresso/systemsafety/SystemDialogSafetyProviderImpl.kt | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/kaspresso/src/main/kotlin/com/kaspersky/kaspresso/params/SystemDialogsSafetyParams.kt b/kaspresso/src/main/kotlin/com/kaspersky/kaspresso/params/SystemDialogsSafetyParams.kt index e04cc6ea7..303aa1343 100644 --- a/kaspresso/src/main/kotlin/com/kaspersky/kaspresso/params/SystemDialogsSafetyParams.kt +++ b/kaspresso/src/main/kotlin/com/kaspersky/kaspresso/params/SystemDialogsSafetyParams.kt @@ -1,9 +1,10 @@ package com.kaspersky.kaspresso.params data class SystemDialogsSafetyParams( - val shouldIgnoreKeyboard: Boolean + val shouldIgnoreKeyboard: Boolean, + val shouldIgnoreCrashes: Boolean, ) { companion object { - fun default() = SystemDialogsSafetyParams(shouldIgnoreKeyboard = false) + fun default() = SystemDialogsSafetyParams(shouldIgnoreKeyboard = false, shouldIgnoreCrashes = false) } } diff --git a/kaspresso/src/main/kotlin/com/kaspersky/kaspresso/systemsafety/SystemDialogSafetyProviderImpl.kt b/kaspresso/src/main/kotlin/com/kaspersky/kaspresso/systemsafety/SystemDialogSafetyProviderImpl.kt index 52cbdec5c..8a0bb6bda 100644 --- a/kaspresso/src/main/kotlin/com/kaspersky/kaspresso/systemsafety/SystemDialogSafetyProviderImpl.kt +++ b/kaspresso/src/main/kotlin/com/kaspersky/kaspresso/systemsafety/SystemDialogSafetyProviderImpl.kt @@ -118,6 +118,10 @@ class SystemDialogSafetyProviderImpl( isSystemDialogVisible = isSystemDialogVisible && !isKeyboardVisible } + if (!systemDialogsSafetyParams.shouldIgnoreCrashes) { + isSystemDialogVisible = isSystemDialogVisible || listOf("aerr_close", "aerr_close_app").any { isVisible(By.res("android", it)) } + } + if (isSystemDialogVisible) { logger.i("The android system dialog/window was detected") return true