From 8c9fbd09b4762fb730266a8460160c3d6728499d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 23 Sep 2020 08:43:36 +0000 Subject: [PATCH 1/2] Bump govuk_test from 1.0.3 to 2.0.0 Bumps [govuk_test](https://github.com/alphagov/govuk_test) from 1.0.3 to 2.0.0. - [Release notes](https://github.com/alphagov/govuk_test/releases) - [Changelog](https://github.com/alphagov/govuk_test/blob/master/CHANGELOG.md) - [Commits](https://github.com/alphagov/govuk_test/compare/v1.0.3...v2.0.0) Signed-off-by: dependabot[bot] --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index ac9660be8..1ed05bb99 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -124,7 +124,7 @@ GEM sprockets (< 4) govuk_schemas (4.1.1) json-schema (~> 2.8.0) - govuk_test (1.0.3) + govuk_test (2.0.0) brakeman (~> 4.6) capybara puma @@ -198,7 +198,7 @@ GEM coderay (~> 1.1) method_source (~> 1.0) public_suffix (4.0.6) - puma (4.3.6) + puma (5.0.2) nio4r (~> 2.0) rack (2.2.3) rack-test (1.1.0) @@ -246,7 +246,7 @@ GEM rb-fsevent (0.10.4) rb-inotify (0.10.1) ffi (~> 1.0) - regexp_parser (1.7.1) + regexp_parser (1.8.0) request_store (1.5.0) rack (>= 1.4) rest-client (2.1.0) From b5cf49a2f2861230cf9d8589b55bc1458bc71b81 Mon Sep 17 00:00:00 2001 From: Kevin Dew Date: Fri, 25 Sep 2020 19:19:05 +0100 Subject: [PATCH 2/2] Use GovukTest to provide headless chrome selenium options This changes the configuration mechanism for Jasmine selenium runner to use the approach advised in the gem (as per: https://github.com/alphagov/content-publisher/pull/2110) and also uses GovukTest as a means to share the headless chrome configuration. --- Gemfile | 4 ++-- spec/javascripts/support/jasmine_helper.rb | 17 +++++------------ .../support/jasmine_selenium_runner.yml | 2 ++ 3 files changed, 9 insertions(+), 14 deletions(-) create mode 100644 spec/javascripts/support/jasmine_selenium_runner.yml diff --git a/Gemfile b/Gemfile index 0f15ad8c2..93e35584f 100644 --- a/Gemfile +++ b/Gemfile @@ -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 @@ -35,7 +36,6 @@ end group :test do gem "capybara" gem "faker" - gem "govuk_test" gem "minitest-reporters" gem "mocha" gem "webdrivers" diff --git a/spec/javascripts/support/jasmine_helper.rb b/spec/javascripts/support/jasmine_helper.rb index 6892c6f60..467694c89 100644 --- a/spec/javascripts/support/jasmine_helper.rb +++ b/spec/javascripts/support/jasmine_helper.rb @@ -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 diff --git a/spec/javascripts/support/jasmine_selenium_runner.yml b/spec/javascripts/support/jasmine_selenium_runner.yml new file mode 100644 index 000000000..b947652da --- /dev/null +++ b/spec/javascripts/support/jasmine_selenium_runner.yml @@ -0,0 +1,2 @@ +browser: chrome +configuration_class: HeadlessChromeJasmineConfigurer