From 626eda4c91f3a774f740ed48b28d1d6566a8447e Mon Sep 17 00:00:00 2001 From: Alan Guo Xiang Tan Date: Mon, 19 Jun 2023 10:58:36 +0800 Subject: [PATCH] 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`. --- spec/support/system_helpers.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/support/system_helpers.rb b/spec/support/system_helpers.rb index f5a737e8823..e23adc8e1e8 100644 --- a/spec/support/system_helpers.rb +++ b/spec/support/system_helpers.rb @@ -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