DEV: Don't hardcode timeout for SystemHelpers#try_until_success (#22180)

Different environments run on different hardware so response times vary
based on hardware. Instead of hardcoding the timeout for
`SystemHelpers#try_until_success` to 2 seconds, we change it such that
it follows `Capybara.default_wait_timeout` which we have configured to
be higher in environments which runs on lousier hardware.

This change should reduce the amount of flakiness we're seeing on CI
with tests that rely on `SystemHlpers#try_until_success`.
This commit is contained in:
Alan Guo Xiang Tan 2023-06-19 10:58:36 +08:00 committed by GitHub
parent 0626b7c413
commit 626eda4c91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,7 +30,7 @@ module SystemHelpers
SiteSetting.splash_screen = false
end
def try_until_success(timeout: 2, frequency: 0.01)
def try_until_success(timeout: Capybara.default_max_wait_time, frequency: 0.01)
start ||= Time.zone.now
backoff ||= frequency
yield