2024-04-29 00:17:15 +02:00
|
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2023-11-06 15:15:51 +01:00
|
|
|
|
describe 'Instructing a dossier:', js: true do
|
2018-05-25 18:05:28 +02:00
|
|
|
|
include ActiveJob::TestHelper
|
2023-09-29 19:52:31 +02:00
|
|
|
|
include Logic
|
2018-05-25 18:05:28 +02:00
|
|
|
|
|
2023-03-03 14:16:15 +01:00
|
|
|
|
let(:password) { SECURE_PASSWORD }
|
2019-08-06 11:02:54 +02:00
|
|
|
|
let!(:instructeur) { create(:instructeur, password: password) }
|
2017-09-25 14:57:55 +02:00
|
|
|
|
|
2023-09-29 19:52:31 +02:00
|
|
|
|
let!(:procedure) { create(:procedure, :published, instructeurs: [instructeur], types_de_champ_private: [{ type: 'checkbox', libelle: 'Yes/No', stable_id: 99 }, { libelle: 'Nom', condition: ds_eq(champ_value(99), constant(true)) }]) }
|
2021-01-28 13:53:18 +01:00
|
|
|
|
let!(:dossier) { create(:dossier, :en_construction, :with_entreprise, procedure: procedure) }
|
2019-08-08 16:55:51 +02:00
|
|
|
|
context 'the instructeur is also a user' do
|
2019-08-06 11:02:54 +02:00
|
|
|
|
scenario 'a instructeur can fill a dossier' do
|
2018-11-22 18:11:00 +01:00
|
|
|
|
visit commencer_path(path: procedure.path)
|
2019-01-16 11:57:58 +01:00
|
|
|
|
click_on 'J’ai déjà un compte'
|
2018-11-22 18:11:00 +01:00
|
|
|
|
|
|
|
|
|
expect(page).to have_current_path new_user_session_path
|
2019-08-06 11:02:54 +02:00
|
|
|
|
sign_in_with(instructeur.email, password, true)
|
2018-11-22 18:11:00 +01:00
|
|
|
|
|
2019-08-08 16:24:30 +02:00
|
|
|
|
# connexion link erase user stored location
|
|
|
|
|
# expect(page).to have_current_path(commencer_path(path: procedure.path))
|
|
|
|
|
|
|
|
|
|
visit commencer_path(path: procedure.path)
|
2019-01-16 16:16:15 +01:00
|
|
|
|
click_on 'Commencer la démarche'
|
|
|
|
|
|
|
|
|
|
expect(page).to have_content('Identifier votre établissement')
|
2019-01-16 11:57:58 +01:00
|
|
|
|
expect(page).to have_current_path(siret_dossier_path(procedure.reload.dossiers.last))
|
2018-11-22 18:11:00 +01:00
|
|
|
|
expect(page).to have_content(procedure.libelle)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2023-09-29 19:52:31 +02:00
|
|
|
|
scenario 'A instructeur can accept a dossier' do
|
2019-08-06 11:02:54 +02:00
|
|
|
|
log_in(instructeur.email, password)
|
2017-09-25 14:57:55 +02:00
|
|
|
|
|
2019-08-06 11:02:54 +02:00
|
|
|
|
expect(page).to have_current_path(instructeur_procedures_path)
|
2017-09-25 14:57:55 +02:00
|
|
|
|
|
|
|
|
|
click_on procedure.libelle
|
2019-08-06 11:02:54 +02:00
|
|
|
|
expect(page).to have_current_path(instructeur_procedure_path(procedure))
|
2017-09-25 14:57:55 +02:00
|
|
|
|
|
|
|
|
|
click_on dossier.user.email
|
2019-08-06 11:02:54 +02:00
|
|
|
|
expect(page).to have_current_path(instructeur_dossier_path(procedure, dossier))
|
2017-09-25 14:57:55 +02:00
|
|
|
|
|
2023-02-22 12:03:37 +01:00
|
|
|
|
click_on 'Passer en instruction'
|
|
|
|
|
|
2023-02-24 15:48:29 +01:00
|
|
|
|
expect(page).to have_text('Dossier passé en instruction.')
|
|
|
|
|
expect(page).to have_text('Instruire le dossier')
|
2023-02-28 16:46:13 +01:00
|
|
|
|
expect(page).to have_selector('.fr-badge', text: 'en instruction')
|
2018-09-13 17:13:09 +02:00
|
|
|
|
|
2017-09-25 14:57:55 +02:00
|
|
|
|
dossier.reload
|
2018-08-28 14:10:55 +02:00
|
|
|
|
expect(dossier.state).to eq(Dossier.states.fetch(:en_instruction))
|
2017-09-25 14:57:55 +02:00
|
|
|
|
|
2023-02-22 12:03:37 +01:00
|
|
|
|
click_on 'Instruire le dossier'
|
2018-09-13 17:13:09 +02:00
|
|
|
|
|
2023-02-23 11:04:15 +01:00
|
|
|
|
within('.instruction-button') do
|
2024-09-11 11:32:49 +02:00
|
|
|
|
# FIXME click_on 'Accepter' is not working for some reason
|
|
|
|
|
find_link('Accepter').click
|
2018-09-13 17:13:09 +02:00
|
|
|
|
end
|
|
|
|
|
|
2017-11-29 11:47:18 +01:00
|
|
|
|
within('.accept.motivation') do
|
|
|
|
|
fill_in('dossier_motivation', with: 'a good reason')
|
2018-09-13 17:13:09 +02:00
|
|
|
|
|
|
|
|
|
accept_confirm do
|
|
|
|
|
click_on 'Valider la décision'
|
|
|
|
|
end
|
2017-11-29 11:47:18 +01:00
|
|
|
|
end
|
2017-09-25 14:57:55 +02:00
|
|
|
|
|
2018-09-13 17:13:09 +02:00
|
|
|
|
expect(page).to have_text('Dossier traité avec succès.')
|
2023-04-07 10:43:21 +02:00
|
|
|
|
expect(page).to have_button('Archiver le dossier')
|
2018-09-13 17:13:09 +02:00
|
|
|
|
|
2017-09-25 14:57:55 +02:00
|
|
|
|
dossier.reload
|
2018-08-28 14:10:55 +02:00
|
|
|
|
expect(dossier.state).to eq(Dossier.states.fetch(:accepte))
|
2017-09-25 14:57:55 +02:00
|
|
|
|
expect(dossier.motivation).to eq('a good reason')
|
2021-06-16 16:03:57 +02:00
|
|
|
|
|
|
|
|
|
click_on procedure.libelle
|
|
|
|
|
click_on 'traité'
|
2023-04-07 10:43:21 +02:00
|
|
|
|
expect(page).to have_button('Repasser en instruction')
|
|
|
|
|
click_on 'Supprimer le dossier'
|
2021-06-16 16:03:57 +02:00
|
|
|
|
click_on 'traité'
|
2023-04-07 10:43:21 +02:00
|
|
|
|
expect(page).not_to have_button('Repasser en instruction')
|
2017-09-25 14:57:55 +02:00
|
|
|
|
end
|
|
|
|
|
|
2023-09-29 19:52:31 +02:00
|
|
|
|
scenario 'An instructeur can add anotations' do
|
|
|
|
|
log_in(instructeur.email, password)
|
|
|
|
|
|
|
|
|
|
visit instructeur_dossier_path(procedure, dossier)
|
|
|
|
|
click_on 'Annotations privées'
|
|
|
|
|
|
|
|
|
|
expect(page).not_to have_field 'Nom', visible: true
|
|
|
|
|
check 'Yes/No', allow_label_click: true
|
|
|
|
|
expect(page).to have_field 'Nom'
|
|
|
|
|
fill_in 'Nom', with: 'John Doe'
|
|
|
|
|
expect(page).to have_text 'Annotations enregistrées'
|
|
|
|
|
end
|
|
|
|
|
|
2022-05-16 15:54:16 +02:00
|
|
|
|
scenario 'An instructeur can destroy a dossier from view' do
|
|
|
|
|
log_in(instructeur.email, password)
|
|
|
|
|
|
|
|
|
|
dossier.passer_en_instruction(instructeur: instructeur)
|
|
|
|
|
dossier.accepter!(instructeur: instructeur)
|
|
|
|
|
visit instructeur_dossier_path(procedure, dossier)
|
2023-04-07 10:43:21 +02:00
|
|
|
|
click_on 'Supprimer le dossier'
|
2022-05-16 15:54:16 +02:00
|
|
|
|
end
|
|
|
|
|
|
2019-08-06 11:02:54 +02:00
|
|
|
|
scenario 'A instructeur can follow/unfollow a dossier' do
|
|
|
|
|
log_in(instructeur.email, password)
|
2017-09-25 14:57:55 +02:00
|
|
|
|
|
|
|
|
|
click_on procedure.libelle
|
|
|
|
|
test_statut_bar(a_suivre: 1, tous_les_dossiers: 1)
|
|
|
|
|
dossier_present?(dossier.id, 'en construction')
|
|
|
|
|
|
2017-10-05 19:21:21 +02:00
|
|
|
|
click_on 'Suivre le dossier'
|
2019-08-06 11:02:54 +02:00
|
|
|
|
expect(page).to have_current_path(instructeur_procedure_path(procedure))
|
2017-09-25 14:57:55 +02:00
|
|
|
|
test_statut_bar(suivi: 1, tous_les_dossiers: 1)
|
|
|
|
|
expect(page).to have_text('Aucun dossier')
|
|
|
|
|
|
|
|
|
|
click_on 'suivi'
|
2019-08-06 11:02:54 +02:00
|
|
|
|
expect(page).to have_current_path(instructeur_procedure_path(procedure, statut: 'suivis'))
|
2017-09-25 14:57:55 +02:00
|
|
|
|
dossier_present?(dossier.id, 'en construction')
|
|
|
|
|
|
2017-10-05 19:21:21 +02:00
|
|
|
|
click_on 'Ne plus suivre'
|
2019-08-06 11:02:54 +02:00
|
|
|
|
expect(page).to have_current_path(instructeur_procedure_path(procedure, statut: 'suivis'))
|
2017-09-25 14:57:55 +02:00
|
|
|
|
test_statut_bar(a_suivre: 1, tous_les_dossiers: 1)
|
|
|
|
|
expect(page).to have_text('Aucun dossier')
|
|
|
|
|
end
|
|
|
|
|
|
2021-06-16 11:46:25 +02:00
|
|
|
|
scenario 'A instructeur can request an export' do
|
2023-06-27 15:40:08 +02:00
|
|
|
|
assert_performed_jobs 1 do
|
|
|
|
|
log_in(instructeur.email, password)
|
|
|
|
|
end
|
2021-06-16 11:46:25 +02:00
|
|
|
|
|
|
|
|
|
click_on procedure.libelle
|
|
|
|
|
test_statut_bar(a_suivre: 1, tous_les_dossiers: 1)
|
|
|
|
|
|
2022-04-05 15:57:19 +02:00
|
|
|
|
click_on "Télécharger un dossier"
|
2024-10-25 15:00:27 +02:00
|
|
|
|
within(:css, '#tabpanel-standard1-panel') do
|
|
|
|
|
choose "Fichier csv", allow_label_click: true
|
|
|
|
|
click_on "Demander l'export"
|
2022-04-05 15:57:19 +02:00
|
|
|
|
end
|
2022-07-04 16:13:15 +02:00
|
|
|
|
|
2022-04-05 15:57:19 +02:00
|
|
|
|
expect(page).to have_text('Nous générons cet export.')
|
2023-09-11 17:43:12 +02:00
|
|
|
|
|
2024-10-25 14:36:38 +02:00
|
|
|
|
click_on "Voir les exports et modèles d'export"
|
2023-09-20 14:00:18 +02:00
|
|
|
|
expect(page).to have_text("Export .csv d’un dossier « à suivre » demandé il y a moins d'une minute")
|
|
|
|
|
expect(page).to have_text("En préparation")
|
2023-09-11 17:43:12 +02:00
|
|
|
|
|
2024-04-15 21:53:01 +02:00
|
|
|
|
assert_performed_jobs 1 do
|
2023-06-27 15:40:08 +02:00
|
|
|
|
perform_enqueued_jobs(only: ExportJob)
|
|
|
|
|
end
|
2021-06-16 11:46:25 +02:00
|
|
|
|
|
2024-09-10 20:23:15 +02:00
|
|
|
|
page.refresh
|
2023-09-21 13:59:14 +02:00
|
|
|
|
expect(page).to have_text('Télécharger l’export')
|
2021-06-16 11:46:25 +02:00
|
|
|
|
end
|
|
|
|
|
|
2019-08-06 11:02:54 +02:00
|
|
|
|
scenario 'A instructeur can see the personnes impliquées' do
|
2020-08-27 19:56:34 +02:00
|
|
|
|
instructeur2 = create(:instructeur, password: password)
|
2017-12-01 15:03:19 +01:00
|
|
|
|
|
2019-08-06 11:02:54 +02:00
|
|
|
|
log_in(instructeur.email, password)
|
2017-12-01 15:03:19 +01:00
|
|
|
|
|
|
|
|
|
click_on procedure.libelle
|
|
|
|
|
click_on dossier.user.email
|
|
|
|
|
|
|
|
|
|
click_on 'Avis externes'
|
2019-08-06 11:02:54 +02:00
|
|
|
|
expect(page).to have_current_path(avis_instructeur_dossier_path(procedure, dossier))
|
2023-03-17 11:30:20 +01:00
|
|
|
|
within('.fr-sidemenu') { click_on 'Demander un avis' }
|
|
|
|
|
expect(page).to have_current_path(avis_new_instructeur_dossier_path(procedure, dossier))
|
2017-12-01 15:03:19 +01:00
|
|
|
|
|
|
|
|
|
expert_email = 'expert@tps.com'
|
2024-05-07 21:37:54 +02:00
|
|
|
|
ask_confidential_avis(expert_email, 'a good introduction')
|
2017-12-01 15:03:19 +01:00
|
|
|
|
|
2024-05-07 21:37:54 +02:00
|
|
|
|
ask_confidential_avis(instructeur2.email, 'a good introduction')
|
2017-12-01 15:03:19 +01:00
|
|
|
|
|
|
|
|
|
click_on 'Personnes impliquées'
|
|
|
|
|
expect(page).to have_text(expert_email)
|
2019-08-06 11:02:54 +02:00
|
|
|
|
expect(page).to have_text(instructeur2.email)
|
2017-12-01 15:03:19 +01:00
|
|
|
|
end
|
|
|
|
|
|
2023-09-29 19:52:31 +02:00
|
|
|
|
scenario 'A instructeur can send a dossier to several instructeurs' do
|
2020-08-27 19:56:34 +02:00
|
|
|
|
instructeur_2 = create(:instructeur)
|
|
|
|
|
instructeur_3 = create(:instructeur)
|
2019-08-21 14:09:56 +02:00
|
|
|
|
procedure.defaut_groupe_instructeur.instructeurs << [instructeur_2, instructeur_3]
|
2018-09-10 17:52:49 +02:00
|
|
|
|
|
|
|
|
|
send_dossier = double()
|
2019-08-06 11:02:54 +02:00
|
|
|
|
expect(InstructeurMailer).to receive(:send_dossier).and_return(send_dossier).twice
|
2018-09-10 17:52:49 +02:00
|
|
|
|
expect(send_dossier).to receive(:deliver_later).twice
|
|
|
|
|
|
2019-08-06 11:02:54 +02:00
|
|
|
|
log_in(instructeur.email, password)
|
2018-09-10 17:52:49 +02:00
|
|
|
|
|
|
|
|
|
click_on procedure.libelle
|
|
|
|
|
click_on dossier.user.email
|
|
|
|
|
|
|
|
|
|
click_on 'Personnes impliquées'
|
|
|
|
|
|
2024-05-07 21:37:54 +02:00
|
|
|
|
select_combobox('Emails', instructeur_2.email)
|
|
|
|
|
select_combobox('Emails', instructeur_3.email)
|
2018-09-10 17:52:49 +02:00
|
|
|
|
|
|
|
|
|
click_on 'Envoyer'
|
|
|
|
|
|
|
|
|
|
expect(page).to have_text("Dossier envoyé")
|
|
|
|
|
end
|
|
|
|
|
|
2022-08-23 14:30:15 +02:00
|
|
|
|
context 'A instructeur can ask for an Archive' do
|
2024-01-23 09:52:20 +01:00
|
|
|
|
let(:procedure) { create(:procedure, :published, types_de_champ_public: [{ type: :piece_justificative }], instructeurs: [instructeur]) }
|
2022-08-23 14:30:15 +02:00
|
|
|
|
let(:dossier) { create(:dossier, :accepte, procedure: procedure) }
|
|
|
|
|
before do
|
|
|
|
|
log_in(instructeur.email, password)
|
|
|
|
|
visit instructeur_archives_path(procedure)
|
|
|
|
|
end
|
|
|
|
|
scenario 'download' do
|
|
|
|
|
expect {
|
2023-11-27 14:51:39 +01:00
|
|
|
|
page.first(".archive-table .fr-btn").click
|
2022-08-23 14:30:15 +02:00
|
|
|
|
}.to have_enqueued_job(ArchiveCreationJob).with(procedure, an_instance_of(Archive), instructeur)
|
|
|
|
|
expect(Archive.first.month).not_to be_nil
|
|
|
|
|
end
|
|
|
|
|
end
|
2024-09-10 23:53:04 +02:00
|
|
|
|
context 'with dossiers having attached files' do
|
2024-01-23 09:52:20 +01:00
|
|
|
|
let(:procedure) { create(:procedure, :published, types_de_champ_public: [{ type: :piece_justificative }], instructeurs: [instructeur]) }
|
2020-07-20 17:20:12 +02:00
|
|
|
|
let(:dossier) { create(:dossier, :en_construction, procedure: procedure) }
|
2024-09-27 15:37:11 +02:00
|
|
|
|
let(:champ) { dossier.project_champs_public.first }
|
2020-07-20 17:20:12 +02:00
|
|
|
|
let(:path) { 'spec/fixtures/files/piece_justificative_0.pdf' }
|
|
|
|
|
let(:commentaire) { create(:commentaire, instructeur: instructeur, dossier: dossier) }
|
|
|
|
|
|
2020-07-21 17:11:40 +02:00
|
|
|
|
before do
|
2021-11-26 12:19:40 +01:00
|
|
|
|
dossier.passer_en_instruction!(instructeur: instructeur)
|
2022-04-08 15:27:35 +02:00
|
|
|
|
champ.piece_justificative_file
|
|
|
|
|
.attach(io: File.open(path),
|
|
|
|
|
filename: "piece_justificative_0.pdf",
|
|
|
|
|
content_type: "application/pdf",
|
|
|
|
|
metadata: { virus_scan_result: ActiveStorage::VirusScanner::SAFE })
|
2020-07-20 17:20:12 +02:00
|
|
|
|
|
|
|
|
|
log_in(instructeur.email, password)
|
|
|
|
|
visit instructeur_dossier_path(procedure, dossier)
|
2020-07-21 17:11:40 +02:00
|
|
|
|
end
|
2020-07-20 17:20:12 +02:00
|
|
|
|
|
2020-07-21 17:11:40 +02:00
|
|
|
|
scenario 'A instructeur can download an archive containing a single attachment' do
|
2022-04-08 15:27:35 +02:00
|
|
|
|
find(:css, '[aria-controls=print-pj-menu]').click
|
2024-09-10 23:53:04 +02:00
|
|
|
|
click_on 'Télécharger le dossier et toutes ses pièces jointes'
|
2020-07-20 17:20:12 +02:00
|
|
|
|
|
|
|
|
|
DownloadHelpers.wait_for_download
|
|
|
|
|
files = ZipTricks::FileReader.read_zip_structure(io: File.open(DownloadHelpers.download))
|
|
|
|
|
|
|
|
|
|
expect(DownloadHelpers.download).to include "dossier-#{dossier.id}.zip"
|
2022-12-26 15:41:36 +01:00
|
|
|
|
expect(files.size).to be 2
|
2021-04-29 17:29:47 +02:00
|
|
|
|
expect(files[0].filename.include?('export')).to be_truthy
|
|
|
|
|
expect(files[1].filename.include?('piece_justificative_0')).to be_truthy
|
|
|
|
|
expect(files[1].uncompressed_size).to be File.size(path)
|
2020-07-20 17:20:12 +02:00
|
|
|
|
end
|
|
|
|
|
|
2020-07-21 17:11:40 +02:00
|
|
|
|
scenario 'A instructeur can download an archive containing several identical attachments' do
|
2022-04-08 15:27:35 +02:00
|
|
|
|
commentaire
|
|
|
|
|
.piece_jointe
|
|
|
|
|
.attach(io: File.open(path),
|
|
|
|
|
filename: "piece_justificative_0.pdf",
|
|
|
|
|
content_type: "application/pdf",
|
|
|
|
|
metadata: { virus_scan_result: ActiveStorage::VirusScanner::SAFE })
|
2020-07-20 17:20:12 +02:00
|
|
|
|
|
2024-09-10 23:53:04 +02:00
|
|
|
|
find(:css, '[aria-controls=print-pj-menu]').click
|
|
|
|
|
click_on 'Télécharger le dossier et toutes ses pièces jointes'
|
|
|
|
|
|
2020-07-20 17:20:12 +02:00
|
|
|
|
DownloadHelpers.wait_for_download
|
|
|
|
|
files = ZipTricks::FileReader.read_zip_structure(io: File.open(DownloadHelpers.download))
|
|
|
|
|
|
|
|
|
|
expect(DownloadHelpers.download).to include "dossier-#{dossier.id}.zip"
|
2022-12-26 15:41:36 +01:00
|
|
|
|
expect(files.size).to be 3
|
2021-04-29 17:29:47 +02:00
|
|
|
|
expect(files[0].filename.include?('export')).to be_truthy
|
2020-07-20 17:20:12 +02:00
|
|
|
|
expect(files[1].filename.include?('piece_justificative_0')).to be_truthy
|
2021-04-29 17:29:47 +02:00
|
|
|
|
expect(files[2].filename.include?('piece_justificative_0')).to be_truthy
|
|
|
|
|
expect(files[1].filename).not_to eq files[2].filename
|
2020-07-20 17:20:12 +02:00
|
|
|
|
expect(files[1].uncompressed_size).to be File.size(path)
|
2021-04-29 17:29:47 +02:00
|
|
|
|
expect(files[2].uncompressed_size).to be File.size(path)
|
2020-07-20 17:20:12 +02:00
|
|
|
|
end
|
|
|
|
|
|
2021-02-09 15:12:06 +01:00
|
|
|
|
before { DownloadHelpers.clear_downloads }
|
2020-07-20 17:20:12 +02:00
|
|
|
|
after { DownloadHelpers.clear_downloads }
|
|
|
|
|
end
|
|
|
|
|
|
2024-10-15 11:12:21 +02:00
|
|
|
|
context 'An instructeur can add labels' do
|
|
|
|
|
let(:procedure) { create(:procedure, :with_labels, :published, instructeurs: [instructeur]) }
|
2024-10-01 15:17:09 +02:00
|
|
|
|
|
2024-10-15 11:12:21 +02:00
|
|
|
|
scenario 'An instructeur can add and remove labels to a dossier' do
|
|
|
|
|
log_in(instructeur.email, password)
|
2024-10-01 15:17:09 +02:00
|
|
|
|
|
2024-10-15 11:12:21 +02:00
|
|
|
|
visit instructeur_dossier_path(procedure, dossier)
|
|
|
|
|
click_on 'Ajouter un label'
|
|
|
|
|
|
2024-10-28 14:33:57 +01:00
|
|
|
|
check 'À relancer', allow_label_click: true
|
|
|
|
|
expect(page).to have_css('.fr-tag', text: "À relancer", count: 2)
|
2024-10-15 11:12:21 +02:00
|
|
|
|
expect(dossier.dossier_labels.count).to eq(1)
|
2024-10-01 15:17:09 +02:00
|
|
|
|
|
2024-10-15 11:12:21 +02:00
|
|
|
|
expect(page).not_to have_text('Ajouter un label')
|
|
|
|
|
find('span.dropdown button.dropdown-button').click
|
2024-10-01 15:17:09 +02:00
|
|
|
|
|
2024-10-28 14:33:57 +01:00
|
|
|
|
expect(page).to have_checked_field('À relancer')
|
|
|
|
|
check 'Complet', allow_label_click: true
|
2024-10-01 15:17:09 +02:00
|
|
|
|
|
2024-10-28 14:33:57 +01:00
|
|
|
|
expect(page).to have_css('.fr-tag', text: "Complet", count: 2)
|
2024-10-15 11:12:21 +02:00
|
|
|
|
expect(dossier.dossier_labels.count).to eq(2)
|
2024-10-01 15:17:09 +02:00
|
|
|
|
|
2024-10-15 11:12:21 +02:00
|
|
|
|
find('span.dropdown button.dropdown-button').click
|
2024-10-28 14:33:57 +01:00
|
|
|
|
uncheck 'À relancer', allow_label_click: true
|
2024-10-01 15:17:09 +02:00
|
|
|
|
|
2024-10-28 14:33:57 +01:00
|
|
|
|
expect(page).to have_unchecked_field('À relancer')
|
|
|
|
|
expect(page).to have_checked_field('Complet')
|
|
|
|
|
expect(page).to have_css('.fr-tag', text: "À relancer", count: 1)
|
|
|
|
|
expect(page).to have_css('.fr-tag', text: "Complet", count: 2)
|
2024-10-15 11:12:21 +02:00
|
|
|
|
expect(dossier.dossier_labels.count).to eq(1)
|
|
|
|
|
end
|
2024-10-01 15:17:09 +02:00
|
|
|
|
end
|
|
|
|
|
|
2018-10-03 11:11:02 +02:00
|
|
|
|
def log_in(email, password, check_email: true)
|
2022-08-31 12:44:00 +02:00
|
|
|
|
visit new_user_session_path
|
2017-09-25 14:57:55 +02:00
|
|
|
|
expect(page).to have_current_path(new_user_session_path)
|
|
|
|
|
|
2018-10-03 11:11:02 +02:00
|
|
|
|
sign_in_with(email, password, check_email)
|
|
|
|
|
|
2019-08-06 11:02:54 +02:00
|
|
|
|
expect(page).to have_current_path(instructeur_procedures_path)
|
2017-09-25 14:57:55 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def log_out
|
|
|
|
|
click_on 'Se déconnecter'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def ask_confidential_avis(to, introduction)
|
2024-05-07 21:37:54 +02:00
|
|
|
|
fill_in 'avis_emails', with: to
|
2017-09-25 14:57:55 +02:00
|
|
|
|
fill_in 'avis_introduction', with: introduction
|
|
|
|
|
select 'confidentiel', from: 'avis_confidentiel'
|
2023-03-17 11:30:20 +01:00
|
|
|
|
within('form#new_avis') { click_on 'Demander un avis' }
|
2017-09-25 14:57:55 +02:00
|
|
|
|
click_on 'Demander un avis'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def test_statut_bar(a_suivre: 0, suivi: 0, traite: 0, tous_les_dossiers: 0, archive: 0)
|
|
|
|
|
texts = [
|
2021-04-26 17:15:28 +02:00
|
|
|
|
"#{a_suivre} à suivre",
|
|
|
|
|
"#{suivi} suivi",
|
|
|
|
|
"#{traite} traité",
|
|
|
|
|
"#{tous_les_dossiers} au total",
|
|
|
|
|
"#{archive} archivé"
|
2018-01-15 19:17:01 +01:00
|
|
|
|
]
|
2017-09-25 14:57:55 +02:00
|
|
|
|
|
|
|
|
|
texts.each { |text| expect(page).to have_text(text) }
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def dossier_present?(id, statut)
|
|
|
|
|
within(:css, '.dossiers-table') do
|
|
|
|
|
expect(page).to have_text(id)
|
|
|
|
|
expect(page).to have_text(statut)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|