fix specs
This commit is contained in:
parent
890e00f915
commit
e1c7f2ac6f
1 changed files with 28 additions and 13 deletions
|
@ -31,18 +31,21 @@ describe 'BatchOperation a dossier:', js: true do
|
||||||
expect(page).to have_button("Archiver les dossiers")
|
expect(page).to have_button("Archiver les dossiers")
|
||||||
|
|
||||||
# ensure batch is created
|
# ensure batch is created
|
||||||
expect { click_on "Archiver les dossiers" }
|
|
||||||
.to change { BatchOperation.count }
|
page.accept_alert do
|
||||||
.from(0).to(1)
|
click_on "Archiver les dossiers"
|
||||||
|
end
|
||||||
|
|
||||||
# ensure batched dossier is disabled
|
# ensure batched dossier is disabled
|
||||||
expect(page).to have_selector("##{checkbox_id}[disabled]")
|
expect(page).to have_selector("##{checkbox_id}[disabled]")
|
||||||
|
# ensure Batch is created
|
||||||
|
expect(BatchOperation.count).to eq(1)
|
||||||
# check a11y with disabled checkbox
|
# check a11y with disabled checkbox
|
||||||
expect(page).to be_axe_clean
|
expect(page).to be_axe_clean
|
||||||
|
|
||||||
# ensure alert is present
|
# ensure alert is present
|
||||||
expect(page).to have_content("Information : Une action de masse est en cours")
|
expect(page).to have_content("Information : Une action de masse est en cours")
|
||||||
expect(page).to have_content("1 dossier sera archivé")
|
expect(page).to have_content("1 dossier est en cours d'archivage")
|
||||||
|
|
||||||
# ensure jobs are queued
|
# ensure jobs are queued
|
||||||
perform_enqueued_jobs(only: [BatchOperationEnqueueAllJob])
|
perform_enqueued_jobs(only: [BatchOperationEnqueueAllJob])
|
||||||
|
@ -71,10 +74,14 @@ describe 'BatchOperation a dossier:', js: true do
|
||||||
end
|
end
|
||||||
|
|
||||||
# submit checkall
|
# submit checkall
|
||||||
expect { click_on "Archiver les dossiers" }
|
page.accept_alert do
|
||||||
.to change { BatchOperation.count }
|
click_on "Archiver les dossiers"
|
||||||
.from(1).to(2)
|
end
|
||||||
|
|
||||||
|
# reload
|
||||||
|
visit instructeur_procedure_path(procedure, statut: 'traites')
|
||||||
|
|
||||||
|
expect(BatchOperation.count).to eq(2)
|
||||||
expect(BatchOperation.last.dossiers).to match_array([dossier_2, dossier_3])
|
expect(BatchOperation.last.dossiers).to match_array([dossier_2, dossier_3])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -109,10 +116,14 @@ describe 'BatchOperation a dossier:', js: true do
|
||||||
find("##{dom_id(BatchOperation.new, :checkbox_all)}").check
|
find("##{dom_id(BatchOperation.new, :checkbox_all)}").check
|
||||||
click_on("Sélectionner tous les 3 dossiers")
|
click_on("Sélectionner tous les 3 dossiers")
|
||||||
|
|
||||||
expect { click_on "Suivre les dossiers" }
|
accept_alert do
|
||||||
.to change { BatchOperation.count }
|
click_on "Suivre les dossiers"
|
||||||
.from(0).to(1)
|
end
|
||||||
|
|
||||||
|
# reload
|
||||||
|
visit instructeur_procedure_path(procedure, statut: 'a-suivre')
|
||||||
|
|
||||||
|
expect(BatchOperation.count).to eq(1)
|
||||||
expect(BatchOperation.last.dossiers).to match_array([dossier_1, dossier_2, dossier_3])
|
expect(BatchOperation.last.dossiers).to match_array([dossier_1, dossier_2, dossier_3])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -138,10 +149,14 @@ describe 'BatchOperation a dossier:', js: true do
|
||||||
expect(find_field("batch_operation[dossier_ids][]", type: :hidden).value).to eq "#{dossier_4.id},#{dossier_3.id},#{dossier_2.id}"
|
expect(find_field("batch_operation[dossier_ids][]", type: :hidden).value).to eq "#{dossier_4.id},#{dossier_3.id},#{dossier_2.id}"
|
||||||
|
|
||||||
# create batch
|
# create batch
|
||||||
expect { click_on "Suivre les dossiers" }
|
accept_alert do
|
||||||
.to change { BatchOperation.count }
|
click_on "Suivre les dossiers"
|
||||||
.from(0).to(1)
|
end
|
||||||
|
|
||||||
|
# reload
|
||||||
|
visit instructeur_procedure_path(procedure, statut: 'a-suivre')
|
||||||
|
|
||||||
|
expect(BatchOperation.count).to eq(1)
|
||||||
expect(BatchOperation.last.dossiers).to match_array([dossier_2, dossier_3, dossier_4])
|
expect(BatchOperation.last.dossiers).to match_array([dossier_2, dossier_3, dossier_4])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue