From 5dad33365595c9ff5b6f392249152d67992841ac Mon Sep 17 00:00:00 2001 From: Lars Henrik Mai Date: Thu, 16 Jan 2020 11:25:39 +0100 Subject: [PATCH] Replace capybara-webkit with apparition and update capybara to 3.30.0 See https://github.com/teamcapybara/capybara#apparition --- Dockerfile | 11 ++++++++--- Gemfile | 2 +- Gemfile.lock | 37 +++++++++++++++++++++---------------- bin/run-tests | 2 +- spec/support/capybara.rb | 14 +++++++++++++- 5 files changed, 44 insertions(+), 22 deletions(-) diff --git a/Dockerfile b/Dockerfile index 42aa471..d5ae949 100755 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,13 @@ FROM ruby:2.5.7 -RUN curl -sL https://deb.nodesource.com/setup_9.x | bash - && apt-get update && \ +RUN gem install bundler + +# Add google package repository for google chrome +RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ + && echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list + +RUN apt-get update && \ apt-get install -y build-essential zlib1g-dev libsqlite3-dev nodejs npm \ - libxml2-dev libxslt1-dev pkg-config \ - libqtwebkit4 libqtwebkit-dev libqt4-dev xvfb + libxml2-dev libxslt1-dev pkg-config google-chrome-stable RUN mkdir -p /app diff --git a/Gemfile b/Gemfile index e55b901..8fd436c 100644 --- a/Gemfile +++ b/Gemfile @@ -68,7 +68,7 @@ group :test do gem 'simplecov', require: false gem 'database_cleaner' gem 'coveralls', require: false - gem 'capybara-webkit' + gem 'apparition' gem 'rails-controller-testing' end diff --git a/Gemfile.lock b/Gemfile.lock index 1ff4086..0b6f194 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -38,21 +38,22 @@ GEM i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) - addressable (2.5.2) - public_suffix (>= 2.0.2, < 4.0) + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) + apparition (0.4.0) + capybara (~> 3.13, < 4) + websocket-driver (>= 0.6.5) arel (8.0.0) awesome_print (1.8.0) builder (3.2.3) - capybara (3.0.2) + capybara (3.30.0) addressable mini_mime (>= 0.1.3) nokogiri (~> 1.8) rack (>= 1.6.0) rack-test (>= 0.6.3) - xpath (~> 3.0) - capybara-webkit (1.15.0) - capybara (>= 2.3, < 4.0) - json + regexp_parser (~> 1.5) + xpath (~> 3.2) coderay (1.1.2) coffee-rails (4.2.2) coffee-script (>= 2.2.0) @@ -138,14 +139,14 @@ GEM mime-types (3.1) mime-types-data (~> 3.2015) mime-types-data (3.2016.0521) - mini_mime (1.0.0) - mini_portile2 (2.3.0) + mini_mime (1.0.2) + mini_portile2 (2.4.0) minitest (5.11.3) multi_json (1.13.1) multipart-post (2.0.0) nio4r (2.3.0) - nokogiri (1.8.2) - mini_portile2 (~> 2.3.0) + nokogiri (1.10.7) + mini_portile2 (~> 2.4.0) omniauth (1.8.1) hashie (>= 3.4.6, < 3.6.0) rack (>= 1.6.2, < 3) @@ -158,10 +159,10 @@ GEM method_source (~> 0.9.0) pry-rails (0.3.6) pry (>= 0.10.4) - public_suffix (3.0.2) + public_suffix (4.0.3) puma (3.11.4) - rack (2.0.4) - rack-test (1.0.0) + rack (2.1.1) + rack-test (1.1.0) rack (>= 1.0, < 3) rails (5.1.6) actioncable (= 5.1.6) @@ -195,6 +196,7 @@ GEM thor (>= 0.18.1, < 2.0) rake (12.3.1) rdoc (4.3.0) + regexp_parser (1.6.0) rest-client (1.6.7) mime-types (>= 1.16) rspec-core (3.7.1) @@ -270,16 +272,16 @@ GEM websocket-driver (0.6.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.3) - xpath (3.0.0) + xpath (3.2.0) nokogiri (~> 1.8) PLATFORMS ruby DEPENDENCIES + apparition awesome_print capybara - capybara-webkit coffee-rails coveralls database_cleaner @@ -316,3 +318,6 @@ DEPENDENCIES tzinfo-data uglifier validate_url + +BUNDLED WITH + 2.1.4 diff --git a/bin/run-tests b/bin/run-tests index 0e63669..818f8a0 100755 --- a/bin/run-tests +++ b/bin/run-tests @@ -1,3 +1,3 @@ #!/usr/bin/env bash -xvfb-run bundle exec rspec +bundle exec rspec diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb index 27d05a8..83c32b5 100644 --- a/spec/support/capybara.rb +++ b/spec/support/capybara.rb @@ -1 +1,13 @@ -Capybara.javascript_driver = :webkit +require 'capybara/apparition' +Capybara.register_driver :apparition do |app| + Capybara::Apparition::Driver.new( + app, + headless: true, + browser_options: [ :no_sandbox, disable_features: 'VizDisplayCompositor'] + ) +end + +Capybara.javascript_driver = :apparition + +# https://github.com/teamcapybara/capybara#setup +Capybara.server = :puma, { Silent: true }