From 48ee5759901d14361f7a793bffa5914cccbdb0fd Mon Sep 17 00:00:00 2001 From: Lisa Durand Date: Thu, 19 Oct 2023 17:42:10 +0200 Subject: [PATCH] fix specs --- .../system/administrateurs/procedure_creation_spec.rb | 5 +++-- spec/system/administrateurs/types_de_champ_spec.rb | 11 +++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/spec/system/administrateurs/procedure_creation_spec.rb b/spec/system/administrateurs/procedure_creation_spec.rb index c03182c85..60a7bb792 100644 --- a/spec/system/administrateurs/procedure_creation_spec.rb +++ b/spec/system/administrateurs/procedure_creation_spec.rb @@ -40,8 +40,9 @@ describe 'Creating a new procedure', js: true, retry: 3 do expect(page).to have_content('Formulaire enregistré') expect(page).to have_selector('select > optgroup', count: 8) - page.refresh - add_champ + within(find('.type-de-champ-add-button', match: :first)) { + add_champ + } expect(page).to have_selector('.type-de-champ', count: 1) end diff --git a/spec/system/administrateurs/types_de_champ_spec.rb b/spec/system/administrateurs/types_de_champ_spec.rb index d8b079e82..3ec3e8833 100644 --- a/spec/system/administrateurs/types_de_champ_spec.rb +++ b/spec/system/administrateurs/types_de_champ_spec.rb @@ -30,8 +30,9 @@ describe 'As an administrateur I can edit types de champ', js: true, retry: 3 do scenario "adding multiple champs" do # Champs are created when clicking the 'Add field' button add_champ - page.refresh - add_champ + within(find('.type-de-champ-add-button', match: :first)) { + add_champ + } within(find('.type-de-champ-add-button', match: :first)) { add_champ } @@ -212,8 +213,10 @@ describe 'As an administrateur I can edit types de champ', js: true, retry: 3 do first_header = procedure.active_revision.types_de_champ_public.first select('Titre de niveau 1', from: dom_id(first_header, :header_section_level)) - page.refresh - add_champ + within(find('.type-de-champ-add-button', match: :first)) { + add_champ + } + wait_until { procedure.reload.active_revision.types_de_champ_public.count == 2 } second_header = procedure.active_revision.types_de_champ_public.last select('Titre de section', from: dom_id(second_header, :type_champ))