Skip to content

Commit

Permalink
fixes flaky JS test
Browse files Browse the repository at this point in the history
  • Loading branch information
asmega committed Oct 2, 2024
1 parent 34695fa commit f92bc96
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,7 @@
skip_tid

# - Which school do you teach at
choose_school school
choose_school_js school

# - NQT in Academic Year after ITT
choose "Yes"
Expand Down
16 changes: 16 additions & 0 deletions spec/support/feature_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,22 @@ def choose_school(school)
click_button "Continue"
end

def choose_school_js(school)
expect(page).to have_text(/Which (additional )?school/) # there can be variations of the full text depending on which journey/page

fill_in :school_search, with: school.name.sub("The ", "").split(" ").first

within("#school_search__listbox") do
sleep(1) # seems to aid in success, as if click happens before event is bound
find("li", text: school.name).click
end

click_button "Continue"

choose school.name
click_button "Continue"
end

def choose_still_teaching(teaching_at = "Yes, at Penistone Grammar School")
choose teaching_at
click_on "Continue"
Expand Down

0 comments on commit f92bc96

Please sign in to comment.