From 2894897ad16ddd3cb81f9e2888d811e28bbf59a7 Mon Sep 17 00:00:00 2001 From: mfo Date: Mon, 18 Nov 2024 11:15:55 +0100 Subject: [PATCH] fix(export_template.zip): link must have kind param --- .../instructeurs/procedures/exports.html.haml | 2 +- ...procedure_export_template_tabular_spec.rb} | 2 +- .../procedure_export_template_zip_spec.rb | 29 +++++++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) rename spec/system/instructeurs/{procedure_export_tabular_spec.rb => procedure_export_template_tabular_spec.rb} (96%) create mode 100644 spec/system/instructeurs/procedure_export_template_zip_spec.rb diff --git a/app/views/instructeurs/procedures/exports.html.haml b/app/views/instructeurs/procedures/exports.html.haml index 3e92cd894..fad0a8022 100644 --- a/app/views/instructeurs/procedures/exports.html.haml +++ b/app/views/instructeurs/procedures/exports.html.haml @@ -37,7 +37,7 @@ .fr-mt-5w - = link_to t('.new_zip_export_template'), new_instructeur_procedure_export_template_path(@procedure), class: "fr-btn fr-btn--secondary fr-btn--icon-left fr-icon-add-line fr-mr-1w" + = link_to t('.new_zip_export_template'), new_instructeur_procedure_export_template_path(@procedure, kind: 'zip'), class: "fr-btn fr-btn--secondary fr-btn--icon-left fr-icon-add-line fr-mr-1w" = link_to t('.new_tabular_export_template'), new_instructeur_procedure_export_template_path(@procedure, kind: 'tabular'), class: "fr-btn fr-btn--secondary fr-btn--icon-left fr-icon-add-line" .fr-table.fr-table--bordered.fr-table--no-caption.fr-mt-5w diff --git a/spec/system/instructeurs/procedure_export_tabular_spec.rb b/spec/system/instructeurs/procedure_export_template_tabular_spec.rb similarity index 96% rename from spec/system/instructeurs/procedure_export_tabular_spec.rb rename to spec/system/instructeurs/procedure_export_template_tabular_spec.rb index 326bdbc30..6ed66c910 100644 --- a/spec/system/instructeurs/procedure_export_tabular_spec.rb +++ b/spec/system/instructeurs/procedure_export_template_tabular_spec.rb @@ -6,7 +6,7 @@ describe "procedure exports" do let(:types_de_champ_public) { [{ type: :text }] } before { login_as(instructeur.user, scope: :user) } - scenario "create an export_template tabular and u", js: true do + scenario "create an export_template tabular", js: true do Flipper.enable(:export_template, procedure) visit instructeur_procedure_path(procedure) diff --git a/spec/system/instructeurs/procedure_export_template_zip_spec.rb b/spec/system/instructeurs/procedure_export_template_zip_spec.rb new file mode 100644 index 000000000..44eb7b787 --- /dev/null +++ b/spec/system/instructeurs/procedure_export_template_zip_spec.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +describe "procedure exports zip" do + let(:instructeur) { create(:instructeur) } + let(:procedure) { create(:procedure, :published, types_de_champ_public:, instructeurs: [instructeur]) } + let(:types_de_champ_public) { [{ type: :text }] } + before { login_as(instructeur.user, scope: :user) } + + scenario "create an export_template zip", chome: true do + visit instructeur_procedure_path(procedure) + + click_on "Voir les exports et modèles d'export" + + click_on "Modèles d'export" + + click_on "Créer un modèle d'export zip" + + fill_in "Nom du modèle", with: "Mon modèle" + expect(page).to have_content("Sélectionnez les fichiers que vous souhaitez exporter") + click_on "Enregistrer" + + find("#tabpanel-export-templates", wait: 5, visible: true) + find("#tabpanel-export-templates").click + + within 'table' do + expect(page).to have_content('Mon modèle') + end + end +end