refactor(spec): add wait_for_autosave helper

This commit is contained in:
Paul Chavard 2022-10-04 12:27:03 +02:00
parent 4500a5aa04
commit dd38fa4458
6 changed files with 60 additions and 47 deletions

View file

@ -171,6 +171,12 @@ module SystemHelpers
def form_id_for(libelle)
find(:xpath, ".//label[contains(text()[normalize-space()], '#{libelle}')]")[:for]
end
def wait_for_autosave(brouillon = true)
blur
expect(page).to have_css('span', text: "#{brouillon ? 'Brouillon' : 'Dossier'} enregistré", visible: true)
page.execute_script("document.documentElement.dispatchEvent(new CustomEvent('autosave:reset'));")
end
end
RSpec.configure do |config|