1
0
Fork 0

Use Selenium WebDriver instead of Capybara WebKit

This commit is contained in:
Alex Kotov 2018-12-13 04:56:14 +05:00
parent 66944ce99e
commit 4c81dceec9
No known key found for this signature in database
GPG key ID: 4E831250F47DE154
6 changed files with 24 additions and 14 deletions

View file

@ -32,7 +32,10 @@ env:
- RAILS_CACHE_REDIS_PASSWORD=
before_install:
- sudo apt install qt4-qmake libqt4-dev libqtwebkit-dev xvfb
- wget https://github.com/mozilla/geckodriver/releases/download/v0.23.0/geckodriver-v0.23.0-linux64.tar.gz
- sudo tar -xvzf geckodriver*
- sudo chmod +x geckodriver
- sudo mv geckodriver /usr/local/bin/
install:
- bundle install --jobs=3 --retry=3
@ -41,7 +44,7 @@ install:
before_script:
- psql -U postgres -c "CREATE DATABASE partynest_test;"
script: xvfb-run -a bundle exec rake
script: bundle exec rake
after_script:
- bundle exec rake coveralls:push

View file

@ -200,6 +200,8 @@ group :test do
# and HTML file of the current page.
gem 'capybara-screenshot', '~> 1.0'
# Headless Webkit driver for Capybara.
gem 'capybara-webkit', '~> 1.15'
# WebDriver is a tool for writing automated tests of websites.
# It aims to mimic the behaviour of a real user,
# and as such interacts with the HTML of the application.
gem 'selenium-webdriver', '~> 3.14'
end

View file

@ -96,9 +96,8 @@ GEM
capybara-screenshot (1.0.22)
capybara (>= 1.0, < 4)
launchy
capybara-webkit (1.15.1)
capybara (>= 2.3, < 4.0)
json
childprocess (0.9.0)
ffi (~> 1.0, >= 1.0.11)
choice (0.2.0)
coderay (1.1.2)
coercible (1.0.0)
@ -333,6 +332,7 @@ GEM
ruby-graphviz (1.2.4)
ruby-progressbar (1.10.0)
ruby_dep (1.5.0)
rubyzip (1.2.2)
sass (3.7.2)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
@ -347,6 +347,9 @@ GEM
sassc (2.0.0)
ffi (~> 1.9.6)
rake
selenium-webdriver (3.141.0)
childprocess (~> 0.5)
rubyzip (~> 1.2, >= 1.2.2)
sentry-raven (2.7.4)
faraday (>= 0.7.6, < 1.0)
shoulda-matchers (4.0.0.rc1)
@ -437,7 +440,6 @@ DEPENDENCIES
capistrano-rails (~> 1.4)
capistrano-rails-console (~> 2.3)
capybara-screenshot (~> 1.0)
capybara-webkit (~> 1.15)
coveralls
cucumber-rails (~> 1.6)
database_cleaner (~> 1.7)
@ -467,6 +469,7 @@ DEPENDENCIES
rspec-rails (~> 3.8)
rubocop (~> 0.60.0)
sass-rails (~> 5.0)
selenium-webdriver (~> 3.14)
sentry-raven
shoulda-matchers (= 4.0.0.rc1)
sidekiq (~> 5.2)

View file

@ -4,10 +4,12 @@ When 'I try to sign in with email {string} ' \
'and password {string}' do |email, password|
visit '/users/sign_in'
fill_in 'Email', with: email
fill_in 'Пароль', with: password
within 'form' do
fill_in 'Email', with: email
fill_in 'Пароль', with: password
click_on 'Войти'
click_on 'Войти'
end
end
Then 'I am signed in as {string}' do |email|

View file

@ -61,7 +61,7 @@ When 'I fill the passport creation form' do
fill_in 'Кем выдан', with: @passport_attributes['Кем выдан']
fill_in 'Код подразделения', with: @passport_attributes['Код подразделения']
attach_file 'Изображения', 'fixtures/passport_image_1.jpg'
attach_file 'Изображения', Rails.root.join('fixtures', 'passport_image_1.jpg')
end
When 'I click the passport creation button' do

View file

@ -13,8 +13,8 @@ require 'simplecov'
require 'cucumber/rails'
require 'capybara-screenshot/cucumber'
Capybara.default_driver = :webkit
Capybara.javascript_driver = :webkit
Capybara.default_driver = :selenium_headless
Capybara.javascript_driver = :selenium_headless
# Capybara defaults to CSS3 selectors rather than XPath.
# If you'd prefer to use XPath, just uncomment this line and adjust any