diff --git a/.travis.yml b/.travis.yml index 4e11ab8..0dfb6fa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/Gemfile b/Gemfile index cab3a4d..9b4f4a7 100644 --- a/Gemfile +++ b/Gemfile @@ -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 diff --git a/Gemfile.lock b/Gemfile.lock index e023e54..3e89d51 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) diff --git a/features/step_definitions/sign_in.rb b/features/step_definitions/sign_in.rb index 50b39c1..263a36f 100644 --- a/features/step_definitions/sign_in.rb +++ b/features/step_definitions/sign_in.rb @@ -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| diff --git a/features/step_definitions/stepdefs.rb b/features/step_definitions/stepdefs.rb index 1a3b6f1..ab96e80 100644 --- a/features/step_definitions/stepdefs.rb +++ b/features/step_definitions/stepdefs.rb @@ -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 diff --git a/features/support/env.rb b/features/support/env.rb index 17c2747..7c5fee1 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -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