Created
November 26, 2019 14:37
-
-
Save matzuk/e4376b817fb6d01f84148da006394564 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
flakyBehaviorInterceptor.intercept(action = { | |
viewInteraction.perform(ViewAction) | |
}) { | |
var cachedException: Throwable | |
var startTime = System.currentTimeMillis() | |
do { | |
try { | |
return action.invoke() | |
} catch (e: Throwable) { | |
Thread.sleep(intervalMs) | |
cachedException = e | |
} | |
} while(System.currentTimeMillis() - startTime <= timeoutMs) | |
throw cachedException | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment