2021-10-26 11:44:53 +02:00
|
|
|
describe 'wcag rules for usager', js: true do
|
2021-11-19 13:48:52 +01:00
|
|
|
let(:procedure) { create(:procedure, :published, :with_all_champs, :with_service, :for_individual) }
|
2020-06-26 15:55:26 +02:00
|
|
|
let(:password) { 'a very complicated password' }
|
|
|
|
let(:litteraire_user) { create(:user, password: password) }
|
|
|
|
|
2021-04-28 15:32:40 +02:00
|
|
|
before do
|
2022-11-16 12:46:33 +01:00
|
|
|
procedure.active_revision.types_de_champ_public.find { |tdc| tdc.type_champ == TypeDeChamp.type_champs.fetch(:carte) }.destroy
|
2021-04-28 15:32:40 +02:00
|
|
|
end
|
|
|
|
|
2022-11-29 15:57:32 +01:00
|
|
|
shared_examples "external links have title says it opens in a new tab" do
|
|
|
|
it do
|
|
|
|
links = page.all("a[target=_blank]")
|
|
|
|
expect(links.count).to be_positive
|
|
|
|
|
|
|
|
links.each do |link|
|
|
|
|
expect(link[:title]).to include("Nouvel onglet"), "link #{link[:href]} does not have title mentioning it opens in a new tab"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-06-26 15:55:26 +02:00
|
|
|
context 'pages without the need to be logged in' do
|
2022-11-29 15:57:32 +01:00
|
|
|
before do
|
|
|
|
visit path
|
2020-06-26 15:55:26 +02:00
|
|
|
end
|
|
|
|
|
2022-11-29 15:57:32 +01:00
|
|
|
context 'homepage' do
|
|
|
|
let(:path) { root_path }
|
|
|
|
it { expect(page).to be_axe_clean }
|
|
|
|
it_behaves_like "external links have title says it opens in a new tab"
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'sign_up page' do
|
|
|
|
let(:path) { new_user_registration_path }
|
|
|
|
it { expect(page).to be_axe_clean }
|
|
|
|
it_behaves_like "external links have title says it opens in a new tab"
|
2020-06-26 15:55:26 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
scenario 'account confirmation page' do
|
|
|
|
visit new_user_registration_path
|
|
|
|
|
|
|
|
fill_in :user_email, with: "some@email.com"
|
|
|
|
fill_in :user_password, with: "epeciusetuir"
|
|
|
|
|
|
|
|
perform_enqueued_jobs do
|
|
|
|
click_button 'Créer un compte'
|
2021-08-13 15:39:03 +02:00
|
|
|
expect(page).to be_axe_clean
|
2020-06-26 15:55:26 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2022-11-29 15:57:32 +01:00
|
|
|
context 'sign_upc confirmation' do
|
|
|
|
let(:path) { user_confirmation_path("user[email]" => "some@email.com") }
|
|
|
|
|
|
|
|
it_behaves_like "external links have title says it opens in a new tab"
|
2020-06-26 15:55:26 +02:00
|
|
|
end
|
|
|
|
|
2022-11-29 15:57:32 +01:00
|
|
|
context 'sign_in page' do
|
|
|
|
let(:path) { new_user_session_path }
|
|
|
|
it { expect(page).to be_axe_clean.excluding '#user_email' }
|
|
|
|
it_behaves_like "external links have title says it opens in a new tab"
|
2020-06-26 15:55:26 +02:00
|
|
|
end
|
|
|
|
|
2022-11-29 15:57:32 +01:00
|
|
|
context 'contact page' do
|
|
|
|
let(:path) { contact_path }
|
|
|
|
it { expect(page).to be_axe_clean }
|
|
|
|
it_behaves_like "external links have title says it opens in a new tab"
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'commencer page' do
|
|
|
|
let(:path) { commencer_path(path: procedure.path) }
|
|
|
|
it { expect(page).to be_axe_clean }
|
|
|
|
it_behaves_like "external links have title says it opens in a new tab"
|
2020-06-26 15:55:26 +02:00
|
|
|
end
|
2022-11-29 15:57:32 +01:00
|
|
|
|
2022-11-02 17:16:25 +01:00
|
|
|
scenario 'commencer page, help dropdown' do
|
|
|
|
visit commencer_path(path: procedure.reload.path)
|
|
|
|
|
|
|
|
page.find("#help-menu_button").click
|
|
|
|
expect(page).to be_axe_clean
|
|
|
|
end
|
2020-06-26 15:55:26 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
context "logged in, depot d'un dossier as individual" do
|
|
|
|
before do
|
|
|
|
login_as litteraire_user, scope: :user
|
|
|
|
visit commencer_path(path: procedure.reload.path)
|
|
|
|
end
|
|
|
|
|
|
|
|
scenario 'écran identité usager' do
|
|
|
|
click_on 'Commencer la démarche'
|
2021-08-13 15:39:03 +02:00
|
|
|
expect(page).to be_axe_clean
|
2020-06-26 15:55:26 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
# with no surprise, there's a lot of work on this one
|
|
|
|
scenario "dépot d'un dossier" do
|
|
|
|
click_on 'Commencer la démarche'
|
|
|
|
|
2020-12-08 17:43:50 +01:00
|
|
|
choose 'Monsieur'
|
2020-06-26 15:55:26 +02:00
|
|
|
fill_in('individual_prenom', with: 'prenom')
|
|
|
|
fill_in('individual_nom', with: 'nom')
|
|
|
|
click_on 'Continuer'
|
|
|
|
|
2022-10-06 10:32:38 +02:00
|
|
|
expect(page).to be_axe_clean
|
2020-06-26 15:55:26 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context "logged in, depot d'un dossier entreprise" do
|
|
|
|
let(:procedure) { create(:procedure, :with_type_de_champ, :with_all_champs, :with_service, :published) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
login_as litteraire_user, scope: :user
|
|
|
|
visit commencer_path(path: procedure.reload.path)
|
|
|
|
end
|
|
|
|
|
|
|
|
scenario "écran identification de l'entreprise" do
|
|
|
|
click_on 'Commencer la démarche'
|
2022-10-06 10:32:38 +02:00
|
|
|
expect(page).to be_axe_clean
|
2020-06-26 15:55:26 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2022-10-06 10:32:38 +02:00
|
|
|
context "logged in, avec des dossiers déposés" do
|
2020-06-26 15:55:26 +02:00
|
|
|
let(:dossier) { create(:dossier, procedure: procedure, user: litteraire_user) }
|
|
|
|
before do
|
|
|
|
login_as litteraire_user, scope: :user
|
|
|
|
end
|
|
|
|
|
2022-10-06 10:32:38 +02:00
|
|
|
scenario 'liste des dossiers sans dossiers' do
|
2020-06-26 15:55:26 +02:00
|
|
|
visit dossiers_path
|
2021-08-13 15:39:03 +02:00
|
|
|
expect(page).to be_axe_clean
|
2020-06-26 15:55:26 +02:00
|
|
|
end
|
|
|
|
|
2022-10-06 10:33:39 +02:00
|
|
|
scenario 'liste des dossiers avec des dossiers' do
|
|
|
|
dossier
|
|
|
|
visit dossiers_path
|
|
|
|
expect(page).to be_axe_clean
|
|
|
|
end
|
|
|
|
|
2022-10-06 10:34:08 +02:00
|
|
|
scenario 'liste des dossiers et actions sur le dossier' do
|
|
|
|
dossier
|
|
|
|
visit dossiers_path
|
|
|
|
page.find("#actions_menu_dossier_#{dossier.id}_button").click
|
|
|
|
expect(page).to be_axe_clean
|
|
|
|
end
|
|
|
|
|
2020-06-26 15:55:26 +02:00
|
|
|
scenario 'dossier' do
|
|
|
|
visit dossier_path(dossier)
|
2022-10-06 10:32:38 +02:00
|
|
|
expect(page).to be_axe_clean
|
2020-06-26 15:55:26 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
scenario 'merci' do
|
|
|
|
visit merci_dossier_path(dossier)
|
2021-08-13 15:39:03 +02:00
|
|
|
expect(page).to be_axe_clean
|
2020-06-26 15:55:26 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
scenario 'demande' do
|
|
|
|
visit demande_dossier_path(dossier)
|
2021-08-13 15:39:03 +02:00
|
|
|
expect(page).to be_axe_clean
|
2020-06-26 15:55:26 +02:00
|
|
|
end
|
|
|
|
|
2022-10-06 10:32:38 +02:00
|
|
|
scenario 'messagerie avec des messages' do
|
|
|
|
create(:commentaire, dossier: dossier, instructeur: procedure.instructeurs.first, body: 'hello')
|
|
|
|
create(:commentaire, dossier: dossier, email: dossier.user.email, body: 'hello')
|
2020-06-26 15:55:26 +02:00
|
|
|
visit messagerie_dossier_path(dossier)
|
2021-08-13 15:39:03 +02:00
|
|
|
expect(page).to be_axe_clean
|
2020-06-26 15:55:26 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
scenario 'modifier' do
|
|
|
|
visit modifier_dossier_path(dossier)
|
2022-10-06 10:32:38 +02:00
|
|
|
expect(page).to be_axe_clean
|
2020-06-26 15:55:26 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
scenario 'brouillon' do
|
|
|
|
visit brouillon_dossier_path(dossier)
|
2022-10-06 10:32:38 +02:00
|
|
|
expect(page).to be_axe_clean
|
2020-06-26 15:55:26 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|