Merge pull request #8619 from mfo/US/fix-export-all

correctif(procedure/all.xsls): deconnecte le lien de telechargement de toutes les demarche de turbo
This commit is contained in:
mfo 2023-02-15 11:33:16 +01:00 committed by GitHub
commit 3c585df3ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View file

@ -11,7 +11,7 @@
= f.search_field 'libelle', size: 30, class: 'fr-input'
.actions
.link.fr-mx-1w= link_to 'Voir les administrateurs', administrateurs_admin_procedures_path(@filter.params), class: 'fr-btn fr-btn--secondary'
.link.fr-mx-1w= link_to 'Exporter les résultats', all_admin_procedures_path(@filter.params.merge(format: :xlsx)), class: 'fr-btn fr-btn--secondary'
.link.fr-mx-1w{ "data-turbo": "false" }= link_to 'Exporter les résultats', all_admin_procedures_path(@filter.params.merge(format: :xlsx)), class: 'fr-btn fr-btn--secondary'
.fr-table.fr-table--bordered
%table#all-demarches
%caption

View file

@ -14,7 +14,22 @@ describe 'As an administrateur I wanna clone a procedure', js: true do
published_at: Time.zone.now)
login_as administrateur.user, scope: :user
end
context 'Visit all admin procedures' do
let(:download_dir) { Rails.root.join('tmp/capybara') }
let(:download_file_pattern) { download_dir.join('*.xlsx') }
scenario do
Dir[download_file_pattern].map { File.delete(_1) }
visit all_admin_procedures_path
click_on "Exporter les résultats"
Timeout.timeout(Capybara.default_max_wait_time,
Timeout::Error,
"File download timeout! can't download procedure/all.xlsx") do
sleep 0.1 until !Dir[download_file_pattern].empty?
end
end
end
context 'Cloning a procedure owned by the current admin' do
scenario do
visit admin_procedures_path