Improve `wait`/`retry` helper modules
Description
wait
helper that we have defined it becoming more complex, and keeping it as a single method is reaching its limitations.
We can consider making it a class, and implement a little more more flexible interface.
Update: We've since added these two modules:
They've replaced the old wait
method (in fact, wait
just uses Waiter
)
However, there's some overlap between Waiter.wait
and Retrier.retry_until
, and could combine the two modules and remove some redundancy.
One important thing to keep in mind is that Capybara itself handles waiting and retrying if there are exceptions. So we should ask ourselves "Does Capybara already do this?" before we add functionality to our framework.
Tasks:
-
Refactor wait/retry methods to use one class with deduplicated logic and more flexibility: https://gitlab.com/gitlab-org/gitlab/merge_requests/21804 -
Replace usage of the old methods with the new ones. https://gitlab.com/gitlab-org/gitlab/merge_requests/22861 -
Make raise_on_failure
true by default so that tests don't continue after waiting for an event that doesn't happen. https://gitlab.com/gitlab-org/gitlab/merge_requests/22864