From be55bba55315540bee01349d191baaf5eab43054 Mon Sep 17 00:00:00 2001 From: Kara Diaby Date: Tue, 5 Sep 2023 12:42:56 +0000 Subject: [PATCH] tests --- app/views/users/dossiers/identite.html.haml | 8 +++---- spec/system/accessibilite/wcag_usager_spec.rb | 6 ++--- .../api_particulier/api_particulier_spec.rb | 24 +++++++++---------- .../routing/rules_full_scenario_spec.rb | 6 ++--- spec/system/users/brouillon_spec.rb | 7 +++--- spec/system/users/dossier_creation_spec.rb | 8 +++---- spec/system/users/dropdown_spec.rb | 6 ++--- spec/system/users/linked_dropdown_spec.rb | 6 ++--- 8 files changed, 35 insertions(+), 36 deletions(-) diff --git a/app/views/users/dossiers/identite.html.haml b/app/views/users/dossiers/identite.html.haml index c33a55184..9a2ceb993 100644 --- a/app/views/users/dossiers/identite.html.haml +++ b/app/views/users/dossiers/identite.html.haml @@ -15,13 +15,13 @@ = f.label :gender, t('activerecord.attributes.individual.gender') .fr-fieldset__element.fr-fieldset__element--inline .fr-radio-group - = f.radio_button :gender, Individual::GENDER_FEMALE, required: true, id: "#identite_champ_radio_#{Individual::GENDER_FEMALE}" - %label.fr-label{ for: "#identite_champ_radio_#{Individual::GENDER_FEMALE}" } + = f.radio_button :gender, Individual::GENDER_FEMALE, required: true, id: "identite_champ_radio_#{Individual::GENDER_FEMALE}" + %label.fr-label{ for: "identite_champ_radio_#{Individual::GENDER_FEMALE}" } = Individual.human_attribute_name('gender.female') .fr-fieldset__element.fr-fieldset__element--inline .fr-radio-group - = f.radio_button :gender, Individual::GENDER_MALE, required: true, id: "#identite_champ_radio_#{Individual::GENDER_MALE}" - %label.fr-label{ for: "#identite_champ_radio_#{Individual::GENDER_MALE}" } + = f.radio_button :gender, Individual::GENDER_MALE, required: true, id: "identite_champ_radio_#{Individual::GENDER_MALE}" + %label.fr-label{ for: "identite_champ_radio_#{Individual::GENDER_MALE}" } = Individual.human_attribute_name('gender.male') .flex diff --git a/spec/system/accessibilite/wcag_usager_spec.rb b/spec/system/accessibilite/wcag_usager_spec.rb index 60bf381b3..40ab9e9da 100644 --- a/spec/system/accessibilite/wcag_usager_spec.rb +++ b/spec/system/accessibilite/wcag_usager_spec.rb @@ -109,9 +109,9 @@ describe 'wcag rules for usager', js: true, retry: 3 do scenario "dépot d'un dossier" do click_on 'Commencer la démarche' - choose 'Monsieur' - fill_in('individual_prenom', with: 'prenom') - fill_in('individual_nom', with: 'nom') + find('label', text: 'Monsieur') + fill_in('identite_champ_first_name', with: 'prenom') + fill_in('identite_champ_last_name', with: 'nom') click_on 'Continuer' expect(page).to be_axe_clean diff --git a/spec/system/api_particulier/api_particulier_spec.rb b/spec/system/api_particulier/api_particulier_spec.rb index e28ee41e1..d72ca120c 100644 --- a/spec/system/api_particulier/api_particulier_spec.rb +++ b/spec/system/api_particulier/api_particulier_spec.rb @@ -266,9 +266,9 @@ describe 'fetch API Particulier Data', js: true, retry: 3 do visit commencer_path(path: procedure.path) click_on 'Commencer la démarche' - choose 'Monsieur' - fill_in 'individual_nom', with: 'Nom' - fill_in 'individual_prenom', with: 'Prenom' + find('label', text: 'Monsieur').click + fill_in('identite_champ_first_name', with: 'prenom') + fill_in('identite_champ_last_name', with: 'nom') click_button('Continuer') @@ -325,9 +325,9 @@ describe 'fetch API Particulier Data', js: true, retry: 3 do visit commencer_path(path: procedure.path) click_on 'Commencer la démarche' - choose 'Monsieur' - fill_in 'individual_nom', with: 'Moustaki' - fill_in 'individual_prenom', with: 'Georges' + find('label', text: 'Monsieur').click + fill_in('identite_champ_first_name', with: 'Georges') + fill_in('identite_champ_last_name', with: 'Moustaki') click_button('Continuer') @@ -399,9 +399,9 @@ describe 'fetch API Particulier Data', js: true, retry: 3 do visit commencer_path(path: procedure.path) click_on 'Commencer la démarche' - choose 'Madame' - fill_in 'individual_nom', with: 'Dubois' - fill_in 'individual_prenom', with: 'Angela Claire Louise' + find('label[for="identite_champ_radio_Mme"]').click + fill_in('identite_champ_last_name', with: 'Dubois') + fill_in('identite_champ_first_name', with: 'Angela Claire Louise') click_button('Continuer') @@ -463,9 +463,9 @@ describe 'fetch API Particulier Data', js: true, retry: 3 do visit commencer_path(path: procedure.path) click_on 'Commencer la démarche' - choose 'Madame' - fill_in 'individual_nom', with: 'FERRI' - fill_in 'individual_prenom', with: 'Karine' + find('label[for="identite_champ_radio_Mme"]').click + fill_in('identite_champ_last_name', with: 'FERRI') + fill_in('identite_champ_first_name', with: 'Karine') click_button('Continuer') diff --git a/spec/system/routing/rules_full_scenario_spec.rb b/spec/system/routing/rules_full_scenario_spec.rb index 5e5de94a1..ba82b59e2 100644 --- a/spec/system/routing/rules_full_scenario_spec.rb +++ b/spec/system/routing/rules_full_scenario_spec.rb @@ -262,9 +262,9 @@ describe 'The routing with rules', js: true, retry: 3 do visit commencer_path(path: procedure.reload.path) click_on 'Commencer la démarche' - choose 'Monsieur' - fill_in 'individual_nom', with: 'Nom' - fill_in 'individual_prenom', with: 'Prenom' + find('label', text: 'Monsieur').click + fill_in('identite_champ_first_name', with: 'Prenom') + fill_in('identite_champ_last_name', with: 'Nom') click_button('Continuer') # the old system should not be present diff --git a/spec/system/users/brouillon_spec.rb b/spec/system/users/brouillon_spec.rb index ec315533e..2493e2663 100644 --- a/spec/system/users/brouillon_spec.rb +++ b/spec/system/users/brouillon_spec.rb @@ -10,7 +10,6 @@ describe 'The user' do log_in(user, procedure) fill_individual - # fill data fill_in('text', with: 'super texte', match: :first) fill_in('textarea', with: 'super textarea') @@ -22,7 +21,7 @@ describe 'The user' do fill_in('integer_number', with: '12') scroll_to(find_field('checkbox'), align: :center) find('label', text: 'checkbox').click - choose('Madame') + find('label', text: 'Madame').click fill_in('email', with: 'loulou@yopmail.com') fill_in('phone', with: '0123456789') scroll_to(find_field('Non'), align: :center) @@ -556,8 +555,8 @@ describe 'The user' do def fill_individual find('label', text: 'Monsieur').click - fill_in('individual_prenom', with: 'prenom') - fill_in('individual_nom', with: 'nom') + fill_in('identite_champ_first_name', with: 'prenom') + fill_in('identite_champ_last_name', with: 'nom') click_on 'Continuer' expect(page).to have_current_path(brouillon_dossier_path(user_dossier)) end diff --git a/spec/system/users/dossier_creation_spec.rb b/spec/system/users/dossier_creation_spec.rb index 8eac81cd0..0c05d9e83 100644 --- a/spec/system/users/dossier_creation_spec.rb +++ b/spec/system/users/dossier_creation_spec.rb @@ -21,9 +21,9 @@ describe 'Creating a new dossier:' do expect(page).to have_current_path identite_dossier_path(user.reload.dossiers.last) expect(page).to have_title(libelle) - choose 'Monsieur' - fill_in 'individual_nom', with: 'Nom' - fill_in 'individual_prenom', with: 'Prenom' + find('label', text: 'Monsieur').click + fill_in('identite_champ_first_name', with: 'Prenom') + fill_in('identite_champ_last_name', with: 'Nom') end shared_examples 'the user can create a new draft' do @@ -41,7 +41,7 @@ describe 'Creating a new dossier:' do let(:expected_birthday) { Date.new(1987, 10, 14) } before do - fill_in 'individual_birthdate', with: birthday_format + fill_in 'identite_champ_birthdate', with: birthday_format end context 'when the browser supports `type=date` input fields' do diff --git a/spec/system/users/dropdown_spec.rb b/spec/system/users/dropdown_spec.rb index 733d22e37..a0384161a 100644 --- a/spec/system/users/dropdown_spec.rb +++ b/spec/system/users/dropdown_spec.rb @@ -74,9 +74,9 @@ describe 'dropdown list with other option activated', js: true, retry: 3 do private def fill_individual - choose 'Monsieur' - fill_in('individual_prenom', with: 'prenom') - fill_in('individual_nom', with: 'nom') + find('label', text: 'Monsieur').click + fill_in('identite_champ_first_name', with: 'prenom') + fill_in('identite_champ_last_name', with: 'nom') click_on 'Continuer' expect(page).to have_current_path(brouillon_dossier_path(user_dossier)) end diff --git a/spec/system/users/linked_dropdown_spec.rb b/spec/system/users/linked_dropdown_spec.rb index d573aca21..b66875af5 100644 --- a/spec/system/users/linked_dropdown_spec.rb +++ b/spec/system/users/linked_dropdown_spec.rb @@ -80,9 +80,9 @@ describe 'linked dropdown lists' do end def fill_individual - choose 'Monsieur' - fill_in('individual_prenom', with: 'prenom') - fill_in('individual_nom', with: 'nom') + find('label', text: 'Monsieur').click + fill_in('identite_champ_first_name', with: 'prenom') + fill_in('identite_champ_last_name', with: 'nom') click_on 'Continuer' expect(page).to have_current_path(brouillon_dossier_path(user_dossier)) end