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

2.3.5. Fix assertion error exception #62

Merged
merged 1 commit into from
Mar 17, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ kotlin.code.style=official
android.useAndroidX=true
GROUP=com.atiurin
POM_ARTIFACT_ID=ultron
VERSION_NAME=2.3.4
VERSION_NAME=2.3.5

POM_NAME=ultron

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ object AssertUtils {
Assert.assertTrue(System.currentTimeMillis() - startTime <= time)
}

fun assertExecTimeBetween(minTime: Long, maxTime: Long,block: () -> Unit){
fun assertExecTimeBetween(minTime: Long, maxTime: Long, block: () -> Unit) {
val startTime = System.currentTimeMillis()
try {
block()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,16 @@ class RecyclerViewTest : BaseTest() {
}
}

@Test
fun item_notExist_executionTime() {
val timeout = 5_000L
AssertUtils.assertExecTimeMoreThen(timeout){
AssertUtils.assertException {
runCatching { page.recycler.withTimeout(timeout).item(withText("Not existed item")).isDisplayed() }
}
}
}

@Test
@SetUp(CUSTOM_TIMEOUT)
@TearDown(CUSTOM_TIMEOUT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ object UltronConfig {
UltronAssertionException::class.java,
PerformException::class.java,
NoMatchingViewException::class.java,
AmbiguousViewMatcherException::class.java
AmbiguousViewMatcherException::class.java,
UltronOperationException::class.java
)
val resultHandler: (EspressoOperationResult<UltronEspressoOperation>) -> Unit = {
resultAnalyzer.analyze(it)
Expand All @@ -158,10 +159,11 @@ object UltronConfig {
UltronWrapperException::class.java,
UltronException::class.java,
UltronAssertionException::class.java,
UltronOperationException::class.java,
PerformException::class.java,
NoMatchingViewException::class.java,
AssertionFailedError::class.java,
AmbiguousViewMatcherException::class.java
AmbiguousViewMatcherException::class.java,
)
val resultHandler: (EspressoOperationResult<UltronEspressoOperation>) -> Unit = {
resultAnalyzer.analyze(it)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.atiurin.ultron.exceptions

import android.annotation.SuppressLint

class UltronOperationException : AssertionError {
class UltronOperationException : RuntimeException {
constructor(message: String) : super(message)
@SuppressLint("NewApi")
constructor(message: String, cause: Throwable) : super(message, cause)
Expand Down
Loading