Browse Source

now we can have an hmtl screenshot

cucumber-rails
JG 3 years ago
parent
commit
afe4bf562b
  1. 2
      Gemfile
  2. 16
      Gemfile.lock
  3. 26
      features/support/env.rb

2
Gemfile

@ -87,8 +87,10 @@ end
group :test do
gem "capybara", require: false
gem "capybara-screenshot"
gem "capybara-lockstep"
gem "cucumber-rails", require: false
gem "cuprite"
gem "database_cleaner"
gem "factory_bot_rails"
gem "rspec-rails", require: false

16
Gemfile.lock

@ -151,8 +151,12 @@ GEM
capybara (>= 2.0)
ruby2_keywords
selenium-webdriver (>= 3)
capybara-screenshot (1.0.26)
capybara (>= 1.0, < 4)
launchy
chartkick (4.1.3)
childprocess (4.1.0)
cliver (0.3.2)
coderay (1.1.3)
concurrent-ruby (1.1.10)
crack (0.4.5)
@ -196,6 +200,9 @@ GEM
cucumber-wire (6.2.1)
cucumber-core (~> 10.1, >= 10.1.0)
cucumber-cucumber-expressions (~> 14.0, >= 14.0.0)
cuprite (0.13)
capybara (>= 2.1, < 4)
ferrum (~> 0.11.0)
database_cleaner (2.0.1)
database_cleaner-active_record (~> 2.0.0)
database_cleaner-active_record (2.0.1)
@ -226,6 +233,11 @@ GEM
factory_bot_rails (6.2.0)
factory_bot (~> 6.2.0)
railties (>= 5.0.0)
ferrum (0.11)
addressable (~> 2.5)
cliver (~> 0.3)
concurrent-ruby (~> 1.1)
websocket-driver (>= 0.6, < 0.8)
ffi (1.15.5)
formtastic (4.0.0)
actionpack (>= 5.2.0)
@ -279,6 +291,8 @@ GEM
activerecord
kaminari-core (= 1.2.2)
kaminari-core (1.2.2)
launchy (2.5.0)
addressable (~> 2.7)
listen (3.7.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
@ -526,8 +540,10 @@ DEPENDENCIES
byebug
capybara
capybara-lockstep
capybara-screenshot
chartkick
cucumber-rails
cuprite
database_cleaner
devise!
dotenv-rails

26
features/support/env.rb

@ -1,21 +1,31 @@
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
# It is recommended to regenerate this file in the future when you upgrade to a
# 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.
require 'cucumber/rails'
require "capybara-screenshot/cucumber"
require "capybara/cuprite"
ActionController::Base.allow_rescue = false
# Remove/comment out the lines below if your app doesn't have a database.
# For some databases (like MongoDB and CouchDB) you may need to use :truncation instead.
begin
DatabaseCleaner.strategy = :transaction
rescue NameError
raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
end
Cucumber::Rails::Database.javascript_strategy = :truncation
Capybara.register_driver :cuprite do |app|
Capybara::Cuprite::Driver.new(app, headless: true,
js_errors: true,
window_size: [1600, 1200],
timeout: 30,
process_timeout: 60)
end
Capybara.javascript_driver = :cuprite
Capybara::Screenshot.register_driver(:cuprite) do |driver, path|
driver.render(path, full: true)
end
Cucumber::Rails::Database.javascript_strategy = :truncation
World(FactoryBot::Syntax::Methods)

Loading…
Cancel
Save