diff --git a/app/views/new_administrateur/procedures/show.html.haml b/app/views/new_administrateur/procedures/show.html.haml index 1614d180f..d0aa14694 100644 --- a/app/views/new_administrateur/procedures/show.html.haml +++ b/app/views/new_administrateur/procedures/show.html.haml @@ -4,7 +4,7 @@ metadatas: ["Créée le #{@procedure.created_at.strftime('%d/%m/%Y')} - n° #{@procedure.id}", "#{@procedure.close? ? "Close le #{@procedure.closed_at.strftime('%d/%m/%Y')}" : @procedure.locked? ? "Publiée - #{procedure_lien(@procedure)}" : "Brouillon"}"] } .container.procedure-admin-container - = link_to apercu_admin_procedure_path(@procedure), class: 'button', id: "preview-procedure" do + = link_to apercu_admin_procedure_path(@procedure), target: "_blank", rel: "noopener", class: 'button', id: "preview-procedure" do %span.icon.preview Prévisualiser diff --git a/spec/features/admin/procedure_creation_spec.rb b/spec/features/admin/procedure_creation_spec.rb index 5ef45a31b..8208246f2 100644 --- a/spec/features/admin/procedure_creation_spec.rb +++ b/spec/features/admin/procedure_creation_spec.rb @@ -77,10 +77,11 @@ feature 'As an administrateur I wanna create a new procedure', js: true do click_on Procedure.last.libelle - find('#preview-procedure').click - - expect(page).to have_current_path(apercu_admin_procedure_path(Procedure.last)) - expect(page).to have_field('libelle de champ') + preview_window = window_opened_by { find('#preview-procedure').click } + within_window(preview_window) do + expect(page).to have_current_path(apercu_admin_procedure_path(Procedure.last)) + expect(page).to have_field('libelle de champ') + end end scenario 'After adding champ and file, make publication' do