Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TECH: fix flaky test #626

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
}
Loading