Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Make feature tests more stable

Christophe Bliard4b4f436d97d6
diff --git a/spec/support/browsers/chrome.rb b/spec/support/browsers/chrome.rb
index fe558e977aa..d17bc1d30c5 100644
--- a/spec/support/browsers/chrome.rb
+++ b/spec/support/browsers/chrome.rb
@@ -30,6 +30,19 @@ def register_chrome(language, name: :"chrome_#{language}", headless: "new", over
# Disable "Select your search engine screen"
options.add_argument("--disable-search-engine-choice-screen")
+ # Disable timers being throttled in background pages/tabs. Useful for
+ # parallel test runs.
+ options.add_argument("disable-background-timer-throttling")
+
+ # Normally, Chrome will treat a 'foreground' tab instead as backgrounded if
+ # the surrounding window is occluded (aka visually covered) by another
+ # window. This flag disables that. Useful for parallel test runs.
+ options.add_argument("disable-backgrounding-occluded-windows")
+
+ # This disables non-foreground tabs from getting a lower process priority.
+ # Useful for parallel test runs.
+ options.add_argument("disable-renderer-backgrounding")
+
options.add_preference(:download,
directory_upgrade: true,
prompt_for_download: false,
diff --git a/spec/support/cuprite_setup.rb b/spec/support/cuprite_setup.rb
index c6af2b3c913..eb9a36b0e77 100644
--- a/spec/support/cuprite_setup.rb
+++ b/spec/support/cuprite_setup.rb
@@ -86,7 +86,17 @@ def register_better_cuprite(language, name: :"better_cuprite_#{language}")
lang: language,
"accept-lang": language,
"no-sandbox": nil,
- "disable-smooth-scrolling": true
+ "disable-smooth-scrolling": true,
+ # Disable timers being throttled in background pages/tabs. Useful for
+ # parallel test runs.
+ "disable-background-timer-throttling": nil,
+ # Normally, Chrome will treat a 'foreground' tab instead as backgrounded
+ # if the surrounding window is occluded (aka visually covered) by another
+ # window. This flag disables that. Useful for parallel test runs.
+ "disable-backgrounding-occluded-windows": nil,
+ # This disables non-foreground tabs from getting a lower process priority.
+ # Useful for parallel test runs.
+ "disable-renderer-backgrounding": nil
}
if ENV["OPENPROJECT_TESTING_AUTO_DEVTOOLS"].present?