features: refactor the editor specs
- Add an `add_champ` helper - Stop relying on a default champ being created - Wait for all champs to be created by watching the "Add champ" button This should fix the flakiness of these tests. Refs #4417
This commit is contained in:
parent
52051914aa
commit
a328e8d94a
3 changed files with 49 additions and 34 deletions
|
@ -62,6 +62,24 @@ module FeatureHelpers
|
|||
visit "/users/password/edit?#{token_params}"
|
||||
end
|
||||
|
||||
# Add a new type de champ in the procedure editor
|
||||
def add_champ(options = {})
|
||||
add_champs(options)
|
||||
end
|
||||
|
||||
# Add several new type de champ in the procedure editor
|
||||
def add_champs(count: 1, remove_flash_message: false)
|
||||
within '.buttons' do
|
||||
count.times { click_on 'Ajouter un champ' }
|
||||
end
|
||||
|
||||
if remove_flash_message
|
||||
expect(page).to have_button('Ajouter un champ', disabled: false)
|
||||
expect(page).to have_content('Formulaire enregistré')
|
||||
execute_script("document.querySelector('#flash_message').remove();")
|
||||
end
|
||||
end
|
||||
|
||||
def blur
|
||||
page.find('body').click
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue