Skip to content

Commit 33993f2

Browse files
committed
make integration spec helper to wait for debounce autosave to run
1 parent 121afad commit 33993f2

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

test/integration_helper.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,9 @@ def click_away_from_field
8686
find('nav').click
8787
wait_for_ajax
8888
end
89+
90+
def fill_in_field_with_autosave(locator, with:)
91+
fill_in locator, with: with
92+
sleep 0.3 # let frontend debounce do its thing
93+
end
8994
end

test/system/update_patient_info_test.rb

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ class UpdatePatientInfoTest < ApplicationSystemTestCase
2727
describe 'changing patient dashboard information' do
2828
describe 'updating name' do
2929
before do
30-
fill_in 'First and last name', with: 'Susie Everyteen 2'
31-
click_away_from_field
32-
wait_for_ajax
30+
fill_in_field_with_autosave 'First and last name', with: 'Susie Everyteen 2'
3331
reload_page_and_click_link 'Patient Information'
3432
end
3533

@@ -74,8 +72,7 @@ class UpdatePatientInfoTest < ApplicationSystemTestCase
7472

7573
describe 'updating appointment date' do
7674
before do
77-
fill_in 'Appointment date', with: 5.days.from_now.strftime('%m/%d/%Y')
78-
wait_for_ajax
75+
fill_in_field_with_autosave 'Appointment date', with: 5.days.from_now.strftime('%m/%d/%Y')
7976
reload_page_and_click_link 'Patient Information'
8077
end
8178

@@ -106,8 +103,7 @@ class UpdatePatientInfoTest < ApplicationSystemTestCase
106103

107104
describe 'updating phone number' do
108105
before do
109-
fill_in 'Phone number', with: '123-666-8888'
110-
wait_for_ajax
106+
fill_in_field_with_autosave 'Phone number', with: '123-666-8888'
111107
reload_page_and_click_link 'Patient Information'
112108
end
113109

@@ -120,8 +116,7 @@ class UpdatePatientInfoTest < ApplicationSystemTestCase
120116

121117
describe 'updating pronouns' do
122118
before do
123-
fill_in 'Pronouns', with: 'they/them'
124-
wait_for_ajax
119+
fill_in_field_with_autosave 'Pronouns', with: 'they/them'
125120
reload_page_and_click_link 'Patient Information'
126121
end
127122

0 commit comments

Comments
 (0)