Merge branch 'dev'

This commit is contained in:
gregoirenovel 2018-01-16 16:40:54 +01:00
commit cbec7bcdb3
17 changed files with 81 additions and 87 deletions

View file

@ -1,68 +1,43 @@
version: 2 version: 2
defaults: &defaults defaults: &defaults
working_directory: /tps working_directory: ~/tps
docker: docker:
- image: ruby:2.3.5 - image: circleci/ruby:2.3.6-node-browsers
- image: postgres:9.4.1 - image: circleci/postgres:9.5
environment: environment:
POSTGRES_USER: tps_test POSTGRES_USER: tps_test
POSTGRES_PASSWORD: tps_test POSTGRES_PASSWORD: tps_test
POSTGRES_DB: tps_test POSTGRES_DB: tps_test
install_system_deps: &install_system_deps
run:
name: Install System Dependencies
command: apt-get update -qq && apt-get install -y build-essential nodejs
restore_phantomjs_cache: &restore_phantomjs_cache
restore_cache:
key: phantomjs-2-1-1
bundle_restore_cache: &bundle_restore_cache bundle_restore_cache: &bundle_restore_cache
restore_cache: restore_cache:
key: bundle-install-v4-{{ arch }}-{{ checksum "Gemfile.lock" }} key: bundle-install-v7-{{ arch }}-{{ checksum "Gemfile.lock" }}
bundle_save_cache: &bundle_save_cache
save_cache:
key: bundle-install-v7-{{ arch }}-{{ checksum "Gemfile.lock" }}
paths:
- ~/vendor/bundle
bundle_install: &bundle_install bundle_install: &bundle_install
run: run:
name: Install Ruby Dependencies name: Install Ruby Dependencies
command: bundle install command: bundle install --path ~/vendor/bundle
jobs: jobs:
build: build:
<<: *defaults <<: *defaults
steps: steps:
- checkout - checkout
- *install_system_deps
- *bundle_restore_cache - *bundle_restore_cache
- *bundle_install - *bundle_install
- save_cache: - *bundle_save_cache
key: bundle-install-v4-{{ arch }}-{{ checksum "Gemfile.lock" }}
paths:
- /usr/local/bundle
- *restore_phantomjs_cache
- run:
name: Install PhantomJS Dependencies
command: |
[ -f /usr/local/bin/phantomjs ] || apt-get update
[ -f /usr/local/bin/phantomjs ] || apt-get install -y fontconfig wget
- run:
name: Install PhantomJS
command: |
[ -f /usr/local/bin/phantomjs ] || wget -O /tmp/phantomjs.tar.bz2 https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
[ -f /usr/local/bin/phantomjs ] || tar -xjf /tmp/phantomjs.tar.bz2 -C /tmp
[ -f /usr/local/bin/phantomjs ] || mv /tmp/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs
- save_cache:
key: phantomjs-2-1-1
paths:
- /usr/local/bin/phantomjs
test: test:
<<: *defaults <<: *defaults
parallelism: 4 parallelism: 4
steps: steps:
- checkout - checkout
- *install_system_deps
- *restore_phantomjs_cache
- *bundle_restore_cache - *bundle_restore_cache
- *bundle_install - *bundle_install
- run: - run:
@ -77,16 +52,15 @@ jobs:
command: | command: |
bundle exec rspec --profile 10 \ bundle exec rspec --profile 10 \
--format RspecJunitFormatter \ --format RspecJunitFormatter \
--out $CIRCLE_TEST_REPORTS/rspec.xml \ --out ~/test_results/rspec.xml \
--format progress \ --format progress \
$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings) $(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)
- store_test_results: - store_test_results:
path: $CIRCLE_TEST_REPORTS/rspec.xml path: ~/test_results/rspec.xml
lint: lint:
<<: *defaults <<: *defaults
steps: steps:
- checkout - checkout
- *install_system_deps
- *bundle_restore_cache - *bundle_restore_cache
- *bundle_install - *bundle_install
- run: - run:
@ -105,7 +79,6 @@ jobs:
<<: *defaults <<: *defaults
steps: steps:
- checkout - checkout
- *install_system_deps
- *bundle_restore_cache - *bundle_restore_cache
- *bundle_install - *bundle_install
- add_ssh_keys: - add_ssh_keys:

View file

@ -1 +1 @@
2.3.5 2.3.6

View file

@ -94,6 +94,8 @@ gem 'skylight'
gem 'scenic' gem 'scenic'
gem 'sanitize-url'
# Cron jobs # Cron jobs
gem 'delayed_job_active_record' gem 'delayed_job_active_record'
gem "daemons" gem "daemons"
@ -120,7 +122,7 @@ group :test do
gem 'database_cleaner' gem 'database_cleaner'
gem 'webmock' gem 'webmock'
gem 'shoulda-matchers', require: false gem 'shoulda-matchers', require: false
gem 'poltergeist' gem 'capybara-selenium'
gem 'timecop' gem 'timecop'
gem 'guard' gem 'guard'
gem 'guard-rspec', require: false gem 'guard-rspec', require: false

View file

@ -105,6 +105,9 @@ GEM
rack (>= 1.0.0) rack (>= 1.0.0)
rack-test (>= 0.5.4) rack-test (>= 0.5.4)
xpath (~> 2.0) xpath (~> 2.0)
capybara-selenium (0.0.6)
capybara
selenium-webdriver
carrierwave (0.11.2) carrierwave (0.11.2)
activemodel (>= 3.2.0) activemodel (>= 3.2.0)
activesupport (>= 3.2.0) activesupport (>= 3.2.0)
@ -113,9 +116,10 @@ GEM
mimemagic (>= 0.3.0) mimemagic (>= 0.3.0)
carrierwave-i18n (0.2.0) carrierwave-i18n (0.2.0)
chartkick (2.2.1) chartkick (2.2.1)
childprocess (0.8.0)
ffi (~> 1.0, >= 1.0.11)
chunky_png (1.3.8) chunky_png (1.3.8)
clamav-client (3.1.0) clamav-client (3.1.0)
cliver (0.3.2)
coderay (1.1.1) coderay (1.1.1)
coffee-rails (4.2.1) coffee-rails (4.2.1)
coffee-script (>= 2.2.0) coffee-script (>= 2.2.0)
@ -466,10 +470,6 @@ GEM
ast (~> 2.2) ast (~> 2.2)
pdf-core (0.6.1) pdf-core (0.6.1)
pg (0.19.0) pg (0.19.0)
poltergeist (1.14.0)
capybara (~> 2.1)
cliver (~> 0.3.1)
websocket-driver (>= 0.2.0)
powerpack (0.1.1) powerpack (0.1.1)
prawn (2.0.2) prawn (2.0.2)
pdf-core (~> 0.6.0) pdf-core (~> 0.6.0)
@ -593,6 +593,7 @@ GEM
sexp_processor (~> 4.9) sexp_processor (~> 4.9)
rubyzip (1.0.0) rubyzip (1.0.0)
safe_yaml (1.0.4) safe_yaml (1.0.4)
sanitize-url (0.1.4)
sass (3.4.22) sass (3.4.22)
sass-rails (5.0.6) sass-rails (5.0.6)
railties (>= 4.0.0, < 6) railties (>= 4.0.0, < 6)
@ -613,6 +614,9 @@ GEM
select2-rails (4.0.3) select2-rails (4.0.3)
thor (~> 0.14) thor (~> 0.14)
selectize-rails (0.12.4.1) selectize-rails (0.12.4.1)
selenium-webdriver (3.8.0)
childprocess (~> 0.5)
rubyzip (~> 1.0)
sentry-raven (2.2.0) sentry-raven (2.2.0)
faraday (>= 0.7.6, < 1.0) faraday (>= 0.7.6, < 1.0)
sexp_processor (4.10.0) sexp_processor (4.10.0)
@ -726,6 +730,7 @@ DEPENDENCIES
browser browser
byebug byebug
capybara capybara
capybara-selenium
carrierwave carrierwave
carrierwave-i18n carrierwave-i18n
chartkick chartkick
@ -765,7 +770,6 @@ DEPENDENCIES
openid_connect openid_connect
openstack openstack
pg pg
poltergeist
prawn (~> 2.0.1) prawn (~> 2.0.1)
prawn_rails (~> 0.0.11) prawn_rails (~> 0.0.11)
pry-byebug pry-byebug
@ -779,6 +783,7 @@ DEPENDENCIES
rspec_junit_formatter rspec_junit_formatter
rubocop rubocop
rubocop-rspec-focused rubocop-rspec-focused
sanitize-url
sass-rails (~> 5.0) sass-rails (~> 5.0)
scenic scenic
scss_lint scss_lint
@ -804,4 +809,4 @@ DEPENDENCIES
xray-rails xray-rails
BUNDLED WITH BUNDLED WITH
1.16.0 1.16.1

View file

@ -20,7 +20,7 @@ Téléprocédures Simplifiées, ou TPS pour les intimes, est une plateforme 100
### Tests ### Tests
- PhantomJS - Chrome
## Initialisation de l'environnement de développement ## Initialisation de l'environnement de développement

View file

@ -1,4 +1,10 @@
module ApplicationHelper module ApplicationHelper
include SanitizeUrl
def sanitize_url(url)
super(url, schemes: ['http', 'https'], replace_evil_with: root_url)
end
def flash_class(level) def flash_class(level)
case level case level
when "notice" then "alert-success" when "notice" then "alert-success"

View file

@ -47,7 +47,7 @@
%h3 Lien procédure %h3 Lien procédure
%div{ style: 'margin-left: 3%;' } %div{ style: 'margin-left: 3%;' }
- if @facade.procedure.publiee_ou_archivee? - if @facade.procedure.publiee_ou_archivee?
= link_to @facade.procedure.lien, @facade.procedure.lien, target: '_blank' = link_to @facade.procedure.lien, sanitize_url(@facade.procedure.lien), target: :blank
- else - else
%b %b
Cette procédure n'a pas encore été publiée et n'est donc pas accessible par le public. Cette procédure n'a pas encore été publiée et n'est donc pas accessible par le public.

View file

@ -20,5 +20,4 @@
- if @facade.procedure.lien_site_web.present? - if @facade.procedure.lien_site_web.present?
.center .center
%a{ href: @facade.procedure.lien_site_web, target: '_blank' } = link_to "En savoir plus ...", sanitize_url(@facade.procedure.lien_site_web), target: '_blank'
En savoir plus ...

View file

@ -7,7 +7,7 @@
- if dossier.procedure.lien_demarche.present? - if dossier.procedure.lien_demarche.present?
%em %em
Récupérer le formulaire de demande ou CERFA vierge pour mon dossier : Récupérer le formulaire de demande ou CERFA vierge pour mon dossier :
= link_to "Télécharger", "#{dossier.procedure.lien_demarche}", target: :blank, id: :lien_cerfa = link_to "Télécharger", sanitize_url(dossier.procedure.lien_demarche), target: :blank, id: :lien_cerfa
-# %a#lien_cerfa{ href: "#{dossier.procedure.lien_demarche}", target: '_blank' } Télécharger -# %a#lien_cerfa{ href: "#{dossier.procedure.lien_demarche}", target: '_blank' } Télécharger
%td %td

View file

@ -264,5 +264,5 @@ Rails.application.routes.draw do
# Legacy routes # Legacy routes
get 'backoffice' => redirect('/procedures') get 'backoffice' => redirect('/procedures')
get 'backoffice/sign_in' => redirect('/users/sign_in') get 'backoffice/sign_in' => redirect('/users/sign_in')
get 'backoffice/dossiers/procedure/:id' => redirect('/procedures/:id') get 'backoffice/dossiers/procedure/:procedure_id' => redirect('/procedures/%{procedure_id}')
end end

View file

@ -10,17 +10,17 @@ feature 'As an administrateur I wanna create a new procedure', js: true do
context 'Right after sign_in I shall see all procedure states links' do context 'Right after sign_in I shall see all procedure states links' do
scenario 'Finding draft procedures' do scenario 'Finding draft procedures' do
page.find_by_id('draft-procedures').trigger('click') page.find_by_id('draft-procedures').click
expect(page).to have_current_path(admin_procedures_draft_path, only_path: true) expect(page).to have_current_path(admin_procedures_draft_path, only_path: true)
end end
scenario 'Finding active procedures' do scenario 'Finding active procedures' do
page.find_by_id('active-procedures').trigger('click') page.find_by_id('active-procedures').click
expect(page).to have_current_path(admin_procedures_path, only_path: true) expect(page).to have_current_path(admin_procedures_path, only_path: true)
end end
scenario 'Finding archived procedures' do scenario 'Finding archived procedures' do
page.find_by_id('archived-procedures').trigger('click') page.find_by_id('archived-procedures').click
expect(page).to have_current_path(admin_procedures_archived_path, only_path: true) expect(page).to have_current_path(admin_procedures_archived_path, only_path: true)
end end
end end
@ -58,13 +58,13 @@ feature 'As an administrateur I wanna create a new procedure', js: true do
page.find_by_id('procedure_types_de_champ_attributes_1_libelle') page.find_by_id('procedure_types_de_champ_attributes_1_libelle')
expect(Procedure.first.types_de_champ.first.libelle).to eq('libelle de champ') expect(Procedure.first.types_de_champ.first.libelle).to eq('libelle de champ')
page.find_by_id('onglet-pieces').trigger('click') page.find_by_id('onglet-pieces').click
expect(page).to have_current_path(admin_procedure_pieces_justificatives_path(Procedure.first.id.to_s)) expect(page).to have_current_path(admin_procedure_pieces_justificatives_path(Procedure.first.id.to_s))
page.find_by_id('procedure_types_de_piece_justificative_attributes_0_libelle').set 'libelle de piece' page.find_by_id('procedure_types_de_piece_justificative_attributes_0_libelle').set 'libelle de piece'
page.find_by_id('add_piece_justificative').click page.find_by_id('add_piece_justificative').click
page.find_by_id('procedure_types_de_piece_justificative_attributes_1_libelle') page.find_by_id('procedure_types_de_piece_justificative_attributes_1_libelle')
page.find_by_id('onglet-preview').trigger('click') page.find_by_id('onglet-preview').click
expect(page).to have_current_path(admin_procedure_previsualisation_path(Procedure.first.id.to_s)) expect(page).to have_current_path(admin_procedure_previsualisation_path(Procedure.first.id.to_s))
expect(page.find("input[type='text']")['placeholder']).to eq('libelle de champ') expect(page.find("input[type='text']")['placeholder']).to eq('libelle de champ')
expect(page.first('.piece-libelle').text).to eq('libelle de piece') expect(page.first('.piece-libelle').text).to eq('libelle de piece')
@ -73,21 +73,21 @@ feature 'As an administrateur I wanna create a new procedure', js: true do
scenario 'After adding champ and file, check impossibility to publish procedure, add accompagnateur and make publication' do scenario 'After adding champ and file, check impossibility to publish procedure, add accompagnateur and make publication' do
page.find_by_id('procedure_types_de_champ_attributes_0_libelle').set 'libelle de champ' page.find_by_id('procedure_types_de_champ_attributes_0_libelle').set 'libelle de champ'
page.find_by_id('add_type_de_champ').click page.find_by_id('add_type_de_champ').click
page.find_by_id('onglet-pieces').trigger('click') page.find_by_id('onglet-pieces').click
page.find_by_id('procedure_types_de_piece_justificative_attributes_0_libelle').set 'libelle de piece' page.find_by_id('procedure_types_de_piece_justificative_attributes_0_libelle').set 'libelle de piece'
page.find_by_id('add_piece_justificative').click page.find_by_id('add_piece_justificative').click
page.find_by_id('onglet-infos').trigger('click') page.find_by_id('onglet-infos').click
expect(page).to have_current_path(admin_procedure_path(Procedure.first.id.to_s)) expect(page).to have_current_path(admin_procedure_path(Procedure.first.id.to_s))
expect(page.find_by_id('publish-procedure')['disabled']).to eq('disabled') expect(page.find_by_id('publish-procedure')['disabled']).to eq('true')
page.find_by_id('onglet-accompagnateurs').trigger('click') page.find_by_id('onglet-accompagnateurs').click
expect(page).to have_current_path(admin_procedure_accompagnateurs_path(Procedure.first.id.to_s)) expect(page).to have_current_path(admin_procedure_accompagnateurs_path(Procedure.first.id.to_s))
page.find_by_id('gestionnaire_email').set 'gestionnaire@apientreprise.fr' page.find_by_id('gestionnaire_email').set 'gestionnaire@apientreprise.fr'
page.find_by_id('add-gestionnaire-email').click page.find_by_id('add-gestionnaire-email').click
page.first('.gestionnaire-affectation').click page.first('.gestionnaire-affectation').click
page.find_by_id('onglet-infos').trigger('click') page.find_by_id('onglet-infos').click
expect(page).to have_selector('#publish-procedure', visible: true) expect(page).to have_selector('#publish-procedure', visible: true)
page.find_by_id('publish-procedure').click page.find_by_id('publish-procedure').click

View file

@ -61,7 +61,7 @@ feature 'user path for dossier creation' do
context 'when validating info entreprise recap page' do context 'when validating info entreprise recap page' do
before do before do
page.check('dossier_autorisation_donnees') page.check('dossier_autorisation_donnees')
page.find_by_id('etape_suivante').trigger('click') page.find_by_id('etape_suivante').click
end end
scenario 'user is on description page' do scenario 'user is on description page' do
expect(page).to have_css('#description-page') expect(page).to have_css('#description-page')
@ -69,7 +69,7 @@ feature 'user path for dossier creation' do
context 'user fill and validate description page' do context 'user fill and validate description page' do
before do before do
page.find_by_id("champs_#{Dossier.last.champs.first.id}").set 'Mon super projet' page.find_by_id("champs_#{Dossier.last.champs.first.id}").set 'Mon super projet'
page.find_by_id('suivant').trigger('click') page.find_by_id('suivant').click
end end
scenario 'user is on recap page' do scenario 'user is on recap page' do
expect(page).to have_css('#users-recapitulatif-dossier-show') expect(page).to have_css('#users-recapitulatif-dossier-show')

View file

@ -55,14 +55,14 @@ feature 'As a User I wanna create a dossier' do
stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/associations/#{siret}?token=#{SIADETOKEN}") stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/associations/#{siret}?token=#{SIADETOKEN}")
.to_return(status: 404, body: '') .to_return(status: 404, body: '')
page.find_by_id('dossier-siret').set siret page.find_by_id('dossier-siret').set siret
page.find_by_id('submit-siret').trigger('click') page.find_by_id('submit-siret').click
expect(page).to have_css('#recap-info-entreprise') expect(page).to have_css('#recap-info-entreprise')
find(:css, "#dossier_autorisation_donnees[value='1']").set(true) find(:css, "#dossier_autorisation_donnees[value='1']").set(true)
page.find_by_id('etape_suivante').trigger('click') page.find_by_id('etape_suivante').click
expect(page).to have_current_path(users_dossier_carte_path(procedure_with_siret.dossiers.last.id.to_s), only_path: true) expect(page).to have_current_path(users_dossier_carte_path(procedure_with_siret.dossiers.last.id.to_s), only_path: true)
page.find_by_id('etape_suivante').trigger('click') page.find_by_id('etape_suivante').click
fill_in "champs_#{procedure_with_siret.dossiers.last.champs.first.id}", with: 'contenu du champ 1' fill_in "champs_#{procedure_with_siret.dossiers.last.champs.first.id}", with: 'contenu du champ 1'
page.find_by_id('suivant').trigger('click') page.find_by_id('suivant').click
expect(page).to have_current_path(users_dossier_recapitulatif_path(procedure_with_siret.dossiers.last.id.to_s), only_path: true) expect(page).to have_current_path(users_dossier_recapitulatif_path(procedure_with_siret.dossiers.last.id.to_s), only_path: true)
end end
end end

View file

@ -37,7 +37,7 @@ feature 'As a User I want to edit a dossier I own' do
linked_dossier_id = dossier.champs.find { |c| c.type_de_champ.type_champ == 'dossier_link' }.value linked_dossier_id = dossier.champs.find { |c| c.type_de_champ.type_champ == 'dossier_link' }.value
expect(page).to have_link("Dossier #{linked_dossier_id}") expect(page).to have_link("Dossier #{linked_dossier_id}")
page.find_by_id('maj_infos').trigger('click') page.find_by_id('edit-dossier').click
expect(page).to have_current_path(users_dossier_description_path(dossier.id.to_s), only_path: true) expect(page).to have_current_path(users_dossier_description_path(dossier.id.to_s), only_path: true)
champ_id = dossier.champs.find { |t| t.type_champ == "text" }.id champ_id = dossier.champs.find { |t| t.type_champ == "text" }.id
fill_in "champs_#{champ_id.to_s}", with: 'Contenu du champ 1' fill_in "champs_#{champ_id.to_s}", with: 'Contenu du champ 1'

View file

@ -11,8 +11,8 @@ feature 'As a User I want to sort and paginate dossiers', js: true do
fill_in 'dossier_individual_attributes_prenom', with: 'Prenom' fill_in 'dossier_individual_attributes_prenom', with: 'Prenom'
fill_in 'dossier_individual_attributes_birthdate', with: '14/10/1987' fill_in 'dossier_individual_attributes_birthdate', with: '14/10/1987'
find(:css, "#dossier_autorisation_donnees[value='1']").set(true) find(:css, "#dossier_autorisation_donnees[value='1']").set(true)
page.find_by_id('etape_suivante').trigger('click') page.find_by_id('etape_suivante').click
page.find_by_id('suivant').trigger('click') page.find_by_id('suivant').click
50.times do 50.times do
Dossier.create(procedure_id: procedure_for_individual.id, user_id: user.id, state: "en_construction") Dossier.create(procedure_id: procedure_for_individual.id, user_id: user.id, state: "en_construction")
end end
@ -35,15 +35,15 @@ feature 'As a User I want to sort and paginate dossiers', js: true do
scenario 'Using pagination' do scenario 'Using pagination' do
visit "/users/dossiers?dossiers_smart_listing[sort][id]=asc" visit "/users/dossiers?dossiers_smart_listing[sort][id]=asc"
expect(page.all(:css, '#dossiers-list tr')[1].text.split(" ").first).to eq(user.dossiers.first.id.to_s) expect(page.all(:css, '#dossiers-list tr')[1].text.split(" ").first).to eq(user.dossiers.first.id.to_s)
page.find('.next_page a').trigger('click') page.find('.next_page a').click
wait_for_ajax wait_for_ajax
expect(page.all(:css, '#dossiers-list tr')[1].text.split(" ").first).to eq((user.dossiers.first.id + 10).to_s) expect(page.all(:css, '#dossiers-list tr')[1].text.split(" ").first).to eq((user.dossiers.first.id + 10).to_s)
page.find('.next_page a').trigger('click') page.find('.next_page a').click
wait_for_ajax wait_for_ajax
expect(page.all(:css, '#dossiers-list tr')[1].text.split(" ").first).to eq((user.dossiers.first.id + 20).to_s) expect(page.all(:css, '#dossiers-list tr')[1].text.split(" ").first).to eq((user.dossiers.first.id + 20).to_s)
page.find('.prev a').trigger('click') page.find('.prev a').click
wait_for_ajax wait_for_ajax
page.find('.prev a').trigger('click') page.find('.prev a').click
wait_for_ajax wait_for_ajax
expect(page.all(:css, '#dossiers-list tr')[1].text.split(" ").first).to eq((user.dossiers.first.id).to_s) expect(page.all(:css, '#dossiers-list tr')[1].text.split(" ").first).to eq((user.dossiers.first.id).to_s)
end end

View file

@ -3,10 +3,8 @@ require 'spec_helper'
describe Carto::Geocodeur do describe Carto::Geocodeur do
let(:address) { '50 av des champs elysees' } let(:address) { '50 av des champs elysees' }
describe '.convert_adresse_to_point', vcr: { cassette_name: 'bano_octo' } do describe '.convert_adresse_to_point', vcr: { cassette_name: 'bano_octo' } do
if ENV['CIRCLECI'].nil? it 'return a point' do
it 'return a point' do expect(described_class.convert_adresse_to_point(address).class).to eq(RGeo::Cartesian::PointImpl)
expect(described_class.convert_adresse_to_point(address).class).to eq(RGeo::Cartesian::PointImpl)
end
end end
context 'when RestClient::Exception' do context 'when RestClient::Exception' do
before do before do

View file

@ -28,11 +28,22 @@ require 'shoulda-matchers'
require 'devise' require 'devise'
require 'factory_girl' require 'factory_girl'
require 'capybara/poltergeist' require 'selenium/webdriver'
Capybara.javascript_driver = :poltergeist Capybara.javascript_driver = :headless_chrome
Capybara.ignore_hidden_elements = false Capybara.ignore_hidden_elements = false
Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(app, js_errors: true, port: 44_678, phantomjs_options: ['--proxy-type=none'], timeout: 180) 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 window-size=2560,1600) }
)
Capybara::Selenium::Driver.new app,
browser: :chrome,
desired_capabilities: capabilities
end end
ActiveSupport::Deprecation.silenced = true ActiveSupport::Deprecation.silenced = true