spec: fix flaky test by using new wait_until helper

Fix #3911
This commit is contained in:
Paul Chavard 2019-06-04 14:16:53 +00:00 committed by Pierre de La Morinerie
parent cc80939a42
commit f621bd63e5

View file

@ -122,8 +122,9 @@ feature 'As an administrateur I can edit types de champ', js: true do
it "Add carte champ" do
select('Carte', from: 'champ-0-type_champ')
fill_in 'champ-0-libelle', with: 'Libellé de champ carte', fill_options: { clear: :backspace }
blur
check 'Quartiers prioritaires'
wait_until { procedure.types_de_champ.first.quartiers_prioritaires == true }
expect(page).to have_content('Formulaire enregistré')
preview_window = window_opened_by { click_on 'Prévisualiser le formulaire' }
@ -136,9 +137,10 @@ feature 'As an administrateur I can edit types de champ', js: true do
it "Add dropdown champ" do
select('Menu déroulant', from: 'champ-0-type_champ')
fill_in 'champ-0-libelle', with: 'libellé de champ menu déroulant'
blur
fill_in 'champ-0-drop_down_list_value', with: 'Un menu'
fill_in 'champ-0-libelle', with: 'Libellé de champ menu déroulant', fill_options: { clear: :backspace }
fill_in 'champ-0-drop_down_list_value', with: 'Un menu', fill_options: { clear: :backspace }
wait_until { procedure.types_de_champ.first.drop_down_list&.value == 'Un menu' }
expect(page).to have_content('Formulaire enregistré')
page.refresh