Remove a now deprecated Capybara option from tests

This commit is contained in:
gregoirenovel 2018-01-23 17:14:13 +01:00
parent e3f853307e
commit 5eb4f12b48
3 changed files with 15 additions and 15 deletions

View file

@ -11,24 +11,24 @@ 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').click
expect(page).to have_current_path(admin_procedures_draft_path, only_path: true) expect(page).to have_current_path(admin_procedures_draft_path)
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').click
expect(page).to have_current_path(admin_procedures_path, only_path: true) expect(page).to have_current_path(admin_procedures_path)
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').click
expect(page).to have_current_path(admin_procedures_archived_path, only_path: true) expect(page).to have_current_path(admin_procedures_archived_path)
end end
end end
context 'Creating a new procedure' do context 'Creating a new procedure' do
scenario 'Finding new procedure link' do scenario 'Finding new procedure link' do
page.find_by_id('new-procedure').click page.find_by_id('new-procedure').click
expect(page).to have_current_path(new_admin_procedure_path, only_path: true) expect(page).to have_current_path(new_admin_procedure_path)
end end
scenario 'Finding save button for new procedure, libelle and description required' do scenario 'Finding save button for new procedure, libelle and description required' do

View file

@ -21,30 +21,30 @@ feature 'As a User I wanna create a dossier' do
scenario "with a proper date input field for birthdate (type='date' supported)" do scenario "with a proper date input field for birthdate (type='date' supported)" do
fill_in 'dossier_individual_attributes_birthdate', with: '1987-10-14' fill_in 'dossier_individual_attributes_birthdate', with: '1987-10-14'
page.find_by_id('etape_suivante').click page.find_by_id('etape_suivante').click
expect(page).to have_current_path(users_dossier_carte_path(procedure_for_individual.dossiers.last.id.to_s), only_path: true) expect(page).to have_current_path(users_dossier_carte_path(procedure_for_individual.dossiers.last.id.to_s))
page.find_by_id('etape_suivante').click page.find_by_id('etape_suivante').click
fill_in "champs_#{procedure_for_individual.dossiers.last.champs.first.id}", with: 'contenu du champ 1' fill_in "champs_#{procedure_for_individual.dossiers.last.champs.first.id}", with: 'contenu du champ 1'
page.find_by_id('suivant').click page.find_by_id('suivant').click
expect(user.dossiers.first.individual.birthdate).to eq("1987-10-14") expect(user.dossiers.first.individual.birthdate).to eq("1987-10-14")
expect(page).to have_current_path(users_dossier_recapitulatif_path(procedure_for_individual.dossiers.last.id.to_s), only_path: true) expect(page).to have_current_path(users_dossier_recapitulatif_path(procedure_for_individual.dossiers.last.id.to_s))
end end
scenario "with a basic text input field for birthdate (type='date' unsupported)" do scenario "with a basic text input field for birthdate (type='date' unsupported)" do
fill_in 'dossier_individual_attributes_birthdate', with: '14/10/1987' fill_in 'dossier_individual_attributes_birthdate', with: '14/10/1987'
page.find_by_id('etape_suivante').click page.find_by_id('etape_suivante').click
expect(page).to have_current_path(users_dossier_carte_path(procedure_for_individual.dossiers.last.id.to_s), only_path: true) expect(page).to have_current_path(users_dossier_carte_path(procedure_for_individual.dossiers.last.id.to_s))
page.find_by_id('etape_suivante').click page.find_by_id('etape_suivante').click
fill_in "champs_#{procedure_for_individual.dossiers.last.champs.first.id}", with: 'contenu du champ 1' fill_in "champs_#{procedure_for_individual.dossiers.last.champs.first.id}", with: 'contenu du champ 1'
page.find_by_id('suivant').click page.find_by_id('suivant').click
expect(user.dossiers.first.individual.birthdate).to eq("1987-10-14") expect(user.dossiers.first.individual.birthdate).to eq("1987-10-14")
expect(page).to have_current_path(users_dossier_recapitulatif_path(procedure_for_individual.dossiers.last.id.to_s), only_path: true) expect(page).to have_current_path(users_dossier_recapitulatif_path(procedure_for_individual.dossiers.last.id.to_s))
end end
end end
scenario 'Identification through siret', vcr: { cassette_name: 'search_ban_paris' }, js: true do scenario 'Identification through siret', vcr: { cassette_name: 'search_ban_paris' }, js: true do
login_as user, scope: :user login_as user, scope: :user
visit commencer_path(procedure_path: procedure_with_siret.path) visit commencer_path(procedure_path: procedure_with_siret.path)
expect(page).to have_current_path(users_dossier_path(procedure_with_siret.dossiers.last.id.to_s), only_path: true) expect(page).to have_current_path(users_dossier_path(procedure_with_siret.dossiers.last.id.to_s))
fill_in 'dossier-siret', with: siret fill_in 'dossier-siret', with: siret
stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/etablissements/#{siret}?token=#{SIADETOKEN}") stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/etablissements/#{siret}?token=#{SIADETOKEN}")
.to_return(status: 200, body: File.read('spec/support/files/etablissement.json')) .to_return(status: 200, body: File.read('spec/support/files/etablissement.json'))
@ -59,11 +59,11 @@ feature 'As a User I wanna create a dossier' do
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').click
expect(page).to have_current_path(users_dossier_carte_path(procedure_with_siret.dossiers.last.id.to_s), only_path: true) expect(page).to have_current_path(users_dossier_carte_path(procedure_with_siret.dossiers.last.id.to_s))
page.find_by_id('etape_suivante').click page.find_by_id('etape_suivante').click
fill_in "champs_#{procedure_with_siret.dossiers.last.champs.first.id}", with: 'contenu du champ 1' fill_in "champs_#{procedure_with_siret.dossiers.last.champs.first.id}", with: 'contenu du champ 1'
page.find_by_id('suivant').click page.find_by_id('suivant').click
expect(page).to have_current_path(users_dossier_recapitulatif_path(procedure_with_siret.dossiers.last.id.to_s), only_path: true) expect(page).to have_current_path(users_dossier_recapitulatif_path(procedure_with_siret.dossiers.last.id.to_s))
end end
end end
end end

View file

@ -22,7 +22,7 @@ feature 'As a User I want to edit a dossier I own' do
scenario 'Getting a dossier, I want to create a new message on', js: true do scenario 'Getting a dossier, I want to create a new message on', js: true do
page.find_by_id('tr_dossier_' + dossier.id.to_s).click page.find_by_id('tr_dossier_' + dossier.id.to_s).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))
page.find_by_id('open-message').click page.find_by_id('open-message').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').click
@ -31,18 +31,18 @@ feature 'As a User I want to edit a dossier I own' do
scenario 'On the same dossier, I want to edit informations', js: true do scenario 'On the same dossier, I want to edit informations', js: true do
page.find_by_id('tr_dossier_' + dossier.id.to_s).click page.find_by_id('tr_dossier_' + dossier.id.to_s).click
expect(page).to have_current_path(users_dossier_recapitulatif_path(dossier.id.to_s), only_path: true) expect(page).to have_current_path(users_dossier_recapitulatif_path(dossier.id.to_s))
# Linked Dossier # Linked Dossier
linked_dossier_id = dossier.champs.find { |c| c.type_de_champ.type_champ == 'dossier_link' }.value linked_dossier_id = dossier.champs.find { |c| c.type_de_champ.type_champ == 'dossier_link' }.value
expect(page).to have_link("Dossier #{linked_dossier_id}") expect(page).to have_link("Dossier #{linked_dossier_id}")
page.find_by_id('edit-dossier').click page.find_by_id('edit-dossier').click
expect(page).to have_current_path(users_dossier_description_path(dossier.id.to_s), only_path: true) expect(page).to have_current_path(users_dossier_description_path(dossier.id.to_s))
champ_id = dossier.champs.find { |t| t.type_champ == "text" }.id champ_id = dossier.champs.find { |t| t.type_champ == "text" }.id
fill_in "champs_#{champ_id.to_s}", with: 'Contenu du champ 1' fill_in "champs_#{champ_id.to_s}", with: 'Contenu du champ 1'
page.find_by_id('modification_terminee').click page.find_by_id('modification_terminee').click
expect(page).to have_current_path(users_dossier_recapitulatif_path(dossier.id.to_s), only_path: true) expect(page).to have_current_path(users_dossier_recapitulatif_path(dossier.id.to_s))
expect(page.find("#champ-#{champ_id}-value").text).to eq('Contenu du champ 1') expect(page.find("#champ-#{champ_id}-value").text).to eq('Contenu du champ 1')
end end
end end