From 0d45b06ffb43fa395092f7f93eb9280090d475d3 Mon Sep 17 00:00:00 2001 From: JC Date: Tue, 27 Dec 2016 17:29:14 +0100 Subject: [PATCH 1/7] Changing click for tigger(click) --- .../features/admin/procedure_creation_spec.rb | 14 ++++----- .../backoffice/index_show_procedure_spec.rb | 19 ++++++------ spec/features/users/dossier_creation_spec.rb | 14 ++++----- spec/features/users/dossier_edition_spec.rb | 30 +++++++++---------- spec/features/users/dossier_index_spec.rb | 16 +++++----- 5 files changed, 46 insertions(+), 47 deletions(-) diff --git a/spec/features/admin/procedure_creation_spec.rb b/spec/features/admin/procedure_creation_spec.rb index 49f033bc0..00558ab56 100644 --- a/spec/features/admin/procedure_creation_spec.rb +++ b/spec/features/admin/procedure_creation_spec.rb @@ -12,17 +12,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 scenario 'Finding draft procedures' do - page.find_by_id('draft-procedures').click + page.find_by_id('draft-procedures').trigger('click') expect(page).to have_current_path(admin_procedures_draft_path, only_path: true) end scenario 'Finding active procedures' do - page.find_by_id('active-procedures').click + page.find_by_id('active-procedures').trigger('click') expect(page).to have_current_path(admin_procedures_path, only_path: true) end scenario 'Finding archived procedures' do - page.find_by_id('archived-procedures').click + page.find_by_id('archived-procedures').trigger('click') expect(page).to have_current_path(admin_procedures_archived_path, only_path: true) end end @@ -60,13 +60,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') expect(Procedure.first.types_de_champ.first.libelle).to eq('libelle de champ') - page.find_by_id('onglet-pieces').click + page.find_by_id('onglet-pieces').trigger('click') 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('add_piece_justificative').click page.find_by_id('procedure_types_de_piece_justificative_attributes_1_libelle') - page.find_by_id('onglet-preview').click + page.find_by_id('onglet-preview').trigger('click') expect(page).to have_current_path(admin_procedure_previsualisation_path(Procedure.first.id.to_s)) expect(page.find_by_id('champs_1')['placeholder']).to eq('libelle de champ') expect(page.first('.piece-libelle').text).to eq('libelle de piece') @@ -75,11 +75,11 @@ 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 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('onglet-pieces').click + page.find_by_id('onglet-pieces').trigger('click') 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('onglet-infos').click + page.find_by_id('onglet-infos').trigger('click') 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') diff --git a/spec/features/backoffice/index_show_procedure_spec.rb b/spec/features/backoffice/index_show_procedure_spec.rb index 6550cb2e4..1e8a0ec14 100644 --- a/spec/features/backoffice/index_show_procedure_spec.rb +++ b/spec/features/backoffice/index_show_procedure_spec.rb @@ -23,29 +23,28 @@ feature 'As an Accompagnateur I can navigate and use each functionnality around context 'On index' do scenario 'Switching between procedures' do - page.all('#procedure_list a').first.click + page.all('#procedure_list a').first.trigger('click') expect(page).to have_current_path(backoffice_dossiers_procedure_path(id: procedure_1.id.to_s), only_path: true) expect(page.find('#all_dossiers .count').text).to eq('20 dossiers') - page.all('#procedure_list a').last.click + page.all('#procedure_list a').last.trigger('click') expect(page).to have_current_path(backoffice_dossiers_procedure_path(id: procedure_2.id.to_s), only_path: true) expect(page.find('#all_dossiers .count').text).to eq('15 dossiers') - #save_and_open_page end scenario 'Searching with search bar' do page.find_by_id('search_area').trigger('click') fill_in 'q', with: '15' - page.find_by_id('search_button').click - page.find_by_id('tr_dossier_15').click + page.find_by_id('search_button').trigger('click') + page.find_by_id('tr_dossier_15').trigger('click') expect(page).to have_current_path("/backoffice/dossiers/15") end scenario 'Following dossier' do - page.all('#procedure_list a').first.click + page.all('#procedure_list a').first.trigger('click') expect(page.all('#follow_dossiers .smart-listing')[0]['data-item-count']).to eq ("0") - page.find_by_id('all_dossiers').click + page.find_by_id('all_dossiers').trigger('click') expect(page.all('#dossiers_list a').first.text).to eq('Suivre') - page.all('#dossiers_list a').first.click + page.all('#dossiers_list a').first.trigger('click') expect(page.all('#follow_dossiers .smart-listing')[0]['data-item-count']).to eq ("1") end @@ -91,9 +90,9 @@ feature 'As an Accompagnateur I can navigate and use each functionnality around scenario 'Adding message' do page.find_by_id('tr_dossier_4').trigger('click') expect(page).to have_current_path(backoffice_dossier_path(4), only_path: true) - page.find_by_id('open-message').click + page.find_by_id('open-message').trigger('click') page.execute_script("$('#texte_commentaire').data('wysihtml5').editor.setValue('Contenu du nouveau message')") - page.find_by_id('save-message').click + page.find_by_id('save-message').trigger('click') expect(page.find('.last-commentaire .content').text).to eq('Contenu du nouveau message') end end diff --git a/spec/features/users/dossier_creation_spec.rb b/spec/features/users/dossier_creation_spec.rb index cf8a5aa42..3d19d4118 100644 --- a/spec/features/users/dossier_creation_spec.rb +++ b/spec/features/users/dossier_creation_spec.rb @@ -17,11 +17,11 @@ feature 'As a User I wanna create a dossier', js: true do fill_in 'dossier_individual_attributes_prenom', with: 'Prenom' fill_in 'dossier_individual_attributes_birthdate', with: '14/10/1987' find(:css, "#dossier_autorisation_donnees[value='1']").set(true) - page.find_by_id('etape_suivante').click + page.find_by_id('etape_suivante').trigger('click') expect(page).to have_current_path(users_dossier_carte_path(Dossier.first.id.to_s), only_path: true) - page.find_by_id('etape_suivante').click + page.find_by_id('etape_suivante').trigger('click') fill_in 'champs_1', with: 'contenu du champ 1' - page.find_by_id('suivant').click + page.find_by_id('suivant').trigger('click') expect(page).to have_current_path(users_dossier_recapitulatif_path(Dossier.first.id.to_s), only_path: true) end @@ -39,14 +39,14 @@ feature 'As a User I wanna create a dossier', js: true do stub_request(:get, "https://api-dev.apientreprise.fr/v1/associations/#{siret}?token=#{SIADETOKEN}") .to_return(status: 404, body: '') page.find_by_id('dossier_siret').set siret - page.find_by_id('submit-siret').click + page.find_by_id('submit-siret').trigger('click') expect(page).to have_css('#recap_info_entreprise') find(:css, "#dossier_autorisation_donnees[value='1']").set(true) - page.find_by_id('etape_suivante').click + page.find_by_id('etape_suivante').trigger('click') expect(page).to have_current_path(users_dossier_carte_path(Dossier.first.id.to_s), only_path: true) - page.find_by_id('etape_suivante').click + page.find_by_id('etape_suivante').trigger('click') fill_in 'champs_1', with: 'contenu du champ 1' - page.find_by_id('suivant').click + page.find_by_id('suivant').trigger('click') expect(page).to have_current_path(users_dossier_recapitulatif_path(Dossier.first.id.to_s), only_path: true) end end diff --git a/spec/features/users/dossier_edition_spec.rb b/spec/features/users/dossier_edition_spec.rb index 9a81a8ae7..27ee4c077 100644 --- a/spec/features/users/dossier_edition_spec.rb +++ b/spec/features/users/dossier_edition_spec.rb @@ -12,9 +12,9 @@ feature 'As a User I want to edit a dossier I own', js: true do fill_in 'dossier_individual_attributes_prenom', with: 'Prenom' fill_in 'dossier_individual_attributes_birthdate', with: '14/10/1987' find(:css, "#dossier_autorisation_donnees[value='1']").set(true) - page.find_by_id('etape_suivante').click - page.find_by_id('etape_suivante').click - page.find_by_id('suivant').click + page.find_by_id('etape_suivante').trigger('click') + page.find_by_id('etape_suivante').trigger('click') + page.find_by_id('suivant').trigger('click') visit root_path end @@ -22,29 +22,29 @@ feature 'As a User I want to edit a dossier I own', js: true do scenario 'After sign_in, I can see dossiers "à traiter" (default), and other indexes' do expect(page.find('#a_traiter')['class'] ).to eq('active procedure_list_element') - page.find_by_id('brouillon').click - page.find_by_id('a_traiter').click - page.find_by_id('valides').click - page.find_by_id('en_instruction').click - page.find_by_id('termine').click - page.find_by_id('invite').click + page.find_by_id('brouillon').trigger('click') + page.find_by_id('a_traiter').trigger('click') + page.find_by_id('valides').trigger('click') + page.find_by_id('en_instruction').trigger('click') + page.find_by_id('termine').trigger('click') + page.find_by_id('invite').trigger('click') end scenario 'Getting a dossier, I want to create a new message on' do - page.find_by_id('tr_dossier_' + Dossier.last.id.to_s).click + page.find_by_id('tr_dossier_' + Dossier.last.id.to_s).trigger('click') expect(page).to have_current_path(users_dossier_recapitulatif_path(Dossier.first.id.to_s), only_path: true) - page.find_by_id('open-message').click + page.find_by_id('open-message').trigger('click') page.execute_script("$('#texte_commentaire').data('wysihtml5').editor.setValue('Contenu du nouveau message')") - page.find_by_id('save-message').click + page.find_by_id('save-message').trigger('click') expect(page.find('.last-commentaire .content').text).to eq('Contenu du nouveau message') end scenario 'On the same dossier, I want to edit informations' do - page.find_by_id('tr_dossier_' + Dossier.last.id.to_s).click - page.find_by_id('edit-dossier').click + page.find_by_id('tr_dossier_' + Dossier.last.id.to_s).trigger('click') + page.find_by_id('edit-dossier').trigger('click') expect(page).to have_current_path(users_dossier_description_path(Dossier.first.id.to_s), only_path: true) fill_in 'champs_1', with: 'Contenu du champ 1' - page.find_by_id('modification_terminee').click + page.find_by_id('modification_terminee').trigger('click') expect(page).to have_current_path(users_dossier_recapitulatif_path(Dossier.first.id.to_s), only_path: true) expect(page.find('#champ-1-value').text).to eq('Contenu du champ 1') end diff --git a/spec/features/users/dossier_index_spec.rb b/spec/features/users/dossier_index_spec.rb index b2ee2b601..98dba283e 100644 --- a/spec/features/users/dossier_index_spec.rb +++ b/spec/features/users/dossier_index_spec.rb @@ -12,8 +12,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_birthdate', with: '14/10/1987' find(:css, "#dossier_autorisation_donnees[value='1']").set(true) - page.find_by_id('etape_suivante').click - page.find_by_id('suivant').click + page.find_by_id('etape_suivante').trigger('click') + page.find_by_id('suivant').trigger('click') 50.times do Dossier.create(procedure_id: 1, user_id: 1, state: "initiated") end @@ -23,7 +23,7 @@ feature 'As a User I want to sort and paginate dossiers', js: true do context 'After sign_in, I can see my 51 dossiers on the index' do scenario 'Using sort' do - expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq('1') + expect(page.all(:css, '#dossiers_list tr')[0].text.split(" ").first).to eq('1') expect(page.all(:css, '#dossiers_list tr')[2].text.split(" ").first).to eq('2') visit "/users/dossiers?dossiers_smart_listing[sort][id]=desc" expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq('51') @@ -34,16 +34,16 @@ feature 'As a User I want to sort and paginate dossiers', js: true do end scenario 'Using pagination' do - expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq('1') - page.find('.next_page a').click + expect(page.all(:css, '#dossiers_list tr')[0].text.split(" ").first).to eq('1') + page.find('.next_page a').trigger('click') wait_for_ajax expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq('8') - page.find('.next_page a').click + page.find('.next_page a').trigger('click') wait_for_ajax expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq('15') - page.find('.prev a').click + page.find('.prev a').trigger('click') wait_for_ajax - page.find('.prev a').click + page.find('.prev a').trigger('click') wait_for_ajax expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq('1') end From 6dd4736f9d7f9391e317afe5620814a625c1c76c Mon Sep 17 00:00:00 2001 From: JC Date: Wed, 28 Dec 2016 11:55:39 +0100 Subject: [PATCH 2/7] Margin credentials and champs in dossier show --- app/assets/stylesheets/dossier_show.scss | 3 +++ app/views/dossiers/_infos_dossier.html.haml | 1 + 2 files changed, 4 insertions(+) diff --git a/app/assets/stylesheets/dossier_show.scss b/app/assets/stylesheets/dossier_show.scss index 54d6e14b4..3d9c6ba98 100644 --- a/app/assets/stylesheets/dossier_show.scss +++ b/app/assets/stylesheets/dossier_show.scss @@ -180,6 +180,9 @@ .margin-top-40 { margin-top: 40px; } + .margin-top-20 { + margin-top: 20px; + } .margin-bot-40 { margin-bottom: 40px; } diff --git a/app/views/dossiers/_infos_dossier.html.haml b/app/views/dossiers/_infos_dossier.html.haml index 27c773a7f..a7f5c8a09 100644 --- a/app/views/dossiers/_infos_dossier.html.haml +++ b/app/views/dossiers/_infos_dossier.html.haml @@ -22,6 +22,7 @@ %div.col-md-6.col-sm-6.col-xs-6.col-lg-6.depositaire-label Date de naissance %div.col-md-1.col-lg-1.col-sm-1.col-xs-1.comments-off= "-" %div.col-md-5.col-sm-5.col-xs-5.col-lg-5.depositaire-info= @facade.individual.birthdate + .row.margin-top-20 - unless @facade.champs.nil? - @facade.champs.each do |champ| From 9e88a0d88966790425d4989d13672e2d8c307805 Mon Sep 17 00:00:00 2001 From: JC Date: Wed, 28 Dec 2016 12:06:37 +0100 Subject: [PATCH 3/7] Display action renseigner un siret when not gestionnaire logged and dossier in states draft, replied, initiated --- app/views/dossiers/_dossier_show.html.haml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/views/dossiers/_dossier_show.html.haml b/app/views/dossiers/_dossier_show.html.haml index 87ce9c61d..0b0174e69 100644 --- a/app/views/dossiers/_dossier_show.html.haml +++ b/app/views/dossiers/_dossier_show.html.haml @@ -56,9 +56,10 @@ %div.col-lg-8.col-md-8.col-sm-8.col-xs-8.title-no-expanse %div.carret-right INFORMATIONS ENTREPRISE / ASSOCIATION - %a#add_siret.action{href: users_dossier_add_siret_path(dossier_id: @facade.dossier.id)} - %div.col-lg-4.col-md-4.col-sm-4.col-xs-4.action - = "Renseigner un SIRET" + - if !@current_gestionnaire && ["draft", "replied", "initiated"].include?(@facade.dossier.state) + %a#add_siret.action{href: users_dossier_add_siret_path(dossier_id: @facade.dossier.id)} + %div.col-lg-4.col-md-4.col-sm-4.col-xs-4.action + = "Renseigner un SIRET" - unless @facade.entreprise.nil? .default_data_block From 77e30e233c3ee11b480f781a3848e648807c5a8b Mon Sep 17 00:00:00 2001 From: JC Date: Wed, 28 Dec 2016 12:10:27 +0100 Subject: [PATCH 4/7] margin action block in left pannel --- app/assets/stylesheets/left_pannel.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/stylesheets/left_pannel.scss b/app/assets/stylesheets/left_pannel.scss index 08aadf3a1..a3d8fd7d7 100644 --- a/app/assets/stylesheets/left_pannel.scss +++ b/app/assets/stylesheets/left_pannel.scss @@ -34,7 +34,7 @@ } } #action-block { - margin-right: 10px; + margin: 10px; .action { background-color: #E45B51; text-align: center; From aa2d2ad9246cf17d47d4dfd8f7368ddbcaed3e1b Mon Sep 17 00:00:00 2001 From: JC Date: Wed, 28 Dec 2016 12:20:34 +0100 Subject: [PATCH 5/7] No notification message, when gestionnaire on index --- app/assets/stylesheets/left_pannel.scss | 3 +++ app/views/dossiers/_dossier_show.html.haml | 2 +- ..._backoffice_dossierscontroller_index.html.haml | 15 +++++++++------ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/app/assets/stylesheets/left_pannel.scss b/app/assets/stylesheets/left_pannel.scss index a3d8fd7d7..c4fd4d485 100644 --- a/app/assets/stylesheets/left_pannel.scss +++ b/app/assets/stylesheets/left_pannel.scss @@ -115,6 +115,9 @@ margin-right: auto; } #notifications_list { + .no-notification { + margin: 0 30px 0 30px; + } .notification { padding: 10px 10px 10px 20px; .dossier, .updated-at { diff --git a/app/views/dossiers/_dossier_show.html.haml b/app/views/dossiers/_dossier_show.html.haml index 0b0174e69..8e7f6f874 100644 --- a/app/views/dossiers/_dossier_show.html.haml +++ b/app/views/dossiers/_dossier_show.html.haml @@ -56,7 +56,7 @@ %div.col-lg-8.col-md-8.col-sm-8.col-xs-8.title-no-expanse %div.carret-right INFORMATIONS ENTREPRISE / ASSOCIATION - - if !@current_gestionnaire && ["draft", "replied", "initiated"].include?(@facade.dossier.state) + - if !@current_gestionnaire && ["draft", "updated", "replied", "initiated"].include?(@facade.dossier.state) %a#add_siret.action{href: users_dossier_add_siret_path(dossier_id: @facade.dossier.id)} %div.col-lg-4.col-md-4.col-sm-4.col-xs-4.action = "Renseigner un SIRET" diff --git a/app/views/layouts/left_panels/_left_panel_backoffice_dossierscontroller_index.html.haml b/app/views/layouts/left_panels/_left_panel_backoffice_dossierscontroller_index.html.haml index e715a6ae6..00dce4f8b 100644 --- a/app/views/layouts/left_panels/_left_panel_backoffice_dossierscontroller_index.html.haml +++ b/app/views/layouts/left_panels/_left_panel_backoffice_dossierscontroller_index.html.haml @@ -29,9 +29,12 @@ .badge.progress-bar-warning{title: 'Notifications'} = procedure[:unread_notifications] #notifications_list.hidden - - @facade_data_view.unread_notifications.each do |notification| - = link_to backoffice_dossier_path(notification.dossier.id) do - .notification - .dossier= notification.decorate.index_display[:dossier] - .updated-at= notification.decorate.index_display[:date] - .type= notification.decorate.index_display[:type] + - if @facade_data_view.unread_notifications.empty? + .no-notification= "Aucune notification pour le moment." + - else + - @facade_data_view.unread_notifications.each do |notification| + = link_to backoffice_dossier_path(notification.dossier.id) do + .notification + .dossier= notification.decorate.index_display[:dossier] + .updated-at= notification.decorate.index_display[:date] + .type= notification.decorate.index_display[:type] From 39bab7ac6fe91cc91f7e21c555ff7bfb18951372 Mon Sep 17 00:00:00 2001 From: Xavier J Date: Mon, 2 Jan 2017 09:34:28 +0100 Subject: [PATCH 6/7] =?UTF-8?q?Changer=20render=20=E2=80=98show=E2=80=99?= =?UTF-8?q?=20for=20redirect=5Fto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users/recapitulatif_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/users/recapitulatif_controller.rb b/app/controllers/users/recapitulatif_controller.rb index 6e06c41ed..4a63ed4c9 100644 --- a/app/controllers/users/recapitulatif_controller.rb +++ b/app/controllers/users/recapitulatif_controller.rb @@ -14,7 +14,7 @@ class Users::RecapitulatifController < UsersController @facade.dossier.next_step! 'user', 'initiate' flash.notice = 'Dossier soumis avec succès.' - render 'show' + redirect_to users_dossier_recapitulatif_path end def submit @@ -23,7 +23,7 @@ class Users::RecapitulatifController < UsersController @facade.dossier.submit! flash.notice = 'Dossier déposé avec succès.' - render 'show' + redirect_to users_dossier_recapitulatif_path end def self.route_authorization From 2bf0cc907b0c7be52c9522e884f1870db734fe34 Mon Sep 17 00:00:00 2001 From: Xavier J Date: Mon, 2 Jan 2017 09:38:49 +0100 Subject: [PATCH 7/7] Add alert for bad connexion with unified connexion --- app/controllers/users/sessions_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/users/sessions_controller.rb b/app/controllers/users/sessions_controller.rb index ebe89f7d0..e5348695f 100644 --- a/app/controllers/users/sessions_controller.rb +++ b/app/controllers/users/sessions_controller.rb @@ -37,6 +37,7 @@ class Users::SessionsController < Sessions::SessionsController elsif administrateur_signed_in? redirect_to admin_path else + flash.alert = 'Mauvais couple login / mot de passe' new render :new, status: 401 end