add, edit and destroy export template with exported_columns

Co-authored-by: mfo <mfo@users.noreply.github.com>
Co-authored-by: LeSim <mail@simon.lehericey.net>
This commit is contained in:
Christophe Robillard 2024-10-25 14:50:51 +02:00 committed by mfo
parent f383e1c502
commit ffd1a15d91
No known key found for this signature in database
GPG key ID: 7CE3E1F5B794A8EC
19 changed files with 539 additions and 10 deletions

View file

@ -0,0 +1,58 @@
# frozen_string_literal: true
describe "procedure exports" 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 tabular and u", js: true do
Flipper.enable(:export_template, procedure)
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 tabulaire"
fill_in "Nom du modèle", with: "Mon modèle"
find("#informations-usager-fieldset label", text: "Tout sélectionner").click
within '#informations-usager-fieldset' do
expect(all('input[type=checkbox]').all?(&:checked?)).to be_truthy
end
find("#informations-dossier-fieldset label", text: "Tout sélectionner").click
within '#informations-dossier-fieldset' do
expect(all('input[type=checkbox]').all?(&:checked?)).to be_truthy
end
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
# check if all usager colonnes are selected
#
click_on 'Mon modèle'
within '#informations-usager-fieldset' do
expect(all('input[type=checkbox]').all?(&:checked?)).to be_truthy
end
within '#informations-dossier-fieldset' do
expect(all('input[type=checkbox]').all?(&:checked?)).to be_truthy
end
# uncheck checkboxes
find("#informations-dossier-fieldset label", text: "Tout sélectionner").click
within '#informations-dossier-fieldset' do
expect(all('input[type=checkbox]').none?(&:checked?)).to be_truthy
end
end
end