commit
d14a8c3963
14 changed files with 83 additions and 51 deletions
2
Gemfile
2
Gemfile
|
@ -84,6 +84,7 @@ gem 'zipline'
|
||||||
gem 'zxcvbn-ruby', require: 'zxcvbn'
|
gem 'zxcvbn-ruby', require: 'zxcvbn'
|
||||||
|
|
||||||
group :test do
|
group :test do
|
||||||
|
gem 'axe-core-rspec' # accessibility rspec matchers
|
||||||
gem 'capybara' # Integration testing
|
gem 'capybara' # Integration testing
|
||||||
gem 'capybara-email' # Access emails during integration tests
|
gem 'capybara-email' # Access emails during integration tests
|
||||||
gem 'capybara-screenshot' # Save a dump of the page when an integration test fails
|
gem 'capybara-screenshot' # Save a dump of the page when an integration test fails
|
||||||
|
@ -114,7 +115,6 @@ group :development do
|
||||||
end
|
end
|
||||||
|
|
||||||
group :development, :test do
|
group :development, :test do
|
||||||
gem 'axe-matchers' # accessibility rspec matchers
|
|
||||||
gem 'graphql-schema_comparator'
|
gem 'graphql-schema_comparator'
|
||||||
gem 'mina', git: 'https://github.com/mina-deploy/mina.git', require: false # Deploy
|
gem 'mina', git: 'https://github.com/mina-deploy/mina.git', require: false # Deploy
|
||||||
gem 'pry-byebug' # Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
gem 'pry-byebug' # Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
||||||
|
|
24
Gemfile.lock
24
Gemfile.lock
|
@ -108,9 +108,16 @@ GEM
|
||||||
attr_encrypted (3.1.0)
|
attr_encrypted (3.1.0)
|
||||||
encryptor (~> 3.0.0)
|
encryptor (~> 3.0.0)
|
||||||
attr_required (1.0.1)
|
attr_required (1.0.1)
|
||||||
axe-matchers (2.6.1)
|
axe-core-api (4.2.1)
|
||||||
dumb_delegator (~> 0.8)
|
capybara
|
||||||
virtus (~> 1.0)
|
dumb_delegator
|
||||||
|
selenium-webdriver
|
||||||
|
virtus
|
||||||
|
watir
|
||||||
|
axe-core-rspec (4.2.1)
|
||||||
|
axe-core-api
|
||||||
|
dumb_delegator
|
||||||
|
virtus
|
||||||
axiom-types (0.1.1)
|
axiom-types (0.1.1)
|
||||||
descendants_tracker (~> 0.0.4)
|
descendants_tracker (~> 0.0.4)
|
||||||
ice_nine (~> 0.11.0)
|
ice_nine (~> 0.11.0)
|
||||||
|
@ -230,11 +237,10 @@ GEM
|
||||||
dotenv (= 2.7.6)
|
dotenv (= 2.7.6)
|
||||||
railties (>= 3.2)
|
railties (>= 3.2)
|
||||||
dry-inflector (0.2.0)
|
dry-inflector (0.2.0)
|
||||||
dumb_delegator (0.8.1)
|
dumb_delegator (1.0.0)
|
||||||
ecma-re-validator (0.3.0)
|
ecma-re-validator (0.3.0)
|
||||||
regexp_parser (~> 2.0)
|
regexp_parser (~> 2.0)
|
||||||
encryptor (3.0.0)
|
encryptor (3.0.0)
|
||||||
equalizer (0.0.11)
|
|
||||||
erubi (1.10.0)
|
erubi (1.10.0)
|
||||||
erubis (2.7.0)
|
erubis (2.7.0)
|
||||||
et-orbi (1.2.4)
|
et-orbi (1.2.4)
|
||||||
|
@ -731,13 +737,15 @@ GEM
|
||||||
activemodel (>= 3.0.0)
|
activemodel (>= 3.0.0)
|
||||||
public_suffix
|
public_suffix
|
||||||
vcr (6.0.0)
|
vcr (6.0.0)
|
||||||
virtus (1.0.5)
|
virtus (2.0.0)
|
||||||
axiom-types (~> 0.1)
|
axiom-types (~> 0.1)
|
||||||
coercible (~> 1.0)
|
coercible (~> 1.0)
|
||||||
descendants_tracker (~> 0.0, >= 0.0.3)
|
descendants_tracker (~> 0.0, >= 0.0.3)
|
||||||
equalizer (~> 0.0, >= 0.0.9)
|
|
||||||
warden (1.2.9)
|
warden (1.2.9)
|
||||||
rack (>= 2.0.9)
|
rack (>= 2.0.9)
|
||||||
|
watir (6.19.1)
|
||||||
|
regexp_parser (>= 1.2, < 3)
|
||||||
|
selenium-webdriver (>= 3.142.7)
|
||||||
web-console (4.1.0)
|
web-console (4.1.0)
|
||||||
actionview (>= 6.0.0)
|
actionview (>= 6.0.0)
|
||||||
activemodel (>= 6.0.0)
|
activemodel (>= 6.0.0)
|
||||||
|
@ -785,7 +793,7 @@ DEPENDENCIES
|
||||||
after_party
|
after_party
|
||||||
anchored
|
anchored
|
||||||
annotate
|
annotate
|
||||||
axe-matchers
|
axe-core-rspec
|
||||||
bcrypt
|
bcrypt
|
||||||
bootsnap (>= 1.4.4)
|
bootsnap (>= 1.4.4)
|
||||||
brakeman
|
brakeman
|
||||||
|
|
|
@ -21,7 +21,7 @@ class ApplicationController < ActionController::Base
|
||||||
around_action :switch_locale
|
around_action :switch_locale
|
||||||
|
|
||||||
helper_method :multiple_devise_profile_connect?, :instructeur_signed_in?, :current_instructeur, :current_expert, :expert_signed_in?,
|
helper_method :multiple_devise_profile_connect?, :instructeur_signed_in?, :current_instructeur, :current_expert, :expert_signed_in?,
|
||||||
:administrateur_signed_in?, :current_administrateur, :current_account
|
:administrateur_signed_in?, :current_administrateur, :current_account, :localization_enabled?, :set_locale
|
||||||
|
|
||||||
def staging_authenticate
|
def staging_authenticate
|
||||||
if StagingAuthService.enabled? && !authenticate_with_http_basic { |username, password| StagingAuthService.authenticate(username, password) }
|
if StagingAuthService.enabled? && !authenticate_with_http_basic { |username, password| StagingAuthService.authenticate(username, password) }
|
||||||
|
@ -71,6 +71,17 @@ class ApplicationController < ActionController::Base
|
||||||
|
|
||||||
alias_method :pundit_user, :current_account
|
alias_method :pundit_user, :current_account
|
||||||
|
|
||||||
|
def localization_enabled?
|
||||||
|
ENV.fetch('LOCALIZATION_ENABLED', 'false') == 'true' || cookies[:locale].present?
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_locale(locale)
|
||||||
|
if locale && locale.to_sym.in?(I18n.available_locales)
|
||||||
|
cookies[:locale] = locale
|
||||||
|
locale
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def feature_enabled?(feature_name)
|
def feature_enabled?(feature_name)
|
||||||
|
@ -309,14 +320,25 @@ class ApplicationController < ActionController::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def switch_locale(&action)
|
def switch_locale(&action)
|
||||||
locale = nil
|
locale = extract_locale_from_query_params ||
|
||||||
if cookies[:locale]
|
extract_locale_from_cookie ||
|
||||||
locale = cookies[:locale]
|
extract_locale_from_accept_language_header ||
|
||||||
elsif ENV.fetch('LOCALIZATION_ENABLED', 'false') == 'true'
|
I18n.default_locale
|
||||||
locale = http_accept_language.compatible_language_from(I18n.available_locales)
|
|
||||||
else
|
|
||||||
locale = I18n.default_locale
|
|
||||||
end
|
|
||||||
I18n.with_locale(locale, &action)
|
I18n.with_locale(locale, &action)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def extract_locale_from_query_params
|
||||||
|
set_locale(request.query_parameters[:locale])
|
||||||
|
end
|
||||||
|
|
||||||
|
def extract_locale_from_cookie
|
||||||
|
cookies[:locale]
|
||||||
|
end
|
||||||
|
|
||||||
|
def extract_locale_from_accept_language_header
|
||||||
|
if localization_enabled?
|
||||||
|
http_accept_language.compatible_language_from(I18n.available_locales)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -180,7 +180,7 @@ module NewAdministrateur
|
||||||
redirect_to admin_procedure_groupe_instructeurs_path(procedure)
|
redirect_to admin_procedure_groupe_instructeurs_path(procedure)
|
||||||
|
|
||||||
elsif group_csv_file.size > CSV_MAX_SIZE
|
elsif group_csv_file.size > CSV_MAX_SIZE
|
||||||
flash[:alert] = "Importation impossible : la poids du fichier est supérieur à #{number_to_human_size(CSV_MAX_SIZE)}"
|
flash[:alert] = "Importation impossible : le poids du fichier est supérieur à #{number_to_human_size(CSV_MAX_SIZE)}"
|
||||||
redirect_to admin_procedure_groupe_instructeurs_path(procedure)
|
redirect_to admin_procedure_groupe_instructeurs_path(procedure)
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
|
@ -89,7 +89,7 @@ class RootController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def save_locale
|
def save_locale
|
||||||
cookies[:locale] = params[:locale]
|
set_locale(params[:locale])
|
||||||
redirect_to request.referer
|
redirect_back(fallback_location: root_path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -82,6 +82,6 @@
|
||||||
- else
|
- else
|
||||||
= render partial: 'shared/help/help_button'
|
= render partial: 'shared/help/help_button'
|
||||||
|
|
||||||
- if ENV.fetch('LOCALIZATION_ENABLED', 'false') == 'true'
|
- if localization_enabled?
|
||||||
%li
|
%li
|
||||||
= render partial: 'layouts/locale_dropdown'
|
= render partial: 'layouts/locale_dropdown'
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
.dropdown.locale-dropdown
|
.dropdown.locale-dropdown.header-menu-opener
|
||||||
%button.button.dropdown-button.icon-only.header-menu-button{ title: "Translate", 'aria-expanded' => 'false', 'aria-controls' => 'locale_menu' }
|
%button.button.dropdown-button.icon-only.header-menu-button{ title: "Translate", aria: { expanded: 'false', controls: 'locale_menu' } }
|
||||||
.hidden Translate
|
.hidden Translate
|
||||||
= image_tag "icons/translate-icon.svg", alt: 'Translate', 'aria-hidden':'true'
|
= image_tag "icons/translate-icon.svg", alt: 'Translate', width: 24, height: 24, lazy: true, aria: { hidden: true }
|
||||||
%ul.header-menu.dropdown-content
|
%ul.header-menu.dropdown-content
|
||||||
%li
|
%li
|
||||||
= link_to save_locale_path(locale: :en), method: :post, class: "menu-item menu-link" do
|
= link_to save_locale_path(locale: :en), method: :post, class: "menu-item menu-link" do
|
||||||
EN - English
|
EN – English
|
||||||
%li
|
%li
|
||||||
= link_to save_locale_path(locale: :fr), method: :post, class: "menu-item menu-link" do
|
= link_to save_locale_path(locale: :fr), method: :post, class: "menu-item menu-link" do
|
||||||
FR - français
|
FR – français
|
||||||
|
|
|
@ -400,7 +400,7 @@ describe NewAdministrateur::GroupeInstructeursController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect(flash.alert).to be_present }
|
it { expect(flash.alert).to be_present }
|
||||||
it { expect(flash.alert).to eq("Importation impossible : la poids du fichier est supérieur à 1 Mo") }
|
it { expect(flash.alert).to eq("Importation impossible : le poids du fichier est supérieur à 1 Mo") }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when the file content type is not accepted' do
|
context 'when the file content type is not accepted' do
|
||||||
|
|
|
@ -10,12 +10,12 @@ feature 'wcag rules for usager', js: true do
|
||||||
context 'pages without the need to be logged in' do
|
context 'pages without the need to be logged in' do
|
||||||
scenario 'homepage' do
|
scenario 'homepage' do
|
||||||
visit root_path
|
visit root_path
|
||||||
expect(page).to be_accessible
|
expect(page).to be_axe_clean
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'sign_up page' do
|
scenario 'sign_up page' do
|
||||||
visit new_user_registration_path
|
visit new_user_registration_path
|
||||||
expect(page).to be_accessible
|
expect(page).to be_axe_clean
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'account confirmation page' do
|
scenario 'account confirmation page' do
|
||||||
|
@ -26,23 +26,23 @@ feature 'wcag rules for usager', js: true do
|
||||||
|
|
||||||
perform_enqueued_jobs do
|
perform_enqueued_jobs do
|
||||||
click_button 'Créer un compte'
|
click_button 'Créer un compte'
|
||||||
expect(page).to be_accessible
|
expect(page).to be_axe_clean
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'sign_in page' do
|
scenario 'sign_in page' do
|
||||||
visit new_user_session_path
|
visit new_user_session_path
|
||||||
expect(page).to be_accessible.excluding '#user_email'
|
expect(page).to be_axe_clean.excluding '#user_email'
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'contact page' do
|
scenario 'contact page' do
|
||||||
visit contact_path
|
visit contact_path
|
||||||
expect(page).to be_accessible
|
expect(page).to be_axe_clean
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'commencer page' do
|
scenario 'commencer page' do
|
||||||
visit commencer_path(path: procedure.reload.path)
|
visit commencer_path(path: procedure.reload.path)
|
||||||
expect(page).to be_accessible
|
expect(page).to be_axe_clean
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ feature 'wcag rules for usager', js: true do
|
||||||
|
|
||||||
scenario 'écran identité usager' do
|
scenario 'écran identité usager' do
|
||||||
click_on 'Commencer la démarche'
|
click_on 'Commencer la démarche'
|
||||||
expect(page).to be_accessible
|
expect(page).to be_axe_clean
|
||||||
end
|
end
|
||||||
|
|
||||||
# with no surprise, there's a lot of work on this one
|
# with no surprise, there's a lot of work on this one
|
||||||
|
@ -66,7 +66,7 @@ feature 'wcag rules for usager', js: true do
|
||||||
fill_in('individual_nom', with: 'nom')
|
fill_in('individual_nom', with: 'nom')
|
||||||
click_on 'Continuer'
|
click_on 'Continuer'
|
||||||
|
|
||||||
expect(page).to be_accessible.skipping :'aria-input-field-name'
|
expect(page).to be_axe_clean.skipping :'aria-input-field-name'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ feature 'wcag rules for usager', js: true do
|
||||||
|
|
||||||
scenario "écran identification de l'entreprise" do
|
scenario "écran identification de l'entreprise" do
|
||||||
click_on 'Commencer la démarche'
|
click_on 'Commencer la démarche'
|
||||||
expect(page).to be_accessible.skipping :label
|
expect(page).to be_axe_clean.skipping :label
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -92,37 +92,37 @@ feature 'wcag rules for usager', js: true do
|
||||||
|
|
||||||
scenario 'liste des dossiers' do
|
scenario 'liste des dossiers' do
|
||||||
visit dossiers_path
|
visit dossiers_path
|
||||||
expect(page).to be_accessible
|
expect(page).to be_axe_clean
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'dossier' do
|
scenario 'dossier' do
|
||||||
visit dossier_path(dossier)
|
visit dossier_path(dossier)
|
||||||
expect(page).to be_accessible.skipping :'aria-input-field-name'
|
expect(page).to be_axe_clean.skipping :'aria-input-field-name'
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'merci' do
|
scenario 'merci' do
|
||||||
visit merci_dossier_path(dossier)
|
visit merci_dossier_path(dossier)
|
||||||
expect(page).to be_accessible
|
expect(page).to be_axe_clean
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'demande' do
|
scenario 'demande' do
|
||||||
visit demande_dossier_path(dossier)
|
visit demande_dossier_path(dossier)
|
||||||
expect(page).to be_accessible
|
expect(page).to be_axe_clean
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'messagerie' do
|
scenario 'messagerie' do
|
||||||
visit messagerie_dossier_path(dossier)
|
visit messagerie_dossier_path(dossier)
|
||||||
expect(page).to be_accessible
|
expect(page).to be_axe_clean
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'modifier' do
|
scenario 'modifier' do
|
||||||
visit modifier_dossier_path(dossier)
|
visit modifier_dossier_path(dossier)
|
||||||
expect(page).to be_accessible.skipping :'aria-input-field-name'
|
expect(page).to be_axe_clean.skipping :'aria-input-field-name'
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'brouillon' do
|
scenario 'brouillon' do
|
||||||
visit brouillon_dossier_path(dossier)
|
visit brouillon_dossier_path(dossier)
|
||||||
expect(page).to be_accessible.skipping :'aria-input-field-name'
|
expect(page).to be_axe_clean.skipping :'aria-input-field-name'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,7 +8,7 @@ feature 'Accessing the website in different languages:' do
|
||||||
expect(page).to have_text('Connectez-vous')
|
expect(page).to have_text('Connectez-vous')
|
||||||
|
|
||||||
click_on 'Translate'
|
click_on 'Translate'
|
||||||
click_on 'EN - English'
|
click_on 'EN – English'
|
||||||
|
|
||||||
# The page is now in English
|
# The page is now in English
|
||||||
expect(page).to have_text('Sign in')
|
expect(page).to have_text('Sign in')
|
||||||
|
|
|
@ -10,7 +10,7 @@ abort("The Rails environment is running in production mode!") if Rails.env.produ
|
||||||
require 'rspec/rails'
|
require 'rspec/rails'
|
||||||
# Add additional requires below this line. Rails is not loaded until this point!
|
# Add additional requires below this line. Rails is not loaded until this point!
|
||||||
|
|
||||||
require 'axe/rspec'
|
require 'axe-rspec'
|
||||||
require 'devise'
|
require 'devise'
|
||||||
require 'shoulda-matchers'
|
require 'shoulda-matchers'
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ describe 'layouts/_header.html.haml', type: :view do
|
||||||
allow(view).to receive(:multiple_devise_profile_connect?).and_return(false)
|
allow(view).to receive(:multiple_devise_profile_connect?).and_return(false)
|
||||||
allow(view).to receive(:instructeur_signed_in?).and_return((profile == :instructeur))
|
allow(view).to receive(:instructeur_signed_in?).and_return((profile == :instructeur))
|
||||||
allow(view).to receive(:current_instructeur).and_return(current_instructeur)
|
allow(view).to receive(:current_instructeur).and_return(current_instructeur)
|
||||||
|
allow(view).to receive(:localization_enabled?).and_return(false)
|
||||||
|
|
||||||
if user
|
if user
|
||||||
sign_in user
|
sign_in user
|
||||||
|
|
|
@ -5,6 +5,7 @@ describe 'layouts/procedure_context.html.haml', type: :view do
|
||||||
before do
|
before do
|
||||||
allow(view).to receive(:instructeur_signed_in?).and_return(false)
|
allow(view).to receive(:instructeur_signed_in?).and_return(false)
|
||||||
allow(view).to receive(:administrateur_signed_in?).and_return(false)
|
allow(view).to receive(:administrateur_signed_in?).and_return(false)
|
||||||
|
allow(view).to receive(:localization_enabled?).and_return(false)
|
||||||
end
|
end
|
||||||
|
|
||||||
subject do
|
subject do
|
||||||
|
|
|
@ -9361,9 +9361,9 @@ path-key@^3.0.0, path-key@^3.1.0:
|
||||||
integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==
|
integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==
|
||||||
|
|
||||||
path-parse@^1.0.6:
|
path-parse@^1.0.6:
|
||||||
version "1.0.6"
|
version "1.0.7"
|
||||||
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c"
|
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735"
|
||||||
integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==
|
integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==
|
||||||
|
|
||||||
path-to-regexp@0.1.7:
|
path-to-regexp@0.1.7:
|
||||||
version "0.1.7"
|
version "0.1.7"
|
||||||
|
|
Loading…
Add table
Reference in a new issue