correctif(procedure/all.xsls): deconnecte le lien de telechargement de toutes les demarche de turbo

This commit is contained in:
Martin 2023-02-13 15:08:55 +01:00 committed by mfo
parent f4fc0ab187
commit c45f15ff61
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