test: fix flaky brouillon on repetition

This commit is contained in:
Colin Darie 2023-11-14 09:23:00 +01:00
parent 7c8777557f
commit 2343ee83ef
2 changed files with 7 additions and 3 deletions

View file

@ -81,7 +81,11 @@ module SystemHelpers
end end
def blur def blur
if page.has_css?('body', wait: 0)
page.find('body').click page.find('body').click
else # page after/inside a `within` block does not match body
page.first('div').click
end
end end
def pause def pause

View file

@ -128,13 +128,13 @@ describe 'The user' do
expect(page).to have_field('sub type de champ', with: 'super texte') expect(page).to have_field('sub type de champ', with: 'super texte')
click_on 'Ajouter un élément pour' click_on 'Ajouter un élément pour'
expect(page).to have_content('Supprimer', count: 2)
within '.repetition .row:first-child' do within '.repetition .row:first-child' do
fill_in('sub type de champ', with: 'un autre texte') fill_in('sub type de champ', with: 'un autre texte')
blur
end end
expect(page).to have_content('Supprimer', count: 2)
expect do expect do
within '.repetition .row:first-child' do within '.repetition .row:first-child' do
click_on 'Supprimer lélément' click_on 'Supprimer lélément'