Feature test for gestionnaire, index and show (only filtering not tested)

This commit is contained in:
JC 2016-12-23 14:46:50 +01:00
parent e25ae6dea0
commit 2908460c16
2 changed files with 40 additions and 8 deletions

View file

@ -15,7 +15,7 @@
- unless smart_listing.empty?
- smart_listing.collection.each do |dossier|
%tr{id: "tr_dossier_#{dossier.id}", 'data-dossier_url' => backoffice_dossier_url(id: dossier.id)}
%tr.dossier-row{id: "tr_dossier_#{dossier.id}", 'data-dossier_url' => backoffice_dossier_url(id: dossier.id)}
- @facade_data_view.preference_list_dossiers_filter.each_with_index do |preference, index|
%td
- if preference.table.nil? || preference.table.empty?

View file

@ -22,7 +22,6 @@ feature 'As an Accompagnateur I can navigate and use each functionnality around
context 'On index' do
if false
scenario 'Switching between procedures' do
page.all('#procedure_list a').first.click
expect(page).to have_current_path(backoffice_dossiers_procedure_path(id: procedure_1.id.to_s), only_path: true)
@ -49,20 +48,53 @@ feature 'As an Accompagnateur I can navigate and use each functionnality around
page.all('#dossiers_list a').first.click
expect(page.all('#follow_dossiers .smart-listing')[0]['data-item-count']).to eq ("1")
end
end
scenario 'Using sort' do
end
if false
scenario 'Using pagination' do
scenario 'Using sort and pagination' do
visit "/backoffice/dossiers/procedure/1?all_state_dossiers_smart_listing[sort][id]=asc"
wait_for_ajax
expect(page.all("#all_state_dossiers .dossier-row")[0]['id']).to eq('tr_dossier_1')
visit "/backoffice/dossiers/procedure/1?all_state_dossiers_smart_listing[sort][id]=desc"
wait_for_ajax
expect(page.all(".dossier-row")[0]['id']).to eq('tr_dossier_20')
page.find('#all_state_dossiers .next_page a').trigger('click')
wait_for_ajax
page.find('#all_state_dossiers .next_page a').trigger('click')
wait_for_ajax
expect(page.all(".dossier-row")[0]['id']).to eq('tr_dossier_6')
page.find('#all_state_dossiers .prev a').trigger('click')
wait_for_ajax
expect(page.all(".dossier-row")[0]['id']).to eq('tr_dossier_13')
end
scenario 'Using filter' do
end
scenario 'Have an export button' do
expect(page.all('.export-link')[0].text).to eq('Au format CSV')
expect(page.all('.export-link')[1].text).to eq('Au format XLSX')
expect(page.all('.export-link')[2].text).to eq('Au format ODS')
end
end
context 'On show' do
scenario 'Following dossier' do
expect(page.all('#follow_dossiers .count').first.text).to eq('0 dossiers')
visit "/backoffice/dossiers/procedure/1?all_state_dossiers_smart_listing[sort][id]=asc"
page.find_by_id("suivre_dossier_1").trigger('click')
visit "backoffice/dossiers/4"
page.find_by_id("suivre_dossier_4").trigger('click')
visit "/backoffice/dossiers/procedure/1"
expect(page.all('#follow_dossiers .count').first.text).to eq('2 dossiers')
end
scenario 'Adding message' do
page.find_by_id('tr_dossier_4').trigger('click')
expect(page).to have_current_path(backoffice_dossier_path(4), only_path: true)
page.find_by_id('open-message').click
page.execute_script("$('#texte_commentaire').data('wysihtml5').editor.setValue('Contenu du nouveau message')")
page.find_by_id('save-message').click
expect(page.find('.last-commentaire .content').text).to eq('Contenu du nouveau message')
end
end
end