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

Add getter for Timeout/PollDelay/PollInterval #269

Open
asuras-coding opened this issue Nov 23, 2023 · 0 comments
Open

Add getter for Timeout/PollDelay/PollInterval #269

asuras-coding opened this issue Nov 23, 2023 · 0 comments

Comments

@asuras-coding
Copy link

Hey there,

I miss the getter methods for the configured timeouts. In our test environment, for some steps I want to increase the timeouts and later reset to the original values. Therefore it would be nice if I could use a getter to save them before changing them for a block of code

fun withAwaitilityTimeouts(
    pollDelay: Duration? = null,
    pollInterval: Duration? = null,
    timeout: Duration? = null,
    environment: Environment = Environment.LOCAL,
    block: () -> Unit
) {
    val previousPollDelay = Awaitility.getDefaultPollDelay()
    val previousPollInterval= Awaitility.getDefaultPollInterval()
    val previousTimeout = Awaitility.getDefaultTimeout()
    pollDelay?.let { Awaitility.setDefaultPollDelay(it) }
    pollInterval?.let { Awaitility.setDefaultPollInterval(it) }
    timeout?.let { Awaitility.setDefaultTimeout(it) }
    block()
    Awaitility.setDefaultPollDelay(previousPollDelay)
    Awaitility.setDefaultPollInterval(previousPollInterval)
    Awaitility.setDefaultTimeout(previousTimeout)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant