Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ end

group :development, :test do
gem "rspec-rails", '~> 3.5.2'
gem "capybara", '~> 2.4.4'
gem "byebug"
end

Expand All @@ -71,6 +70,8 @@ group :test do

gem 'shoulda', ">= 3.5"
gem 'fabrication'
gem "capybara", '~> 2.4.4'
gem 'capybara-selenium'
gem 'faker'
end

Expand Down
11 changes: 11 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ GEM
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
capybara-selenium (0.0.6)
capybara
selenium-webdriver
childprocess (0.8.0)
ffi (~> 1.0, >= 1.0.11)
chronic (0.10.2)
coderay (1.1.0)
coffee-rails (4.1.0)
Expand Down Expand Up @@ -152,6 +157,7 @@ GEM
i18n (~> 0.5)
faraday (0.9.1)
multipart-post (>= 1.2, < 3)
ffi (1.9.23)
foreman (0.77.0)
dotenv (~> 1.0.2)
thor (~> 0.19.1)
Expand Down Expand Up @@ -312,6 +318,7 @@ GEM
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.4)
ruby-progressbar (1.7.1)
rubyzip (1.2.1)
sass (3.4.21)
sass-rails (5.0.4)
railties (>= 4.0.0, < 5.0)
Expand All @@ -321,6 +328,9 @@ GEM
tilt (>= 1.1, < 3)
select2-rails (4.0.1)
thor (~> 0.14)
selenium-webdriver (3.9.0)
childprocess (~> 0.5)
rubyzip (~> 1.2)
shoulda (3.5.0)
shoulda-context (~> 1.0, >= 1.0.1)
shoulda-matchers (>= 1.4.1, < 3.0)
Expand Down Expand Up @@ -389,6 +399,7 @@ DEPENDENCIES
capistrano-rails (~> 1.1)
capistrano-rbenv (~> 2.1)
capybara (~> 2.4.4)
capybara-selenium
coffee-rails
dalli
database_cleaner (= 1.3.0)
Expand Down
8 changes: 8 additions & 0 deletions spec/features/hello_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require 'spec_helper'

feature "hello capybara" do
scenario "works" do
visit("/")
expect(page).to have_xpath('/html/body/nav/div/div/div/div[2]/div/ul/li[1]')
end
end
13 changes: 13 additions & 0 deletions spec/features/login_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require 'spec_helper'

feature "login" do
scenario "valid credentials are provided" do
visit("/")
#click_button 'Login'

#fill_in 'E-mail', 'admin@timeoverflow.org'
#fill_in 'Password', '1234test'
page.save_screenshot("wat.png")
end
end

19 changes: 19 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
require 'rspec/rails'
require 'rspec/autorun'
require 'capybara/rails'
require 'capybara/rspec'
require 'database_cleaner'
require 'fabrication'
require 'faker'
require 'selenium/webdriver'
I18n.reload!

# Requires supporting ruby files with custom matchers and macros, etc,
Expand Down Expand Up @@ -91,3 +93,20 @@ def set_browser_locale(locale)
end

RSpec.configure(&:infer_spec_type_from_file_location!)

Capybara.register_driver :chrome do |app|
Capybara::Selenium::Driver.new(app, browser: :chrome)
end

Capybara.register_driver :headless_chrome do |app|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
chromeOptions: { args: %w(headless disable-gpu) }
)

Capybara::Selenium::Driver.new app,
browser: :chrome,
desired_capabilities: capabilities
end

Capybara.javascript_driver = :headless_chrome
Capybara.default_driver = :headless_chrome