Skip to content

Commit

Permalink
TECH: fix flaky test (#626)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikitae57 authored Apr 18, 2024
1 parent 1fcb27f commit 40b6cdd
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.kaspersky.kaspresso.kautomatorsample.kaspresso.sanity.dialogs_safety
import android.os.Build
import androidx.test.ext.junit.rules.activityScenarioRule
import androidx.test.uiautomator.StaleObjectException
import com.kaspersky.components.kautomator.intercept.exception.UnfoundedUiObjectException
import com.kaspersky.kaspresso.kaspresso.Kaspresso
import com.kaspersky.kaspresso.kautomatorsample.screen.SystemDialogsScreen
import com.kaspersky.kaspresso.kautomatorsample.systemdialogs.SystemDialogsActivity
Expand Down Expand Up @@ -43,13 +44,21 @@ class SystemDialogSafetyObjectDisabledSanityTest : TestCase(
SystemDialogsScreen {
btn2 {
flakySafely(3000) {
Assert.assertThrows(null, StaleObjectException::class.java) {
isDisplayed()
click()
Assert.assertThrows(SampleException::class.java) {
try {
isDisplayed()
click()
} catch (ex: StaleObjectException) {
throw SampleException()
} catch (ex: UnfoundedUiObjectException) {
throw SampleException()
}
}
}
}
}
}
}

class SampleException : Throwable()
}

0 comments on commit 40b6cdd

Please sign in to comment.