Verified Commit 39ac6cd4 authored by Sean McGivern's avatar Sean McGivern 🎭

Take screenshots of failed Capybara specs

parent 955d3d1e
......@@ -83,6 +83,11 @@ rubocop:
stage: build
script:
- bundle exec rspec
artifacts:
expire_in: 7 days
paths:
- tmp/capybara
when: on_failure
tags:
- gitlab-org
......
......@@ -43,5 +43,6 @@ group :development, :test do
gem 'rspec', '~> 3.5', require: false
gem 'rubocop', '~> 0.59.0', require: false
gem 'capybara'
gem 'capybara-screenshot'
gem 'selenium-webdriver'
end
......@@ -21,6 +21,9 @@ GEM
rack-test (>= 0.6.3)
regexp_parser (~> 1.2)
xpath (~> 3.2)
capybara-screenshot (1.0.22)
capybara (>= 1.0, < 4)
launchy
childprocess (0.9.0)
ffi (~> 1.0, >= 1.0.11)
coffee-script (2.4.1)
......@@ -85,6 +88,8 @@ GEM
i18n_data (0.8.0)
jaro_winkler (1.5.1)
kramdown (1.17.0)
launchy (2.4.3)
addressable (~> 2.3)
libv8 (6.7.288.46.1)
listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4)
......@@ -236,6 +241,7 @@ PLATFORMS
DEPENDENCIES
builder (~> 3.0)
capybara
capybara-screenshot
countries
docopt
faraday (>= 0.15.0)
......
......@@ -19,12 +19,16 @@ RSpec.configure do |config|
# Really slow, only do it once, and only when needed
config.before(:all, type: :feature) do
root = File.expand_path(File.join(File.dirname(__FILE__), ".."))
Middleman::Logger.singleton(Logger::WARN, false)
Capybara.app = Middleman::Rack.new(Middleman::Application.new).to_app do
set :root, File.expand_path(File.join(File.dirname(__FILE__), ".."))
set :root, root
set :environment, :test
end
Capybara.save_path = "tmp/capybara"
Capybara::Screenshot.instance_variable_set(:@capybara_root, File.expand_path(Capybara.save_path, root))
end
config.expect_with :rspec do |expectations|
......
require 'capybara'
require 'capybara/rspec'
require 'capybara-screenshot/rspec'
require 'selenium-webdriver'
# Taken from gitlab-ce
......@@ -38,5 +39,9 @@ Capybara.register_driver :chrome do |app|
)
end
Capybara::Screenshot.register_driver(:chrome) do |driver, path|
driver.browser.save_screenshot(path)
end
Capybara.javascript_driver = :chrome
Capybara.server = :webrick
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment