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 cuprite the default

Oliver Günther61fa6a4e7020
diff --git a/spec/support/authentication_helpers.rb b/spec/support/authentication_helpers.rb
index 4921b349819..03336bdf909 100644
--- a/spec/support/authentication_helpers.rb
+++ b/spec/support/authentication_helpers.rb
@@ -86,10 +86,6 @@ module AuthenticationHelpers
RSpec.current_example.metadata[:js]
end
- def using_cuprite?
- RSpec.current_example.metadata[:with_cuprite]
- end
-
def session_value_for(user)
{ user_id: user.id, updated_at: Time.current }
end
diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb
index 52ffefe902d..1d3408469eb 100644
--- a/spec/support/capybara.rb
+++ b/spec/support/capybara.rb
@@ -33,7 +33,6 @@ end
RSpec.configure do |config|
Capybara.default_max_wait_time = 4
- Capybara.javascript_driver = :chrome_en
port = ENV.fetch("CAPYBARA_SERVER_PORT", ParallelHelper.port_for_app).to_i
if port > 0
diff --git a/spec/support/cuprite_setup.rb b/spec/support/cuprite_setup.rb
index 62bdcf0dae0..54614c5a5c1 100644
--- a/spec/support/cuprite_setup.rb
+++ b/spec/support/cuprite_setup.rb
@@ -113,16 +113,20 @@ MODULES_WITH_CUPRITE_ENABLED = %w[
].freeze
RSpec.configure do |config|
- config.define_derived_metadata(file_path: %r{/(#{MODULES_WITH_CUPRITE_ENABLED.join('|')})/spec/features/}) do |meta|
- if meta[:js] && !meta.key?(:with_cuprite)
- meta[:with_cuprite] = true
- end
- end
+ config.around(:each, :js, type: :feature) do |example|
+ # Skip if driver is explicitly requested
+ next if example.metadata[:driver]
- config.around(:each, :with_cuprite, type: :feature) do |example|
original_driver = Capybara.javascript_driver
+
begin
- Capybara.javascript_driver = :better_cuprite_en
+ Capybara.javascript_driver =
+ if example.metadata[:selenium]
+ :chrome_en
+ else
+ :better_cuprite_en
+ end
+
example.run
ensure
Capybara.javascript_driver = original_driver