From b0116c46b58a9db5fa6fecc577a10c9ba09e5702 Mon Sep 17 00:00:00 2001 From: Joonas Date: Fri, 29 Dec 2023 10:55:51 +0200 Subject: [PATCH] Change registration --- lib/decidim/iframe/engine.rb | 17 -------------- .../iframe/test/rspec_support/capybara.rb | 22 +++++++++++++++++++ 2 files changed, 22 insertions(+), 17 deletions(-) create mode 100644 lib/decidim/iframe/test/rspec_support/capybara.rb diff --git a/lib/decidim/iframe/engine.rb b/lib/decidim/iframe/engine.rb index 8c4e06f..2a9490e 100644 --- a/lib/decidim/iframe/engine.rb +++ b/lib/decidim/iframe/engine.rb @@ -31,23 +31,6 @@ class Engine < ::Rails::Engine end end - Capybara.register_driver :headless_chrome do |app| - options = ::Selenium::WebDriver::Chrome::Options.new - options.args << "--headless=new" - options.args << "--no-sandbox" - options.args << if ENV["BIG_SCREEN_SIZE"].present? - "--window-size=1920,3000" - else - "--window-size=1920,1080" - end - options.args << "--ignore-certificate-errors" if ENV["TEST_SSL"] - Capybara::Selenium::Driver.new( - app, - browser: :chrome, - capabilities: [options] - ) - end - def load_seed nil end diff --git a/lib/decidim/iframe/test/rspec_support/capybara.rb b/lib/decidim/iframe/test/rspec_support/capybara.rb new file mode 100644 index 0000000..a6a2e03 --- /dev/null +++ b/lib/decidim/iframe/test/rspec_support/capybara.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +require "selenium-webdriver" + +module Decidim + Capybara.register_driver :headless_chrome do |app| + options = ::Selenium::WebDriver::Chrome::Options.new + options.args << "--headless=new" + options.args << "--no-sandbox" + options.args << if ENV["BIG_SCREEN_SIZE"].present? + "--window-size=1920,3000" + else + "--window-size=1920,1080" + end + options.args << "--ignore-certificate-errors" if ENV["TEST_SSL"] + Capybara::Selenium::Driver.new( + app, + browser: :chrome, + capabilities: [options] + ) + end +end