Skip to content

Commit

Permalink
Use GovukTest to provide headless chrome selenium options
Browse files Browse the repository at this point in the history
This changes the configuration mechanism for Jasmine selenium runner to
use the approach advised in the gem (as per:
alphagov/content-publisher#2110) and also uses
GovukTest as a means to share the headless chrome configuration.
  • Loading branch information
kevindew committed Sep 29, 2020
1 parent 8c9fbd0 commit b5cf49a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ gem "uglifier"

group :development, :test do
gem "govuk_schemas"
gem "govuk_test"
gem "jasmine"
gem "jasmine_selenium_runner", require: false
gem "jasmine_selenium_runner"
gem "rubocop-govuk"
gem "scss_lint-govuk", require: false
end
Expand All @@ -35,7 +36,6 @@ end
group :test do
gem "capybara"
gem "faker"
gem "govuk_test"
gem "minitest-reporters"
gem "mocha"
gem "webdrivers"
Expand Down
17 changes: 5 additions & 12 deletions spec/javascripts/support/jasmine_helper.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
require "jasmine/runners/selenium"
require "webdrivers/chromedriver"
require "jasmine_selenium_runner/configure_jasmine"

Jasmine.configure do |config|
config.prevent_phantom_js_auto_install = true

config.runner = lambda { |formatter, jasmine_server_url|
options = Selenium::WebDriver::Chrome::Options.new
options.headless!

webdriver = Selenium::WebDriver.for(:chrome, options: options)
Jasmine::Runners::Selenium.new(formatter, jasmine_server_url, webdriver, 50)
}
class HeadlessChromeJasmineConfigurer < JasmineSeleniumRunner::ConfigureJasmine
def selenium_options
{ options: GovukTest.headless_chrome_selenium_options }
end
end
2 changes: 2 additions & 0 deletions spec/javascripts/support/jasmine_selenium_runner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
browser: chrome
configuration_class: HeadlessChromeJasmineConfigurer

0 comments on commit b5cf49a

Please sign in to comment.