From dccf4e34ff6d092eddc76dba222c14ddfcf8091e Mon Sep 17 00:00:00 2001 From: zmagod Date: Thu, 12 Oct 2017 13:50:48 +0200 Subject: [PATCH] fix cucumber settings --- .babelrc | 2 +- Dockerfile | 2 ++ Gemfile | 7 +++-- Gemfile.lock | 39 ++++++++++++++------------ app/javascript/packs/index.jsx | 2 ++ features/support/env.rb | 51 +++++++++++++++++++++++++--------- lib/tasks/cucumber.rake | 2 +- package.json | 2 +- yarn.lock | 4 +++ 9 files changed, 74 insertions(+), 37 deletions(-) diff --git a/.babelrc b/.babelrc index 44f0cbcce..18363269c 100644 --- a/.babelrc +++ b/.babelrc @@ -5,7 +5,7 @@ { "modules": false, "targets": { - "browsers": ["last 2 versions"], + "browsers": ["last 2 versions", "ie 10"], "uglify": true }, "useBuiltIns": true diff --git a/Dockerfile b/Dockerfile index b8e82a06b..1ae354626 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,8 @@ RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - && \ apt-get update -qq && \ apt-get install -y \ nodejs \ + qt5-default libqt5webkit5-dev gstreamer1.0-plugins-base gstreamer1.0-tools gstreamer1.0-x \ + xvfb \ postgresql-client \ default-jre-headless \ unison \ diff --git a/Gemfile b/Gemfile index 9fa139fa9..d2605325a 100644 --- a/Gemfile +++ b/Gemfile @@ -103,11 +103,12 @@ end group :test do gem 'shoulda-matchers' - gem 'cucumber-rails', require: false + gem 'cucumber-rails', '~> 1.5' gem 'database_cleaner' gem 'capybara' - gem 'poltergeist' - gem 'phantomjs', :require => 'phantomjs/poltergeist' + gem 'headless' + gem 'capybara-webkit', '~> 1.14' + gem 'selenium-webdriver' gem 'simplecov', require: false end diff --git a/Gemfile.lock b/Gemfile.lock index 322b083bd..de910acd1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -80,8 +80,8 @@ GEM i18n (~> 0.7) minitest (~> 5.1) tzinfo (~> 1.1) - addressable (2.5.1) - public_suffix (~> 2.0, >= 2.0.2) + addressable (2.5.2) + public_suffix (>= 2.0.2, < 4.0) ajax-datatables-rails (0.3.1) railties (>= 3.1) arel (8.0.0) @@ -126,15 +126,19 @@ GEM activesupport (>= 3.0.0) uniform_notifier (~> 1.10.0) byebug (9.0.6) - capybara (2.15.1) + capybara (2.13.0) addressable - mini_mime (>= 0.1.3) + mime-types (>= 1.16) nokogiri (>= 1.3.3) rack (>= 1.0.0) rack-test (>= 0.5.4) xpath (~> 2.0) + capybara-webkit (1.14.0) + capybara (>= 2.3.0, < 2.14.0) + json + childprocess (0.8.0) + ffi (~> 1.0, >= 1.0.11) climate_control (0.2.0) - cliver (0.3.2) cocaine (0.5.8) climate_control (>= 0.0.3, < 1.0) coderay (1.1.1) @@ -206,6 +210,7 @@ GEM globalid (0.4.0) activesupport (>= 4.2.0) hammerjs-rails (2.0.4) + headless (2.3.1) i18n (0.8.6) i18n-js (3.0.1) i18n (~> 0.6, >= 0.6.6) @@ -256,8 +261,7 @@ GEM method_source (0.8.2) mime-types (1.25.1) mimemagic (0.3.2) - mini_mime (0.1.3) - mini_portile2 (2.2.0) + mini_portile2 (2.3.0) minitest (5.10.3) momentjs-rails (2.17.1) railties (>= 3.1) @@ -269,8 +273,8 @@ GEM rails (>= 3.2.0) newrelic_rpm (4.3.0.335) nio4r (2.1.0) - nokogiri (1.8.0) - mini_portile2 (~> 2.2.0) + nokogiri (1.8.1) + mini_portile2 (~> 2.3.0) nokogumbo (1.4.13) nokogiri oj (2.18.5) @@ -285,11 +289,6 @@ GEM parser (2.4.0.0) ast (~> 2.2) pg (0.21.0) - phantomjs (2.1.1.0) - poltergeist (1.15.0) - capybara (~> 2.1) - cliver (~> 0.3.1) - websocket-driver (>= 0.2.0) polyglot (0.3.5) powerpack (0.1.1) pry (0.10.4) @@ -301,7 +300,7 @@ GEM pry (~> 0.10) pry-rails (0.3.6) pry (>= 0.10.4) - public_suffix (2.0.5) + public_suffix (3.0.0) puma (3.9.1) rack (2.0.3) rack-test (0.6.3) @@ -405,6 +404,9 @@ GEM sdoc (0.4.2) json (~> 1.7, >= 1.7.7) rdoc (~> 4.0) + selenium-webdriver (3.6.0) + childprocess (~> 0.5) + rubyzip (~> 1.0) shoulda-matchers (3.1.2) activesupport (>= 4.0.0) silencer (1.0.1) @@ -490,8 +492,9 @@ DEPENDENCIES bullet byebug capybara + capybara-webkit (~> 1.14) commit_param_routing - cucumber-rails + cucumber-rails (~> 1.5) database_cleaner deface (~> 1.0) delayed_job_active_record @@ -505,6 +508,7 @@ DEPENDENCIES figaro font-awesome-rails (~> 4.7.0.2) hammerjs-rails + headless i18n-js (>= 3.0.0.rc11) introjs-rails jbuilder @@ -522,8 +526,6 @@ DEPENDENCIES nokogiri paperclip (~> 5.1) pg - phantomjs - poltergeist pry pry-byebug pry-rails @@ -544,6 +546,7 @@ DEPENDENCIES sass-rails (~> 5.0.6) scss_lint sdoc (~> 0.4.0) + selenium-webdriver shoulda-matchers silencer simple_token_authentication (~> 1.15.1) diff --git a/app/javascript/packs/index.jsx b/app/javascript/packs/index.jsx index 0950d87b6..7f94d83c5 100644 --- a/app/javascript/packs/index.jsx +++ b/app/javascript/packs/index.jsx @@ -1,3 +1,5 @@ +import "intl"; +import "intl/locale-data/jsonp/en-US.js" import React from "react"; import ReactDOM from "react-dom"; import App from "../src/"; diff --git a/features/support/env.rb b/features/support/env.rb index 9c8d611ba..999da7c0f 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -5,24 +5,49 @@ # files. require 'cucumber/rails' -require 'phantomjs' -require 'capybara/poltergeist' +require 'capybara/cucumber' +require 'capybara-webkit' require 'simplecov' +require 'headless' +require 'selenium-webdriver' -Capybara.register_driver :poltergeist do |app| - Capybara::Poltergeist::Driver.new( - app, - js_errors: true, - phantomjs_options: ['--ignore-ssl-errors=yes', '--ssl-protocol=any'], - debug: true, - timeout: 500, - phantomjs: File.absolute_path(Phantomjs.path) - ) + +Capybara.default_driver = :selenium +if Capybara.current_driver == :selenium + require 'headless' + + headless = Headless.new + headless.start end -Capybara.javascript_driver = :poltergeist +Capybara::Webkit.configure do |config| + # Enable debug mode. Prints a log of everything the driver is doing. + config.debug = true -Capybara.server_port = 3001 + # By default, requests to outside domains (anything besides localhost) will + # result in a warning. Several methods allow you to change this behavior. + + # Silently return an empty 200 response for any requests to unknown URLs. + config.block_unknown_urls + + # Allow pages to make requests to any URL without issuing a warning. + config.allow_unknown_urls + + # Timeout if requests take longer than 5 seconds + config.timeout = 15 + + # Don't raise errors when SSL certificates can't be validated + config.ignore_ssl_errors + + # Raise JavaScript errors as exceptions + config.raise_javascript_errors = true +end + +Capybara.javascript_driver = :webkit + +Before do + `bundle exec rails webpacker:compile` +end # Capybara defaults to CSS3 selectors rather than XPath. # If you'd prefer to use XPath, just uncomment this line and adjust any diff --git a/lib/tasks/cucumber.rake b/lib/tasks/cucumber.rake index 4f49402f2..60b38b2df 100644 --- a/lib/tasks/cucumber.rake +++ b/lib/tasks/cucumber.rake @@ -3,7 +3,7 @@ # newer version of cucumber-rails. Consider adding your own code to a new file # instead of editing this one. Cucumber will automatically load all features/**/*.rb # files. - +ENV["RAILS_ENV"] ||= 'test' # Don't load anything when running the gems:* tasks unless ARGV.any? { |a| a =~ /^gems/ } diff --git a/package.json b/package.json index 75a074613..536ae64b5 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,6 @@ "babel-plugin-syntax-dynamic-import": "^6.18.0", "babel-plugin-transform-class-properties": "^6.24.1", "babel-plugin-transform-object-rest-spread": "^6.23.0", - "babel-polyfill": "^6.23.0", "babel-preset-env": "^1.6.0", "babel-preset-es2015": "^6.24.1", "babel-preset-react": "^6.24.1", @@ -57,6 +56,7 @@ "font-awesome": "^4.7.0", "glob": "^7.1.2", "immutability-helper": "^2.3.0", + "intl": "^1.2.5", "js-yaml": "^3.9.0", "lodash": "^4.17.4", "moment": "^2.18.1", diff --git a/yarn.lock b/yarn.lock index 3a3030b74..5734fb723 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3084,6 +3084,10 @@ intl-relativeformat@^2.0.0: dependencies: intl-messageformat "^2.0.0" +intl@^1.2.5: + version "1.2.5" + resolved "https://registry.yarnpkg.com/intl/-/intl-1.2.5.tgz#82244a2190c4e419f8371f5aa34daa3420e2abde" + invariant@^2.0.0, invariant@^2.1.0, invariant@^2.1.1, invariant@^2.2.0, invariant@^2.2.1, invariant@^2.2.2: version "2.2.2" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.2.tgz#9e1f56ac0acdb6bf303306f338be3b204ae60360"