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'
|
||||
|
||||
group :test do
|
||||
gem 'axe-core-rspec' # accessibility rspec matchers
|
||||
gem 'capybara' # Integration testing
|
||||
gem 'capybara-email' # Access emails during integration tests
|
||||
gem 'capybara-screenshot' # Save a dump of the page when an integration test fails
|
||||
|
@ -114,7 +115,6 @@ group :development do
|
|||
end
|
||||
|
||||
group :development, :test do
|
||||
gem 'axe-matchers' # accessibility rspec matchers
|
||||
gem 'graphql-schema_comparator'
|
||||
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
|
||||
|
|
24
Gemfile.lock
24
Gemfile.lock
|
@ -108,9 +108,16 @@ GEM
|
|||
attr_encrypted (3.1.0)
|
||||
encryptor (~> 3.0.0)
|
||||
attr_required (1.0.1)
|
||||
axe-matchers (2.6.1)
|
||||
dumb_delegator (~> 0.8)
|
||||
virtus (~> 1.0)
|
||||
axe-core-api (4.2.1)
|
||||
capybara
|
||||
dumb_delegator
|
||||
selenium-webdriver
|
||||
virtus
|
||||
watir
|
||||
axe-core-rspec (4.2.1)
|
||||
axe-core-api
|
||||
dumb_delegator
|
||||
virtus
|
||||
axiom-types (0.1.1)
|
||||
descendants_tracker (~> 0.0.4)
|
||||
ice_nine (~> 0.11.0)
|
||||
|
@ -230,11 +237,10 @@ GEM
|
|||
dotenv (= 2.7.6)
|
||||
railties (>= 3.2)
|
||||
dry-inflector (0.2.0)
|
||||
dumb_delegator (0.8.1)
|
||||
dumb_delegator (1.0.0)
|
||||
ecma-re-validator (0.3.0)
|
||||
regexp_parser (~> 2.0)
|
||||
encryptor (3.0.0)
|
||||
equalizer (0.0.11)
|
||||
erubi (1.10.0)
|
||||
erubis (2.7.0)
|
||||
et-orbi (1.2.4)
|
||||
|
@ -731,13 +737,15 @@ GEM
|
|||
activemodel (>= 3.0.0)
|
||||
public_suffix
|
||||
vcr (6.0.0)
|
||||
virtus (1.0.5)
|
||||
virtus (2.0.0)
|
||||
axiom-types (~> 0.1)
|
||||
coercible (~> 1.0)
|
||||
descendants_tracker (~> 0.0, >= 0.0.3)
|
||||
equalizer (~> 0.0, >= 0.0.9)
|
||||
warden (1.2.9)
|
||||
rack (>= 2.0.9)
|
||||
watir (6.19.1)
|
||||
regexp_parser (>= 1.2, < 3)
|
||||
selenium-webdriver (>= 3.142.7)
|
||||
web-console (4.1.0)
|
||||
actionview (>= 6.0.0)
|
||||
activemodel (>= 6.0.0)
|
||||
|
@ -785,7 +793,7 @@ DEPENDENCIES
|
|||
after_party
|
||||
anchored
|
||||
annotate
|
||||
axe-matchers
|
||||
axe-core-rspec
|
||||
bcrypt
|
||||
bootsnap (>= 1.4.4)
|
||||
brakeman
|
||||
|
|
|
@ -21,7 +21,7 @@ class ApplicationController < ActionController::Base
|
|||
around_action :switch_locale
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
def feature_enabled?(feature_name)
|
||||
|
@ -309,14 +320,25 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
def switch_locale(&action)
|
||||
locale = nil
|
||||
if cookies[:locale]
|
||||
locale = cookies[:locale]
|
||||
elsif ENV.fetch('LOCALIZATION_ENABLED', 'false') == 'true'
|
||||
locale = http_accept_language.compatible_language_from(I18n.available_locales)
|
||||
else
|
||||
locale = I18n.default_locale
|
||||
end
|
||||
locale = extract_locale_from_query_params ||
|
||||
extract_locale_from_cookie ||
|
||||
extract_locale_from_accept_language_header ||
|
||||
I18n.default_locale
|
||||
|
||||
I18n.with_locale(locale, &action)
|
||||
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
|
||||
|
|
|
@ -180,7 +180,7 @@ module NewAdministrateur
|
|||
redirect_to admin_procedure_groupe_instructeurs_path(procedure)
|
||||
|
||||
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)
|
||||
|
||||
else
|
||||
|
|
|
@ -89,7 +89,7 @@ class RootController < ApplicationController
|
|||
end
|
||||
|
||||
def save_locale
|
||||
cookies[:locale] = params[:locale]
|
||||
redirect_to request.referer
|
||||
set_locale(params[:locale])
|
||||
redirect_back(fallback_location: root_path)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -82,6 +82,6 @@
|
|||
- else
|
||||
= render partial: 'shared/help/help_button'
|
||||
|
||||
- if ENV.fetch('LOCALIZATION_ENABLED', 'false') == 'true'
|
||||
- if localization_enabled?
|
||||
%li
|
||||
= render partial: 'layouts/locale_dropdown'
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
.dropdown.locale-dropdown
|
||||
%button.button.dropdown-button.icon-only.header-menu-button{ title: "Translate", 'aria-expanded' => 'false', 'aria-controls' => 'locale_menu' }
|
||||
.dropdown.locale-dropdown.header-menu-opener
|
||||
%button.button.dropdown-button.icon-only.header-menu-button{ title: "Translate", aria: { expanded: 'false', controls: 'locale_menu' } }
|
||||
.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
|
||||
%li
|
||||
= link_to save_locale_path(locale: :en), method: :post, class: "menu-item menu-link" do
|
||||
EN - English
|
||||
= link_to save_locale_path(locale: :en), method: :post, class: "menu-item menu-link" do
|
||||
EN – English
|
||||
%li
|
||||
= link_to save_locale_path(locale: :fr), method: :post, class: "menu-item menu-link" do
|
||||
FR - français
|
||||
= link_to save_locale_path(locale: :fr), method: :post, class: "menu-item menu-link" do
|
||||
FR – français
|
||||
|
|
|
@ -400,7 +400,7 @@ describe NewAdministrateur::GroupeInstructeursController, type: :controller do
|
|||
end
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
scenario 'homepage' do
|
||||
visit root_path
|
||||
expect(page).to be_accessible
|
||||
expect(page).to be_axe_clean
|
||||
end
|
||||
|
||||
scenario 'sign_up page' do
|
||||
visit new_user_registration_path
|
||||
expect(page).to be_accessible
|
||||
expect(page).to be_axe_clean
|
||||
end
|
||||
|
||||
scenario 'account confirmation page' do
|
||||
|
@ -26,23 +26,23 @@ feature 'wcag rules for usager', js: true do
|
|||
|
||||
perform_enqueued_jobs do
|
||||
click_button 'Créer un compte'
|
||||
expect(page).to be_accessible
|
||||
expect(page).to be_axe_clean
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'sign_in page' do
|
||||
visit new_user_session_path
|
||||
expect(page).to be_accessible.excluding '#user_email'
|
||||
expect(page).to be_axe_clean.excluding '#user_email'
|
||||
end
|
||||
|
||||
scenario 'contact page' do
|
||||
visit contact_path
|
||||
expect(page).to be_accessible
|
||||
expect(page).to be_axe_clean
|
||||
end
|
||||
|
||||
scenario 'commencer page' do
|
||||
visit commencer_path(path: procedure.reload.path)
|
||||
expect(page).to be_accessible
|
||||
expect(page).to be_axe_clean
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -54,7 +54,7 @@ feature 'wcag rules for usager', js: true do
|
|||
|
||||
scenario 'écran identité usager' do
|
||||
click_on 'Commencer la démarche'
|
||||
expect(page).to be_accessible
|
||||
expect(page).to be_axe_clean
|
||||
end
|
||||
|
||||
# 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')
|
||||
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
|
||||
|
||||
|
@ -80,7 +80,7 @@ feature 'wcag rules for usager', js: true do
|
|||
|
||||
scenario "écran identification de l'entreprise" do
|
||||
click_on 'Commencer la démarche'
|
||||
expect(page).to be_accessible.skipping :label
|
||||
expect(page).to be_axe_clean.skipping :label
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -92,37 +92,37 @@ feature 'wcag rules for usager', js: true do
|
|||
|
||||
scenario 'liste des dossiers' do
|
||||
visit dossiers_path
|
||||
expect(page).to be_accessible
|
||||
expect(page).to be_axe_clean
|
||||
end
|
||||
|
||||
scenario 'dossier' do
|
||||
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
|
||||
|
||||
scenario 'merci' do
|
||||
visit merci_dossier_path(dossier)
|
||||
expect(page).to be_accessible
|
||||
expect(page).to be_axe_clean
|
||||
end
|
||||
|
||||
scenario 'demande' do
|
||||
visit demande_dossier_path(dossier)
|
||||
expect(page).to be_accessible
|
||||
expect(page).to be_axe_clean
|
||||
end
|
||||
|
||||
scenario 'messagerie' do
|
||||
visit messagerie_dossier_path(dossier)
|
||||
expect(page).to be_accessible
|
||||
expect(page).to be_axe_clean
|
||||
end
|
||||
|
||||
scenario 'modifier' do
|
||||
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
|
||||
|
||||
scenario 'brouillon' do
|
||||
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
|
||||
|
|
|
@ -8,7 +8,7 @@ feature 'Accessing the website in different languages:' do
|
|||
expect(page).to have_text('Connectez-vous')
|
||||
|
||||
click_on 'Translate'
|
||||
click_on 'EN - English'
|
||||
click_on 'EN – English'
|
||||
|
||||
# The page is now in English
|
||||
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'
|
||||
# Add additional requires below this line. Rails is not loaded until this point!
|
||||
|
||||
require 'axe/rspec'
|
||||
require 'axe-rspec'
|
||||
require 'devise'
|
||||
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(:instructeur_signed_in?).and_return((profile == :instructeur))
|
||||
allow(view).to receive(:current_instructeur).and_return(current_instructeur)
|
||||
allow(view).to receive(:localization_enabled?).and_return(false)
|
||||
|
||||
if user
|
||||
sign_in user
|
||||
|
|
|
@ -5,6 +5,7 @@ describe 'layouts/procedure_context.html.haml', type: :view do
|
|||
before do
|
||||
allow(view).to receive(:instructeur_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
|
||||
|
||||
subject do
|
||||
|
|
|
@ -9361,9 +9361,9 @@ path-key@^3.0.0, path-key@^3.1.0:
|
|||
integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==
|
||||
|
||||
path-parse@^1.0.6:
|
||||
version "1.0.6"
|
||||
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c"
|
||||
integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==
|
||||
version "1.0.7"
|
||||
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735"
|
||||
integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==
|
||||
|
||||
path-to-regexp@0.1.7:
|
||||
version "0.1.7"
|
||||
|
|
Loading…
Reference in a new issue