Changing click for tigger(click)

This commit is contained in:
JC 2016-12-27 17:29:14 +01:00
parent e7b7652388
commit 0d45b06ffb
5 changed files with 46 additions and 47 deletions

View file

@ -12,17 +12,17 @@ feature 'as an administrateur I wanna create a new procedure', js: true do
context 'Right after sign_in I shall see all procedure states links' do context 'Right after sign_in I shall see all procedure states links' do
scenario 'Finding draft procedures' do scenario 'Finding draft procedures' do
page.find_by_id('draft-procedures').click page.find_by_id('draft-procedures').trigger('click')
expect(page).to have_current_path(admin_procedures_draft_path, only_path: true) expect(page).to have_current_path(admin_procedures_draft_path, only_path: true)
end end
scenario 'Finding active procedures' do scenario 'Finding active procedures' do
page.find_by_id('active-procedures').click page.find_by_id('active-procedures').trigger('click')
expect(page).to have_current_path(admin_procedures_path, only_path: true) expect(page).to have_current_path(admin_procedures_path, only_path: true)
end end
scenario 'Finding archived procedures' do scenario 'Finding archived procedures' do
page.find_by_id('archived-procedures').click page.find_by_id('archived-procedures').trigger('click')
expect(page).to have_current_path(admin_procedures_archived_path, only_path: true) expect(page).to have_current_path(admin_procedures_archived_path, only_path: true)
end end
end end
@ -60,13 +60,13 @@ feature 'as an administrateur I wanna create a new procedure', js: true do
page.find_by_id('procedure_types_de_champ_attributes_1_libelle') page.find_by_id('procedure_types_de_champ_attributes_1_libelle')
expect(Procedure.first.types_de_champ.first.libelle).to eq('libelle de champ') expect(Procedure.first.types_de_champ.first.libelle).to eq('libelle de champ')
page.find_by_id('onglet-pieces').click page.find_by_id('onglet-pieces').trigger('click')
expect(page).to have_current_path(admin_procedure_pieces_justificatives_path(Procedure.first.id.to_s)) expect(page).to have_current_path(admin_procedure_pieces_justificatives_path(Procedure.first.id.to_s))
page.find_by_id('procedure_types_de_piece_justificative_attributes_0_libelle').set 'libelle de piece' page.find_by_id('procedure_types_de_piece_justificative_attributes_0_libelle').set 'libelle de piece'
page.find_by_id('add_piece_justificative').click page.find_by_id('add_piece_justificative').click
page.find_by_id('procedure_types_de_piece_justificative_attributes_1_libelle') page.find_by_id('procedure_types_de_piece_justificative_attributes_1_libelle')
page.find_by_id('onglet-preview').click page.find_by_id('onglet-preview').trigger('click')
expect(page).to have_current_path(admin_procedure_previsualisation_path(Procedure.first.id.to_s)) expect(page).to have_current_path(admin_procedure_previsualisation_path(Procedure.first.id.to_s))
expect(page.find_by_id('champs_1')['placeholder']).to eq('libelle de champ') expect(page.find_by_id('champs_1')['placeholder']).to eq('libelle de champ')
expect(page.first('.piece-libelle').text).to eq('libelle de piece') expect(page.first('.piece-libelle').text).to eq('libelle de piece')
@ -75,11 +75,11 @@ feature 'as an administrateur I wanna create a new procedure', js: true do
scenario 'After adding champ and file, check impossibility to publish procedure, add accompagnateur and make publication' do scenario 'After adding champ and file, check impossibility to publish procedure, add accompagnateur and make publication' do
page.find_by_id('procedure_types_de_champ_attributes_0_libelle').set 'libelle de champ' page.find_by_id('procedure_types_de_champ_attributes_0_libelle').set 'libelle de champ'
page.find_by_id('add_type_de_champ').click page.find_by_id('add_type_de_champ').click
page.find_by_id('onglet-pieces').click page.find_by_id('onglet-pieces').trigger('click')
page.find_by_id('procedure_types_de_piece_justificative_attributes_0_libelle').set 'libelle de piece' page.find_by_id('procedure_types_de_piece_justificative_attributes_0_libelle').set 'libelle de piece'
page.find_by_id('add_piece_justificative').click page.find_by_id('add_piece_justificative').click
page.find_by_id('onglet-infos').click page.find_by_id('onglet-infos').trigger('click')
expect(page).to have_current_path(admin_procedure_path(Procedure.first.id.to_s)) expect(page).to have_current_path(admin_procedure_path(Procedure.first.id.to_s))
expect(page.find_by_id('publish-procedure')['disabled']).to eq('disabled') expect(page.find_by_id('publish-procedure')['disabled']).to eq('disabled')

View file

@ -23,29 +23,28 @@ feature 'As an Accompagnateur I can navigate and use each functionnality around
context 'On index' do context 'On index' do
scenario 'Switching between procedures' do scenario 'Switching between procedures' do
page.all('#procedure_list a').first.click page.all('#procedure_list a').first.trigger('click')
expect(page).to have_current_path(backoffice_dossiers_procedure_path(id: procedure_1.id.to_s), only_path: true) expect(page).to have_current_path(backoffice_dossiers_procedure_path(id: procedure_1.id.to_s), only_path: true)
expect(page.find('#all_dossiers .count').text).to eq('20 dossiers') expect(page.find('#all_dossiers .count').text).to eq('20 dossiers')
page.all('#procedure_list a').last.click page.all('#procedure_list a').last.trigger('click')
expect(page).to have_current_path(backoffice_dossiers_procedure_path(id: procedure_2.id.to_s), only_path: true) expect(page).to have_current_path(backoffice_dossiers_procedure_path(id: procedure_2.id.to_s), only_path: true)
expect(page.find('#all_dossiers .count').text).to eq('15 dossiers') expect(page.find('#all_dossiers .count').text).to eq('15 dossiers')
#save_and_open_page
end end
scenario 'Searching with search bar' do scenario 'Searching with search bar' do
page.find_by_id('search_area').trigger('click') page.find_by_id('search_area').trigger('click')
fill_in 'q', with: '15' fill_in 'q', with: '15'
page.find_by_id('search_button').click page.find_by_id('search_button').trigger('click')
page.find_by_id('tr_dossier_15').click page.find_by_id('tr_dossier_15').trigger('click')
expect(page).to have_current_path("/backoffice/dossiers/15") expect(page).to have_current_path("/backoffice/dossiers/15")
end end
scenario 'Following dossier' do scenario 'Following dossier' do
page.all('#procedure_list a').first.click page.all('#procedure_list a').first.trigger('click')
expect(page.all('#follow_dossiers .smart-listing')[0]['data-item-count']).to eq ("0") expect(page.all('#follow_dossiers .smart-listing')[0]['data-item-count']).to eq ("0")
page.find_by_id('all_dossiers').click page.find_by_id('all_dossiers').trigger('click')
expect(page.all('#dossiers_list a').first.text).to eq('Suivre') expect(page.all('#dossiers_list a').first.text).to eq('Suivre')
page.all('#dossiers_list a').first.click page.all('#dossiers_list a').first.trigger('click')
expect(page.all('#follow_dossiers .smart-listing')[0]['data-item-count']).to eq ("1") expect(page.all('#follow_dossiers .smart-listing')[0]['data-item-count']).to eq ("1")
end end
@ -91,9 +90,9 @@ feature 'As an Accompagnateur I can navigate and use each functionnality around
scenario 'Adding message' do scenario 'Adding message' do
page.find_by_id('tr_dossier_4').trigger('click') page.find_by_id('tr_dossier_4').trigger('click')
expect(page).to have_current_path(backoffice_dossier_path(4), only_path: true) expect(page).to have_current_path(backoffice_dossier_path(4), only_path: true)
page.find_by_id('open-message').click page.find_by_id('open-message').trigger('click')
page.execute_script("$('#texte_commentaire').data('wysihtml5').editor.setValue('Contenu du nouveau message')") page.execute_script("$('#texte_commentaire').data('wysihtml5').editor.setValue('Contenu du nouveau message')")
page.find_by_id('save-message').click page.find_by_id('save-message').trigger('click')
expect(page.find('.last-commentaire .content').text).to eq('Contenu du nouveau message') expect(page.find('.last-commentaire .content').text).to eq('Contenu du nouveau message')
end end
end end

View file

@ -17,11 +17,11 @@ feature 'As a User I wanna create a dossier', js: true do
fill_in 'dossier_individual_attributes_prenom', with: 'Prenom' fill_in 'dossier_individual_attributes_prenom', with: 'Prenom'
fill_in 'dossier_individual_attributes_birthdate', with: '14/10/1987' fill_in 'dossier_individual_attributes_birthdate', with: '14/10/1987'
find(:css, "#dossier_autorisation_donnees[value='1']").set(true) find(:css, "#dossier_autorisation_donnees[value='1']").set(true)
page.find_by_id('etape_suivante').click page.find_by_id('etape_suivante').trigger('click')
expect(page).to have_current_path(users_dossier_carte_path(Dossier.first.id.to_s), only_path: true) expect(page).to have_current_path(users_dossier_carte_path(Dossier.first.id.to_s), only_path: true)
page.find_by_id('etape_suivante').click page.find_by_id('etape_suivante').trigger('click')
fill_in 'champs_1', with: 'contenu du champ 1' fill_in 'champs_1', with: 'contenu du champ 1'
page.find_by_id('suivant').click page.find_by_id('suivant').trigger('click')
expect(page).to have_current_path(users_dossier_recapitulatif_path(Dossier.first.id.to_s), only_path: true) expect(page).to have_current_path(users_dossier_recapitulatif_path(Dossier.first.id.to_s), only_path: true)
end end
@ -39,14 +39,14 @@ feature 'As a User I wanna create a dossier', js: true do
stub_request(:get, "https://api-dev.apientreprise.fr/v1/associations/#{siret}?token=#{SIADETOKEN}") stub_request(:get, "https://api-dev.apientreprise.fr/v1/associations/#{siret}?token=#{SIADETOKEN}")
.to_return(status: 404, body: '') .to_return(status: 404, body: '')
page.find_by_id('dossier_siret').set siret page.find_by_id('dossier_siret').set siret
page.find_by_id('submit-siret').click page.find_by_id('submit-siret').trigger('click')
expect(page).to have_css('#recap_info_entreprise') expect(page).to have_css('#recap_info_entreprise')
find(:css, "#dossier_autorisation_donnees[value='1']").set(true) find(:css, "#dossier_autorisation_donnees[value='1']").set(true)
page.find_by_id('etape_suivante').click page.find_by_id('etape_suivante').trigger('click')
expect(page).to have_current_path(users_dossier_carte_path(Dossier.first.id.to_s), only_path: true) expect(page).to have_current_path(users_dossier_carte_path(Dossier.first.id.to_s), only_path: true)
page.find_by_id('etape_suivante').click page.find_by_id('etape_suivante').trigger('click')
fill_in 'champs_1', with: 'contenu du champ 1' fill_in 'champs_1', with: 'contenu du champ 1'
page.find_by_id('suivant').click page.find_by_id('suivant').trigger('click')
expect(page).to have_current_path(users_dossier_recapitulatif_path(Dossier.first.id.to_s), only_path: true) expect(page).to have_current_path(users_dossier_recapitulatif_path(Dossier.first.id.to_s), only_path: true)
end end
end end

View file

@ -12,9 +12,9 @@ feature 'As a User I want to edit a dossier I own', js: true do
fill_in 'dossier_individual_attributes_prenom', with: 'Prenom' fill_in 'dossier_individual_attributes_prenom', with: 'Prenom'
fill_in 'dossier_individual_attributes_birthdate', with: '14/10/1987' fill_in 'dossier_individual_attributes_birthdate', with: '14/10/1987'
find(:css, "#dossier_autorisation_donnees[value='1']").set(true) find(:css, "#dossier_autorisation_donnees[value='1']").set(true)
page.find_by_id('etape_suivante').click page.find_by_id('etape_suivante').trigger('click')
page.find_by_id('etape_suivante').click page.find_by_id('etape_suivante').trigger('click')
page.find_by_id('suivant').click page.find_by_id('suivant').trigger('click')
visit root_path visit root_path
end end
@ -22,29 +22,29 @@ feature 'As a User I want to edit a dossier I own', js: true do
scenario 'After sign_in, I can see dossiers "à traiter" (default), and other indexes' do scenario 'After sign_in, I can see dossiers "à traiter" (default), and other indexes' do
expect(page.find('#a_traiter')['class'] ).to eq('active procedure_list_element') expect(page.find('#a_traiter')['class'] ).to eq('active procedure_list_element')
page.find_by_id('brouillon').click page.find_by_id('brouillon').trigger('click')
page.find_by_id('a_traiter').click page.find_by_id('a_traiter').trigger('click')
page.find_by_id('valides').click page.find_by_id('valides').trigger('click')
page.find_by_id('en_instruction').click page.find_by_id('en_instruction').trigger('click')
page.find_by_id('termine').click page.find_by_id('termine').trigger('click')
page.find_by_id('invite').click page.find_by_id('invite').trigger('click')
end end
scenario 'Getting a dossier, I want to create a new message on' do scenario 'Getting a dossier, I want to create a new message on' do
page.find_by_id('tr_dossier_' + Dossier.last.id.to_s).click page.find_by_id('tr_dossier_' + Dossier.last.id.to_s).trigger('click')
expect(page).to have_current_path(users_dossier_recapitulatif_path(Dossier.first.id.to_s), only_path: true) expect(page).to have_current_path(users_dossier_recapitulatif_path(Dossier.first.id.to_s), only_path: true)
page.find_by_id('open-message').click page.find_by_id('open-message').trigger('click')
page.execute_script("$('#texte_commentaire').data('wysihtml5').editor.setValue('Contenu du nouveau message')") page.execute_script("$('#texte_commentaire').data('wysihtml5').editor.setValue('Contenu du nouveau message')")
page.find_by_id('save-message').click page.find_by_id('save-message').trigger('click')
expect(page.find('.last-commentaire .content').text).to eq('Contenu du nouveau message') expect(page.find('.last-commentaire .content').text).to eq('Contenu du nouveau message')
end end
scenario 'On the same dossier, I want to edit informations' do scenario 'On the same dossier, I want to edit informations' do
page.find_by_id('tr_dossier_' + Dossier.last.id.to_s).click page.find_by_id('tr_dossier_' + Dossier.last.id.to_s).trigger('click')
page.find_by_id('edit-dossier').click page.find_by_id('edit-dossier').trigger('click')
expect(page).to have_current_path(users_dossier_description_path(Dossier.first.id.to_s), only_path: true) expect(page).to have_current_path(users_dossier_description_path(Dossier.first.id.to_s), only_path: true)
fill_in 'champs_1', with: 'Contenu du champ 1' fill_in 'champs_1', with: 'Contenu du champ 1'
page.find_by_id('modification_terminee').click page.find_by_id('modification_terminee').trigger('click')
expect(page).to have_current_path(users_dossier_recapitulatif_path(Dossier.first.id.to_s), only_path: true) expect(page).to have_current_path(users_dossier_recapitulatif_path(Dossier.first.id.to_s), only_path: true)
expect(page.find('#champ-1-value').text).to eq('Contenu du champ 1') expect(page.find('#champ-1-value').text).to eq('Contenu du champ 1')
end end

View file

@ -12,8 +12,8 @@ feature 'As a User I want to sort and paginate dossiers', js: true do
fill_in 'dossier_individual_attributes_prenom', with: 'Prenom' fill_in 'dossier_individual_attributes_prenom', with: 'Prenom'
fill_in 'dossier_individual_attributes_birthdate', with: '14/10/1987' fill_in 'dossier_individual_attributes_birthdate', with: '14/10/1987'
find(:css, "#dossier_autorisation_donnees[value='1']").set(true) find(:css, "#dossier_autorisation_donnees[value='1']").set(true)
page.find_by_id('etape_suivante').click page.find_by_id('etape_suivante').trigger('click')
page.find_by_id('suivant').click page.find_by_id('suivant').trigger('click')
50.times do 50.times do
Dossier.create(procedure_id: 1, user_id: 1, state: "initiated") Dossier.create(procedure_id: 1, user_id: 1, state: "initiated")
end end
@ -23,7 +23,7 @@ feature 'As a User I want to sort and paginate dossiers', js: true do
context 'After sign_in, I can see my 51 dossiers on the index' do context 'After sign_in, I can see my 51 dossiers on the index' do
scenario 'Using sort' do scenario 'Using sort' do
expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq('1') expect(page.all(:css, '#dossiers_list tr')[0].text.split(" ").first).to eq('1')
expect(page.all(:css, '#dossiers_list tr')[2].text.split(" ").first).to eq('2') expect(page.all(:css, '#dossiers_list tr')[2].text.split(" ").first).to eq('2')
visit "/users/dossiers?dossiers_smart_listing[sort][id]=desc" visit "/users/dossiers?dossiers_smart_listing[sort][id]=desc"
expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq('51') expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq('51')
@ -34,16 +34,16 @@ feature 'As a User I want to sort and paginate dossiers', js: true do
end end
scenario 'Using pagination' do scenario 'Using pagination' do
expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq('1') expect(page.all(:css, '#dossiers_list tr')[0].text.split(" ").first).to eq('1')
page.find('.next_page a').click page.find('.next_page a').trigger('click')
wait_for_ajax wait_for_ajax
expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq('8') expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq('8')
page.find('.next_page a').click page.find('.next_page a').trigger('click')
wait_for_ajax wait_for_ajax
expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq('15') expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq('15')
page.find('.prev a').click page.find('.prev a').trigger('click')
wait_for_ajax wait_for_ajax
page.find('.prev a').click page.find('.prev a').trigger('click')
wait_for_ajax wait_for_ajax
expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq('1') expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq('1')
end end