Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Allow await().until() to finish successfully even if the time is out #292

@SButterfly

Description

@SButterfly

Is there any ability to finish successfully, even if time is out?

Problem:
We are using await().until() in our UI tests to verify asynchronous conditions. These tests run in a single thread. Frequently, the condition being evaluated returns true just as the timeout is reached. However, instead of completing successfully, await().until() throws a timeout exception.

This behavior is inconvenient because we still want to check if the last retry was successful. And if it was (even if the time is over) we still want to continue a successful execution.

await()
    .pollInSameThread()
    .atMost(60, TimeUnit.SECONDS)
    .until(() -> {
        // ... some check that may take several seconds
        // ... condition evaluation logic
        return conditionMet; // Returns true at the 60-second mark
    });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions